Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions spe2py.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,26 @@ def _get_wavelength(self):
try:
wavelength_string = StringIO(self.footer.SpeFormat.Calibrations.WavelengthMapping.Wavelength.cdata)
except AttributeError:
print("XML Footer was not loaded prior to calling _get_wavelength")
raise
"""
possibly because a calibration is present.
Try getting the WavelengthError.cdata instead of Wavelength.cdata when calibration is present.
"""
try:
wavelengthErrorStr = self.footer.SpeFormat.Calibrations.WavelengthMapping.WavelengthError.cdata
wavelengthErrorStrStream = StringIO(wavelengthErrorStr.replace(" ", "\n"))
wavelengthError = np.loadtxt(wavelengthErrorStrStream, delimiter=',')
return wavelengthError[:,0]
except:
print("XML Footer was not loaded prior to calling _get_wavelength")
return
except IndexError:
print("XML Footer does not contain Wavelength Mapping information")
return





wavelength = np.loadtxt(wavelength_string, delimiter=',')

return wavelength
Expand Down