Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modifications for using NDTimeSeriesPlugin #22

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions startup/31-xspress3.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,21 @@ def __call__(self, **kwargs):
return np.asarray(f[self.XRF_DATA_KEY])


class ADTimeSeriesPlugin(Device):
acquire = Cpt(EpicsSignal, ":TSAcquire")
_read = Cpt(EpicsSignal, ":TSRead")
num_points = Cpt(EpicsSignal, ":TSNumPoints")
current_point = Cpt(EpicsSignal, ":TSCurrentPoint")
acquire_mode = Cpt(EpicsSignal, ":TSAcquireMode")
time_per_point = Cpt(EpicsSignal, ":TSTimePerPoint")
averaging_time = Cpt(EpicsSignal, ":TSAveragingTime")
num_average = Cpt(EpicsSignal, ":TSNumAverage")
elapsed_time = Cpt(EpicsSignal, ":TSElapsedTime")
time_axis = Cpt(EpicsSignal, ":TSTimeAxis")
time_stamp = Cpt(EpicsSignal, ":TSTimeStamp")
time_series_1 = Cpt(EpicsSignal, ":1:TimeSeries")


class SrxXspress3Detector(SRXXspressTrigger, Xspress3Detector):
# TODO: garth, the ioc is missing some PVs?
# det_settings.erase_array_counters
Expand All @@ -174,6 +189,11 @@ class SrxXspress3Detector(SRXXspressTrigger, Xspress3Detector):

array_counter = Cpt(EpicsSignal, "ArrayCounter_RBV")

# experimental NDPluginTimeSeries
# mca1_roi_time_series_plugin_control = Cpt(EpicsSignal, ":MCA1ROI:TSControl")
# mca1_roi_time_series_plugin = Cpt(ADTimeSeriesPlugin, ":MCA1ROI:TS", name="time_series_plugin")


# Currently only using three channels. Uncomment these to enable more
channel1 = Cpt(Xspress3Channel, "C1_", channel_num=1, read_attrs=["rois"])
channel2 = Cpt(Xspress3Channel, "C2_", channel_num=2, read_attrs=["rois"])
Expand All @@ -185,11 +205,11 @@ class SrxXspress3Detector(SRXXspressTrigger, Xspress3Detector):
# channel7 = Cpt(Xspress3Channel, 'C7_', channel_num=7)
# channel8 = Cpt(Xspress3Channel, 'C8_', channel_num=8)

create_dir = Cpt(EpicsSignal, "HDF5:FileCreateDir")
create_dir = Cpt(EpicsSignal, "HDF1:FileCreateDir")

hdf5 = Cpt(
Xspress3FileStoreFlyable,
"HDF5:",
"HDF1:",
read_path_template="/nsls2/xf05id1/XF05ID1/XSPRESS3/%Y/%m/%d/",
write_path_template='/epics/data/%Y/%m/%d/',
# write_path_template="/home/xspress3/data/%Y/%m/%d/",#TES xspress3
Expand Down Expand Up @@ -315,6 +335,7 @@ def unstage(self):
print(ex, end="\n\n")



# Working xs2 detector
class SrxXspress3Detector2(SRXXspressTrigger, Xspress3Detector):
# TODO: garth, the ioc is missing some PVs?
Expand Down
7 changes: 7 additions & 0 deletions startup/62-flyscans.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ def scan_and_fly_base(detectors, xstart, xstop, xnum, ystart, ystop, ynum, dwell
dets_by_name = {d.name : d
for d in detectors}

# set up the time_series_plugin
time_series_plugin = ADTimeSeriesPlugin("XF:05IDD-ES{Xsp:3}:det1:MCA1ROI:TS", name="mca1roi_time_series")
# set TSAcquire to 1 for "Acquire"
# need to stop at unstage time?
yield from mv(time_series_plugin.acquire, 1)

# set up the merlin
if 'merlin' in dets_by_name:
dpc = dets_by_name['merlin']
Expand Down Expand Up @@ -387,6 +393,7 @@ def finalize_scan(name, doc):
# monitor values from xs
# @monitor_during_decorator([xs.channel1.rois.roi01.value])
@monitor_during_decorator([xs.channel1.rois.roi01.value, xs.array_counter])
@monitor_during_decorator([time_series_plugin.time_series])
@stage_decorator([flying_zebra]) # Below, 'scan' stage ymotor.
@run_decorator(md=md)
def plan():
Expand Down
18 changes: 9 additions & 9 deletions startup/90-usersetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
# PI_lastname = None
# saf_num = None

#proposal_num = 307426
#proposal_title = 'SRX Beamline Commissioning'
#PI_lastname = 'Kiss'
#saf_num = 305921

proposal_num = 306378
proposal_title = 'Investigating the charge distribution of Ni-ricj LiNi1-x-yCosMnyO2 cathode in high-energy resources'
PI_lastname = 'Zuli'
saf_num = 306149
proposal_num = 307426
proposal_title = 'SRX Beamline Commissioning'
PI_lastname = 'Kiss'
saf_num = 305921

# proposal_num = 306378
# proposal_title = 'Investigating the charge distribution of Ni-ricj LiNi1-x-yCosMnyO2 cathode in high-energy resources'
# PI_lastname = 'Zuli'
# saf_num = 306149


cycle = '2020_cycle2'
Expand Down