hyperspy.io_plugins.edax module

hyperspy.io_plugins.edax.__get_ipr_header(f, endianess)

Get the header of an spc file, checking for the file version as necessary

Parameters:
  • f (file) – A file object for the .spc file to be read (i.e. file should be already opened with open())

  • endianess (char) – Byte-order of data to read

Returns:

ipr_header – Array containing the binary information read from the .ipr file

Return type:

np.ndarray

hyperspy.io_plugins.edax.__get_spc_header(f, endianess, load_all_spc)

Get the header of an spc file, checking for the file version as necessary

Parameters:
  • f (file) – A file object for the .spc file to be read (i.e. file should be already opened with open())

  • endianess (char) – Byte-order of data to read

  • load_all_spc (bool) – Switch to control if all of the .spc header is read, or just the parts relevant to HyperSpy

Returns:

spc_header – Array containing the binary information read from the .spc file

Return type:

np.ndarray

hyperspy.io_plugins.edax._add_spc_metadata(metadata, spc_header)

Return metadata with information from the .spc header added

Parameters:
  • metadata (dict) – current metadata of signal without spectral calibration information added

  • spc_header (dict) – header of .spc file that contains spectral information such as azimuth and elevation angles, energy resolution, etc.

Returns:

metadata – copy of original dictionary with spectral calibration added

Return type:

dict

hyperspy.io_plugins.edax.file_reader(filename, record_by='spectrum', endianess='<', **kwargs)
Parameters:
  • filename (str) – Name of file to read

  • record_by (str) – EDAX EDS data is always recorded by ‘spectrum’, so this parameter is not used

  • endianess (char) – Byte-order of data to read

  • **kwargs – Additional keyword arguments supplied to the readers

hyperspy.io_plugins.edax.get_ipr_dtype_list(endianess='<', version=333)

Get the data type list for an IPR image description file. Further information about the file format is available here.

Table of header tags:

  • version: 2 byte unsigned short; Current version number: 334

  • imageType: 2 byte unsigned short; 0=empty; 1=electron; 2=xmap; 3=disk; 4=overlay

  • label: 8 byte char array; Image label

  • sMin: 2 byte unsigned short; Min collected signal

  • sMax: 2 byte unsigned short; Max collected signal

  • color: 2 byte unsigned short; color: 0=gray; 1=R; 2=G; 3=B; 4=Y; 5=M; 6=C; 8=overlay

  • presetMode: 2 byte unsigned short; 0=clock; 1=live

  • presetTime: 4 byte unsigned long; Dwell time for x-ray (millisec)

  • dataType: 2 byte unsigned short; 0=ROI; 1=Net intensity; 2=K ratio; 3=Wt%; 4=Mthin2

  • timeConstantOld: 2 byte unsigned short; Amplifier pulse processing time [usec]

  • reserved1: 2 byte short; Not used

  • roiStartChan: 2 byte unsigned short; ROI starting channel

  • roiEndChan: 2 byte unsigned short; ROI ending channel

  • userMin: 2 byte short; User Defined Min signal range

  • userMax: 2 byte short; User Defined Max signal range

  • iADC: 2 byte unsigned short; Electron detector number: 1; 2; 3; 4

  • reserved2: 2 byte short; Not used

  • iBits: 2 byte unsigned short; conversion type: 8; 12 (not used)

  • nReads: 2 byte unsigned short; No. of reads per point

  • nFrames: 2 byte unsigned short; No. of frames averaged (not used)

  • fDwell: 4 byte float; Dwell time (not used)

  • accV: 2 byte unsigned short; V_acc in units of 100V

  • tilt: 2 byte short; Sample tilt [deg]

  • takeoff: 2 byte short; Takeoff angle [deg]

  • mag: 4 byte unsigned long; Magnification

  • wd: 2 byte unsigned short; Working distance [mm]

  • mppX: 4 byte float; Microns per pixel in X direction

  • mppY: 4 byte float; Microns per pixel in Y direction

  • nTextLines: 2 byte unsigned short; No. of comment lines

  • charText: (4 x 32) byte character array; Comment text

  • reserved3: 4 byte float; Not used

  • nOverlayElements: 2 byte unsigned short; No. of overlay elements

  • overlayColors: 16 array of 2 byte unsigned short; Overlay colors

These two are specific to V334 of the file format, and are omitted for compatibility with V333 of the IPR format:

  • timeConstantNew: 4 byte float; Amplifier time constant [usec]

  • reserved4: 2 array of 4 byte float; Not used

Parameters:
  • endianess (char) – byte-order used to read the data

  • version (float) – version of .ipr file to read (only 333 and 334 have been tested) Default is 333 to be as backwards-compatible as possible, but the file version can be read from the file anyway, so this parameter should always be set programmatically

Returns:

dtype_list – List of the data tags and data types that will be used by numpy to read an IPR file.

