Commit ea4b699c authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

handle files with scantype undefined

parent 4c811548
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ NSE_FILE_TYPES = {
"application/nexus-nse-xyz"      : '.nxs.h5',
"application/nexus-nse-transmission" : '.nxs.h5',
"application/nexus-nse-diffraction"  : '.nxs.h5',
"application/nexus-nse-unknown"      : '.nxs.h5', # scantype unset
}


@@ -67,14 +68,16 @@ def get_hdf_filetype(filename):
            try:
                notes   = nxsfile['/entry/notes']
                notes   = bytes(notes[0]).decode('ascii').lower()
                ftype    = "application/nexus-nse-unknown"
                if 'scan=transmission' in notes:
                    return "application/nexus-nse-transmission"
                if 'scan=diffraction' in notes:
                    return "application/nexus-nse-diffraction"
                if 'scan=xyz' in notes:
                    return "application/nexus-nse-xyz"
                if 'scan=echo' in notes:
                    return "application/nexus-nse-echo"
                    ftype = "application/nexus-nse-transmission"
                elif 'scan=diffraction' in notes:
                    ftype = "application/nexus-nse-diffraction"
                elif 'scan=xyz' in notes:
                    ftype = "application/nexus-nse-xyz"
                elif 'scan=echo' in notes:
                    ftype = "application/nexus-nse-echo"
                return ftype
            except KeyError:
                pass
    return get_mime_filetype(filename)
+1 −1
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ PySEN revision module
"""
import sys
__version__  = "2.0"
__release__  = "0"
__release__  = "1"
__date__     = "June 2, 2025"

def version(full=False):