updating snapshot and loading datasets
This commit is contained in:
@ -19,6 +19,7 @@ class SpectralAnalysis:
|
|||||||
self.bs.stop()
|
self.bs.stop()
|
||||||
self.channel = None
|
self.channel = None
|
||||||
self.channels = [channel_dict[x] for x in names]
|
self.channels = [channel_dict[x] for x in names]
|
||||||
|
self.hasBStream=False
|
||||||
|
|
||||||
def connect_name(self, name):
|
def connect_name(self, name):
|
||||||
index = names.index(name)
|
index = names.index(name)
|
||||||
@ -30,7 +31,12 @@ class SpectralAnalysis:
|
|||||||
self.channel = self.channels[ich]
|
self.channel = self.channels[ich]
|
||||||
print('Connecting to BS-Channel:',self.channel)
|
print('Connecting to BS-Channel:',self.channel)
|
||||||
self.bs.channels.clear()
|
self.bs.channels.clear()
|
||||||
self.bs.get_vars(self.channel) # this starts the stream into the cache
|
self.hasBStream=True
|
||||||
|
try:
|
||||||
|
self.bs.get_vars(self.channel) # this starts the stream into the cache
|
||||||
|
except ValueError:
|
||||||
|
print('Cannot find requested channels in BS stream')
|
||||||
|
self.hasBStream=False
|
||||||
self.pv = PV(self.channel[0].replace('_Y','_X'))
|
self.pv = PV(self.channel[0].replace('_Y','_X'))
|
||||||
|
|
||||||
def terminate(self):
|
def terminate(self):
|
||||||
|
@ -9,5 +9,6 @@ from .save import getDatasetFileName
|
|||||||
from .load import loadDataset
|
from .load import loadDataset
|
||||||
from .elog import writeElog
|
from .elog import writeElog
|
||||||
from .slic import SlicScan
|
from .slic import SlicScan
|
||||||
|
from .slic import importSlicScan
|
||||||
from .doocs import doocsread
|
from .doocs import doocsread
|
||||||
from .doocs import doocswrite
|
from .doocs import doocswrite
|
||||||
|
@ -3,10 +3,22 @@ import h5py
|
|||||||
|
|
||||||
def loadDataset(filename):
|
def loadDataset(filename):
|
||||||
hid = h5py.File(filename, "r")
|
hid = h5py.File(filename, "r")
|
||||||
|
icount = 0
|
||||||
snap = loadSnap(hid)
|
snap = loadSnap(hid)
|
||||||
data = loadData(hid)
|
data =[]
|
||||||
act = loadActuator(hid)
|
act = []
|
||||||
|
for key in hid.keys():
|
||||||
|
if 'scan' in key:
|
||||||
|
ID = int(key.split('_')[1])
|
||||||
|
print('Reading scan_%d' % ID)
|
||||||
|
data.append(loadData(hid,ID))
|
||||||
|
act.append(loadActuator(hid,ID))
|
||||||
|
icount +=1
|
||||||
hid.close()
|
hid.close()
|
||||||
|
if icount == 0:
|
||||||
|
return None, None, None
|
||||||
|
elif icount == 1:
|
||||||
|
return data[0], act[0],snap
|
||||||
return data,act,snap
|
return data,act,snap
|
||||||
|
|
||||||
def loadSnap(hid):
|
def loadSnap(hid):
|
||||||
|
@ -62,7 +62,7 @@ class SlicScan(QObject):
|
|||||||
Thread(name='Snap-Acquisition',target=self.Tsnap).start()
|
Thread(name='Snap-Acquisition',target=self.Tsnap).start()
|
||||||
|
|
||||||
def Tsnap(self):
|
def Tsnap(self):
|
||||||
self.snap = getSnap()
|
self.snap = getSnap()
|
||||||
print('Acquired snap')
|
print('Acquired snap')
|
||||||
self.sigsnap.emit(True)
|
self.sigsnap.emit(True)
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ def loadSnap(filename):
|
|||||||
if '.' in val:
|
if '.' in val:
|
||||||
res[pv]=float(val)
|
res[pv]=float(val)
|
||||||
else:
|
else:
|
||||||
res[pv]= val
|
res[pv]= val # might be string!!!!
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user