Return type:

list

hyperspy.io_plugins.edax.get_spc_dtype_list(load_all=False, endianess='<', version=0.61)

Get the data type list for an SPC spectrum. Further information about the file format is available here.

Parameters:
  • load_all (bool) – Switch to control if all the data is loaded, or if just the important pieces of the signal will be read (speeds up loading time)

  • endianess (char) – byte-order used to read the data

  • version (float) – version of spc file to read (only 0.61 and 0.70 have been tested) Default is 0.61 to be as backwards-compatible as possible, but the file version can be read from the file anyway, so this parameter should always be set programmatically

  • tags (Table of header) –

    • fVersion: 4 byte float; File format Version

    • aVersion: 4 byte float; Application Version

    • fileName: 8 array of 1 byte char; File name w/o ‘.spc’ extension (OLD)

    • collectDateYear: 2 byte short; Year the spectrum was collected

    • collectDateDay: 1 byte char; Day the spectrum was collected

    • collectDateMon: 1 byte char; Month the spectrum was collected

    • collectTimeMin: 1 byte char; Minute the spectrum was collected

    • collectTimeHour: 1 byte char; Hour the spectrum was collected

    • collectTimeHund: 1 byte char; Hundredth second the spectrum was collected

    • collectTimeSec: 1 byte char; Second the spectrum was collected

    • fileSize: 4 byte long; Size of spectrum file in bytes

    • dataStart: 4 byte long; Start of spectrum data in bytes offset from 0 of file

    • numPts: 2 byte short; Number of spectrum pts

    • intersectingDist: 2 byte short; Intersecting distance * 100 (mm)

    • workingDist: 2 byte short; Working distance * 100

    • scaleSetting: 2 byte short; Scale setting distance * 100

    • filler1: 24 byte;

    • spectrumLabel: 256 array of 1 byte char; Type label for spectrum, 0-39=material type, 40-255=sample

    • imageFilename: 8 array of 1 byte char; Parent Image filename

    • spotX: 2 byte short; Spot X in parent image file

    • spotY: 2 byte short; Spot Y in parent image file

    • imageADC: 2 byte short; Image ADC value 0-4095

    • discrValues: 5 array of 4 byte long; Analyzer Discriminator Values

    • discrEnabled: 5 array of 1 byte unsigned char; Discriminator Flags (0=Disabled,1=Enabled)

    • pileupProcessed: 1 byte char; Pileup Processed Flag (0=No PU,1=Static PU, 2=Dynamic PU,…)

    • fpgaVersion: 4 byte long; Firmware Version.

    • pileupProcVersion: 4 byte long; Pileup Processing Software Version

    • NB5000CFG: 4 byte long; Defines Hitachi NB5000 Dual Stage Cfg 0=None, 10=Eucentric Crossx,11= Eucentric Surface 12= Side Entry - Side 13 = Side Entry - Top

    • filler2: 12 byte;

    • evPerChan: 4 byte long; EV/channel

    • ADCTimeConstant: 2 byte short; ADC Time constant

    • analysisType: 2 byte short; Preset mode 1=clock, 2=count, 3=none, 4=live, 5=resume

    • preset: 4 byte float; Analysis Time Preset value

    • maxp: 4 byte long; Maximum counts of the spectrum

    • maxPeakCh: 4 byte long; Max peak channel number

    • xRayTubeZ: 2 byte short; XRF

    • filterZ: 2 byte short; XRF

    • current: 4 byte float; XRF

    • sampleCond: 2 byte short; XRF Air= 0, Vacuum= 1, Helium= 2

    • sampleType: 2 byte short; Bulk or thin

    • xrayCollimator: 2 byte unsigned short; 0=None, 1=Installed

    • xrayCapilaryType: 2 byte unsigned short; 0=Mono, 1=Poly

    • xrayCapilarySize: 2 byte unsigned short; Range : 20 – 5000 Microns

    • xrayFilterThickness: 2 byte unsigned short; Range : 0 – 10000 Microns

    • spectrumSmoothed: 2 byte unsigned short; 1= Spectrum Smoothed, Else 0

    • detector_Size_SiLi: 2 byte unsigned short; Eagle Detector 0=30mm, 1=80mm

    • spectrumReCalib: 2 byte unsigned short; 1= Peaks Recalibrated, Else 0

    • eagleSystem: 2 byte unsigned short; 0=None, 2=Eagle2, 3=Eagle3, 4-Xscope

    • sumPeakRemoved: 2 byte unsigned short; 1= Sum Peaks Removed, Else 0

    • edaxSoftwareType: 2 byte unsigned short; 1= Team Spectrum, Else 0

    • filler3: 6 byte;

    • escapePeakRemoved: 2 byte unsigned short; 1=Escape Peak Was Removed, Else 0

    • analyzerType: 4 byte unsigned long; Hardware type 1=EDI1, 2=EDI2, 3=DPP2, 31=DPP-FR, 32=DPP-FR2, 4=DPP3, 5= APOLLO XLT/XLS/DPP-4 (EDPP)

    • startEnergy: 4 byte float; Starting energy of spectrum

    • endEnergy: 4 byte float; Ending energy of spectrum

    • liveTime: 4 byte float; LiveTime

    • tilt: 4 byte float; Tilt angle

    • takeoff: 4 byte float; Take off angle

    • beamCurFact: 4 byte float; Beam current factor

    • detReso: 4 byte float; Detector resolution

    • detectType: 4 byte unsigned long; Detector Type: 1=Std-BE, 2=UTW, 3=Super UTW, 4=ECON 3/4 Open, 5=ECON 3/4 Closed, 6=ECON 5/6 Open, 7=ECON 5/6 Closed, 8=TEMECON; Add + 10 For Sapphire SiLi Detectors, (11-18), which started shipping in 1996. 30 = APOLLO 10 SDD, 31=APOLLO XV, 32 = APOLLO 10+, 40 = APOLLO 40 SDD ,50 = APOLLO-X, 51=APOLLO-XP, 52 = APOLLO-XL, 53 = APOLLO XL-XRF, 60 =APOLLO-XLT-LS, 61 =APOLLO-XLT-NW, 62 =APOLLO-XLT-SUTW

    • parThick: 4 byte float; Parlodion light shield thickness

    • alThick: 4 byte float; Aluminum light shield thickness

    • beWinThick: 4 byte float; Be window thickness

    • auThick: 4 byte float; Gold light shield thickness

    • siDead: 4 byte float; Si dead layer thickness

    • siLive: 4 byte float; Si live layer thickness

    • xrayInc: 4 byte float; X-ray incidence angle

    • azimuth: 4 byte float; Azimuth angle of detector

    • elevation: 4 byte float; Elevation angle of detector

    • bCoeff: 4 byte float; K-line B coefficient

    • cCoeff: 4 byte float; K-line C coefficient

    • tailMax: 4 byte float; Tail function maximum channel

    • tailHeight: 4 byte float; Tail height adjustment percentage

    • kV: 4 byte float; Acc voltage

    • apThick: 4 byte float; Ap window thickness

    • xTilt: 4 byte float; x tilt angle for mDX

    • yTilt: 4 byte float; y tilt angle for mDX

    • yagStatus: 4 byte unsigned long; 0 = N/A, 1 = YAG OUT, 2 = YAG IN

    • filler4: 24 byte;

    • rawDataType: 2 byte unsigned short; TEM or SEM data

    • totalBkgdCount: 4 byte float; Accumulated background counts

    • totalSpectralCount: 4 byte unsigned long; Accumulated spectrum counts

    • avginputCount: 4 byte float; Average spectral counts

    • stdDevInputCount: 4 byte float; Standard deviation of spectral counts

    • peakToBack: 2 byte unsigned short; Peak to background setting. 0 = off, 1 = low, 2 = medium, 3 = high, 4 = user selected

    • peakToBackValue: 4 byte float; Peak to back value

    • filler5: 38 byte;

    • numElem: 2 byte short; Number of peak id elements 0-48

    • at: 48 array of 2 byte unsigned short; atomic numbers for peak id elems

    • line: 48 array of 2 byte unsigned short; line numbers for peak id elems

    • energy: 48 array of 4 byte float; float energy of identified peaks

    • height: 48 array of 4 byte unsigned long; height in counts of id’ ed peaks

    • spkht: 48 array of 2 byte short; sorted peak height of id’ ed peaks

    • filler5_1: 30 byte;

    • numRois: 2 byte short; Number of ROI’s defined 0-48

    • st: 48 array of 2 byte short; Start channel # for each ROI

    • end: 48 array of 2 byte short; End channel # for each ROI

    • roiEnable: 48 array of 2 byte short; ROI enable/disable flags

    • roiNames: (24 x 8) array of 1 byte char; 8 char name for eah ROI

    • filler5_2: 1 byte;

    • userID: 80 array of 1 byte char; User ID (Vision S/W) - Overlapping

    • filler5_3: 111 byte;

    • sRoi: 48 array of 2 byte short; sorted ROI heights

    • scaNum: 48 array of 2 byte short; SCA number assigned for each ROI

    • filler6: 12 byte;

    • backgrdWidth: 2 byte short; Background width

    • manBkgrdPerc: 4 byte float; Percentage to move manual background down

    • numBkgrdPts: 2 byte short; Number of background points (2-64)

    • backMethod: 4 byte unsigned long; Background method 1=auto, 2=manual

    • backStEng: 4 byte float; Starting energy of background

    • backEndEng: 4 byte float; Ending energy of background

    • bg: 64 array of 2 byte short; Channel # of background point

    • bgType: 4 byte unsigned long; Background type. 1 = curve, 2 = linear.

    • concenKev1: 4 byte float; First concentration background point

    • concenKev2: 4 byte float; Second concentration background point

    • concenMethod: 2 byte short; 0 = Off, 1 = On

    • jobFilename: 32 array of 1 byte char; Vision Job Filename

    • filler7: 16 byte;

    • numLabels: 2 byte short; Number of displayed labels

    • label: (10 x 32) array 1 byte char; 32 character labels on the spectrum

    • labelx: 10 array of 2 byte short; x position of label in terms of channel #

    • labely: 10 array of 4 byte long; y position of label in terms of counts

    • zListFlag: 4 byte long; Flag to indicate if Z List was written

    • bgPercents: 64 array of 4 byte float; Percentage to move background point up and down.

    • IswGBg: 2 byte short; = 1 if new backgrd pts exist

    • BgPoints: 5 array of 4 byte float; Background points

    • IswGConc: 2 byte short; = 1 if given concentrations exist

    • numConcen: 2 byte short; Number of elements (up to 24)

    • ZList: 24 array of 2 byte short; Element list for which given concentrations exist

    • GivenConc: 24 array of 4 byte float; Given concentrations for each element in Zlist

    • filler8: 598 byte;

    • s: 4096 array of 4 byte long; counts for each channel

    • longFileName: 256 array of 1 byte char; Long filename for 32 bit version

    • longImageFileName: 256 array of 1 byte char; Associated long image file name

    • ADCTimeConstantNew: 4 byte float; Time constant: 2.5… 100 OR 1.6… 102.4 us

    # the following datatypes are only included for version 0.70:

    • filler9: 60 byte;

    • numZElements: 2 byte short; number of Z List elements for quant

    • zAtoms: 48 array of 2 byte short; Z List Atomic numbers

    • zShells: 48 array of 2 byte short; Z List Shell numbers

