add Maloja end station spectrometer
This commit is contained in:
@ -15,10 +15,30 @@ channel_dict = {
|
|||||||
'PSSS LB incl gasd': ['SARFE10-PSSS059-LB:SPECTRUM_Y', aramis_uncalibrated, aramis_calibrated],
|
'PSSS LB incl gasd': ['SARFE10-PSSS059-LB:SPECTRUM_Y', aramis_uncalibrated, aramis_calibrated],
|
||||||
'PMOS Maloja EEHG': ['SATOP21-PMOS127-2D:SPECTRUM_Y', eehg_spectrometer],
|
'PMOS Maloja EEHG': ['SATOP21-PMOS127-2D:SPECTRUM_Y', eehg_spectrometer],
|
||||||
'PMOS Furka EEHG': ['SATOP31-PMOS132-2D:SPECTRUM_Y', eehg_spectrometer],
|
'PMOS Furka EEHG': ['SATOP31-PMOS132-2D:SPECTRUM_Y', eehg_spectrometer],
|
||||||
|
'Maloja end station': ['SATES24-CAMS161-M1.projection_signal', athos_uncalibrated, athos_calibrated],
|
||||||
}
|
}
|
||||||
names = ['PSSS', 'PMOS Maloja', 'PMOS Furka', 'PSSS LB', 'PSSS incl gasd', 'PSSS LB incl gasd', 'PMOS Maloja EEHG','PMOS Furka EEHG']
|
names = ['PSSS', 'PMOS Maloja', 'PMOS Furka', 'PSSS LB', 'PSSS incl gasd', 'PSSS LB incl gasd', 'PMOS Maloja EEHG','PMOS Furka EEHG', 'Maloja end station']
|
||||||
|
|
||||||
class SpectralAnalysis:
|
|
||||||
|
class SpectralAnalysisBase:
|
||||||
|
def connect_x_axis(self):
|
||||||
|
try:
|
||||||
|
self.pv = PV(self.channel[0].replace('_Y','_X'))
|
||||||
|
except Exception as e:
|
||||||
|
print('could not read X axis PV')
|
||||||
|
print(e)
|
||||||
|
self.pv = None
|
||||||
|
|
||||||
|
def read_spectrum_axis(self):
|
||||||
|
if self.pv:
|
||||||
|
return self.pv.value
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def getSpectrometerName(self):
|
||||||
|
return self.channel
|
||||||
|
|
||||||
|
class SpectralAnalysis(SpectralAnalysisBase):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.bs = BSCache(100000,receive_timeout=10000) # 100 second timeout, size for 10 second data taken
|
self.bs = BSCache(100000,receive_timeout=10000) # 100 second timeout, size for 10 second data taken
|
||||||
self.bs.stop()
|
self.bs.stop()
|
||||||
@ -42,13 +62,14 @@ class SpectralAnalysis:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
print('Cannot find requested channels in BS stream')
|
print('Cannot find requested channels in BS stream')
|
||||||
self.hasBStream=False
|
self.hasBStream=False
|
||||||
self.pv = PV(self.channel[0].replace('_Y','_X'))
|
self.connect_x_axis()
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
print('Stopping BSStream Thread...')
|
print('Stopping BSStream Thread...')
|
||||||
self.bs.stop()
|
self.bs.stop()
|
||||||
self.bs.pt.running.clear() # for some reason I have to
|
self.bs.pt.running.clear() # for some reason I have to
|
||||||
self.pv.disconnect()
|
if self.pv:
|
||||||
|
self.pv.disconnect()
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
self.bs.flush()
|
self.bs.flush()
|
||||||
@ -56,13 +77,7 @@ class SpectralAnalysis:
|
|||||||
def read(self):
|
def read(self):
|
||||||
return next(self.bs)
|
return next(self.bs)
|
||||||
|
|
||||||
def read_spectrum_axis(self):
|
class SpectralAnalysis2(SpectralAnalysisBase):
|
||||||
return self.pv.value
|
|
||||||
|
|
||||||
def getSpectrometerName(self):
|
|
||||||
return self.channel
|
|
||||||
|
|
||||||
class SpectralAnalysis2:
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.bs1 = BSCache(100000, receive_timeout=10000)
|
self.bs1 = BSCache(100000, receive_timeout=10000)
|
||||||
self.bs2 = BSCache(100000, receive_timeout=10000)
|
self.bs2 = BSCache(100000, receive_timeout=10000)
|
||||||
@ -85,10 +100,7 @@ class SpectralAnalysis2:
|
|||||||
except ValueError:
|
except ValueError:
|
||||||
print('Cannot find requested channel %s in BS stream' % channels[1:])
|
print('Cannot find requested channel %s in BS stream' % channels[1:])
|
||||||
self.hasBStream=False
|
self.hasBStream=False
|
||||||
self.pv = PV(channels[0].replace('_Y','_X'))
|
self.connect_x_axis()
|
||||||
|
|
||||||
def read_spectrum_axis(self):
|
|
||||||
return self.pv.value
|
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
for _bs in self.bs1, self.bs2:
|
for _bs in self.bs1, self.bs2:
|
||||||
@ -102,5 +114,6 @@ class SpectralAnalysis2:
|
|||||||
for _bs in self.bs1, self.bs2:
|
for _bs in self.bs1, self.bs2:
|
||||||
_bs.stop()
|
_bs.stop()
|
||||||
_bs.pt.running.clear() # for some reason I have to
|
_bs.pt.running.clear() # for some reason I have to
|
||||||
self.pv.disconnect()
|
if self.pv:
|
||||||
|
self.pv.disconnect()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user