1-
1+
22from pathlib import PurePath
33from collections import deque , OrderedDict
44import time as ttime
3434# | |/ /| | | || |\ | | | | |___ \ V V / / | | | | |/ /| | /\__/ / #
3535# |___/ \_| |_/\_| \_/ \_/ \____/ \_/\_/_/ \_| |_/___/ \_| \____/ #
3636###########################################################################
37-
38-
37+
38+
3939#from BMM.pilatus import BMMFileStoreHDF5, BMMHDF5Plugin
4040
4141class BMMDanteFileStoreHDF5 (FileStorePluginBase ):
@@ -72,15 +72,15 @@ def stage(self):
7272 "frame_per_point" : self .get_frames_per_point (),
7373 }
7474 self ._generate_resource (resource_kwargs )
75-
75+
7676class BMMDanteHDF5Plugin (HDF5Plugin_V33 , BMMDanteFileStoreHDF5 , FileStoreIterativeWrite ):
77-
77+
7878
7979 def _update_paths (self ):
8080 self .reg_root = self .root_path_str
8181 self ._write_path_template = self .root_path_str + self .path_template_str
8282 self ._read_path_template = self .root_path_str + self .path_template_str
83-
83+
8484 @property
8585 def root_path_str (self ):
8686 root_path = f"/nsls2/data3/bmm/proposals/{ md ['cycle' ]} /{ md ['data_session' ]} /assets/dante-1/"
@@ -132,7 +132,7 @@ def warmup(self):
132132 ttime .sleep (0.1 ) # abundance of caution
133133
134134 self .parent .cam .acquire .set (1 ).wait ()
135-
135+
136136 # JOSH: do we need more than 2 seconds here?
137137 # adding more time here helps!
138138 for i in tqdm (range (4 ), colour = '#7f8c8d' ):
@@ -221,7 +221,7 @@ class DanteCamBase(ADBase):
221221 min_x = ADCpt (SignalWithRBV , "MinX" )
222222 min_y = ADCpt (SignalWithRBV , "MinY" )
223223 model = ADCpt (EpicsSignalRO , "Model_RBV" )
224-
224+
225225
226226 num_exposures = ADCpt (SignalWithRBV , "NumExposures" )
227227 num_exposures_counter = ADCpt (EpicsSignalRO , "NumExposuresCounter_RBV" )
@@ -275,16 +275,16 @@ def __init__(self, prefix, channel, *args, **kwargs):
275275 def set_roi (self , start , width ):
276276 self .energy_start .put (start )
277277 self .energy_width .put (width )
278-
279-
278+
279+
280280class BMMDante (DetectorBase ):
281281 #image = Cpt(ImagePlugin, "image1:")
282282 cam = Cpt (DanteCamBase , "dante:" )
283283 #acquire_period = ADCpt(SignalWithRBV, "PollTime")
284284 acquire_time = ADCpt (EpicsSignal , "dante:PresetReal" )
285285 acquire = ADCpt (EpicsSignal , "dante:EraseStart" )
286286
287-
287+
288288 mca1 = ADCpt (EpicsSignal , "mca1" )
289289 mca2 = ADCpt (EpicsSignal , "mca2" )
290290 mca3 = ADCpt (EpicsSignal , "mca3" )
@@ -293,7 +293,7 @@ class BMMDante(DetectorBase):
293293 mca6 = ADCpt (EpicsSignal , "mca6" )
294294 mca7 = ADCpt (EpicsSignal , "mca7" )
295295 #mca8 = ADCpt(EpicsSignal, "mca8")
296-
296+
297297 hdf5 = Cpt (
298298 BMMDanteHDF5Plugin ,
299299 "HDF1:" ,
@@ -310,9 +310,9 @@ class BMMDante(DetectorBase):
310310 roi6 = Cpt (EpicsSignalRO , "ROIStat1:6:Total_RBV" )
311311 roi7 = Cpt (EpicsSignalRO , "ROIStat1:7:Total_RBV" )
312312 #roi8 = Cpt(EpicsSignalRO, "ROIStat1:8:Total_RBV")
313-
313+
314314 nchannels = 8
315-
315+
316316 def make_data_key (self ):
317317 source = "PV:{}" .format (self .prefix )
318318 # This shape is expected to match arr.shape for the array.
@@ -321,7 +321,7 @@ def make_data_key(self):
321321 8 ,
322322 1024 * pow (2 , self .cam .num_mca_channels .get ()),
323323 )
324-
324+
325325 data_key = dict (
326326 shape = shape ,
327327 source = source ,
@@ -344,13 +344,13 @@ def measure_xrf(self, exposure=1.0, doplot=True):
344344 #self.table()
345345 if doplot :
346346 self .plot (add = True , uid = uid )
347-
348-
349- def plot (self , uid = None , add = False , only = None ):
347+
348+
349+ def plot (self , uid = None , add = False , only = None ):
350350 '''Make a plot appropriate for the N-element detector.
351351
352352 The default is to sum the four channels.
353-
353+
354354 Parameters
355355 ----------
356356 uid : str
@@ -359,7 +359,7 @@ def plot(self, uid=None, add=False, only=None):
359359 If True, plot the sum of the four channels
360360 only : int
361361 plot only the signal from a specific channel -- (1) / (1-4) / (1-7)
362-
362+
363363 '''
364364 if uid is not None :
365365 kafka_message ({'xrf' : 'plot' , 'uid' : uid , 'add' : add , 'only' : only })
@@ -378,7 +378,7 @@ def plot(self, uid=None, add=False, only=None):
378378 e = numpy .arange (0 , len (self .mca1 .get ())) * 10
379379 plt .ion ()
380380 plt .plot (e , self .mca1 .get (), label = f'channel 1' )
381-
381+
382382 # if only is not None and only in range(1, len(list(self.iterate_channels()))+1):
383383 # channel = self.get_channel(channel_number=only)
384384 # this = channel.mca.array_data
@@ -405,12 +405,12 @@ def plot(self, uid=None, add=False, only=None):
405405 plt .legend ()
406406 #plt.show()
407407
408-
409-
408+
409+
410410from BMM .user_ns .base import profile_configuration
411411import redis
412412
413-
413+
414414class BMMDanteSingleTrigger (SingleTriggerV33 , BMMDante ):
415415 def __init__ (self , * args , ** kwargs ):
416416 super ().__init__ (* args , ** kwargs )
0 commit comments