Returns:

dtype_list – List of the data tags and data types that will be used by numpy to read an SPC file header.

Return type:

list

hyperspy.io_plugins.edax.get_spd_dtype_list(endianess='<')

Get the data type list for an SPD map. Further information about the file format is available here.

Table of header tags:
  • tag: 16 byte char array; File ID tag (“MAPSPECTRA_DATA”)

  • version: 4 byte long; File version

  • nSpectra: 4 byte long; Number of spectra in file

  • nPoints: 4 byte long; Number of map pixels in X direction

  • nLines: 4 byte long; Number of map pixels in Y direction

  • nChannels: 4 byte long; Number of channels per spectrum

  • countBytes: 4 byte long; Number of count bytes per channel

  • dataOffset: 4 byte long; File offset in bytes for data start

  • nFrames: 4 byte long; Number of frames in live spectrum mapping

  • fName: 120 byte char array; File name of electron image acquired during mapping

Parameters:

endianess (byte-order used to read the data) –

Returns:

dtype_list – List of the data tags and data types that will be used by numpy to read an SPD file header.

Return type:

list

hyperspy.io_plugins.edax.spc_reader(filename, endianess='<', load_all_spc=False, **kwargs)

Read data from an SPC spectrum specified by filename.

Parameters:
  • filename (str) – Name of SPC file to read

  • endianess (char) – Byte-order of data to read

  • load_all_spc (bool) – Switch to control if all of the .spc header is read, or just the important parts for import into HyperSpy

  • **kwargs – Remaining arguments are passed to the Numpy memmap function

