Commit d9db66dc authored by Elisa Kanaki's avatar Elisa Kanaki

Bugfix in getSpectraFromDisk, changed naming of PerkinElmer spectra to be...

Bugfix in getSpectraFromDisk, changed naming of PerkinElmer spectra to be consistent with Reni and WITec (for future use with LoadTrueMatchResults)
parent 51f6d7cb
......@@ -61,7 +61,10 @@ def importPerkinElmerSpectra(fname):
for index, line in enumerate(fp.readlines()):
if index == 0:
for name in line.split(';'):
names.append(name.split('.sp')[0])
try:
names.append(name.split('.sp')[0] + ' (' + str(name.split('.sp')[0].split('_')[1]) + ')')
except IndexError:
names.append(name.split('.sp')[0] + ' (0)')
elif index > 1:
spectra.append(line.split(';'))
......
......@@ -67,16 +67,18 @@ class ParticleContainer(object):
fname = QtWidgets.QFileDialog.getOpenFileName(QtWidgets.QWidget(), 'Select Spectra File', self.datasetParent.path, 'text file (*.txt)')[0]
if fname:
#TODO: implement a more elegant way of testing through the individual imports...
# TODO: implement a more elegant way of testing through the individual imports...
# Renishaw spectra raise ImportError, while PerkinElmer spectra raise ValueError
try:
spectra, spectraNames = importSpectra.importWITecSpectra(fname)
except ImportError:
except:
try:
spectra, spectraNames = importSpectra.importRenishawSpectra(fname)
except ImportError:
except:
try:
spectra, spectraNames = importSpectra.importPerkinElmerSpectra(fname)
except ImportError:
except:
print('Unknown spectra format! Skipping load spectra.')
pass
if spectra is not None:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment