Skip to content

Commit 21c019f

Browse files
author
BMM Operator
committed
Merge branch 'main' of github.com-NSLS2-bmm-profile-collection:NSLS2/bmm-profile-collection
2 parents c1b15ee + 686e603 commit 21c019f

File tree

12 files changed

+204
-209
lines changed

12 files changed

+204
-209
lines changed

startup/BMM/dante.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
22
from pathlib import PurePath
33
from collections import deque, OrderedDict
44
import time as ttime
@@ -34,8 +34,8 @@
3434
# | |/ /| | | || |\ | | | | |___ \ V V / / | | | | |/ /| | /\__/ / #
3535
# |___/ \_| |_/\_| \_/ \_/ \____/ \_/\_/_/ \_| |_/___/ \_| \____/ #
3636
###########################################################################
37-
38-
37+
38+
3939
#from BMM.pilatus import BMMFileStoreHDF5, BMMHDF5Plugin
4040

4141
class 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+
7676
class 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+
280280
class 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+
410410
from BMM.user_ns.base import profile_configuration
411411
import redis
412412

413-
413+
414414
class BMMDanteSingleTrigger(SingleTriggerV33, BMMDante):
415415
def __init__(self, *args, **kwargs):
416416
super().__init__(*args, **kwargs)

startup/BMM/db.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def file_resource(record):
4141
for d in docs:
4242
if d[0] == 'resource':
4343
this = os.path.join(d[1]['root'], d[1]['resource_path'])
44-
if '_%d' in this or re.search('%\d\.\dd', this) is not None:
44+
if '_%d' in this or re.search(r'%\d\.\dd', this) is not None:
4545
this = this % 0
4646
found.append(this)
4747
return(found)
@@ -51,7 +51,7 @@ def file_resource(record):
5151
for d in docs:
5252
if d[0] == 'resource':
5353
rp = d[1]['resource_path']
54-
if '_%d' in rp or re.search('%\d\.\dd', rp) is not None:
54+
if '_%d' in rp or re.search(r'%\d\.\dd', rp) is not None:
5555
this = rp % 0
5656
found.append(rp)
5757
return(found)

startup/BMM/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def find_hdf5_files(folder=None):
410410
'''Crude search through XDI files for UIDs then through Tiled for HDF5 resources
411411
'''
412412
for fl in sorted(os.listdir(folder)):
413-
if re.search('\.\d+$', fl):
413+
if re.search(r'\.\d+$', fl):
414414
text = slurp(folder, fl)
415415
a = re.search(r'uid: ([0-9a-f-]+)', text)
416416
uid = a.group(1)

0 commit comments

Comments
 (0)