Returns:

list with dictionary of signal information to be passed back to hyperspy.io.load_with_reader

Return type:

list

hyperspy.io_plugins.edax.spd_reader(filename, endianess='<', spc_fname=None, ipr_fname=None, load_all_spc=False, **kwargs)

Read data from an SPD spectral map specified by filename.

Parameters:
  • filename (str) – Name of SPD file to read

  • endianess (char) – Byte-order of data to read

  • spc_fname (None or str) – Name of file from which to read the spectral calibration. If data was exported fully from EDAX TEAM software, an .spc file with the same name as the .spd should be present. If None, the default filename will be searched for. Otherwise, the name of the .spc file to use for calibration can be explicitly given as a string.

  • ipr_fname (None or str) – Name of file from which to read the spatial calibration. If data was exported fully from EDAX TEAM software, an .ipr file with the same name as the .spd (plus a “_Img” suffix) should be present. If None, the default filename will be searched for. Otherwise, the name of the .ipr file to use for spatial calibration can be explicitly given as a string.

  • load_all_spc (bool) – Switch to control if all of the .spc header is read, or just the important parts for import into HyperSpy

  • **kwargs – Remaining arguments are passed to the Numpy memmap function

Returns:

list with dictionary of signal information to be passed back to hyperspy.io.load_with_reader

Return type:

list