From 374f9dc13c833ef62f82b8c2a4bf5eaa404764d6 Mon Sep 17 00:00:00 2001 From: slactjohnson Date: Wed, 25 Oct 2023 11:38:34 -0700 Subject: [PATCH 1/5] Update qadc.py to provide an LCLS-II compatible version of the FMC134 QADC digitizer. Restructures existing Qadc134 class without affecting backwards compatibility. --- pcdsdevices/qadc.py | 122 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 pcdsdevices/qadc.py diff --git a/pcdsdevices/qadc.py b/pcdsdevices/qadc.py new file mode 100644 index 00000000000..bae3953a22e --- /dev/null +++ b/pcdsdevices/qadc.py @@ -0,0 +1,122 @@ +from ophyd import Component as Cpt +from ophyd import Device, EpicsSignal + +from .interface import BaseInterface +from .variety import set_metadata + + +class QadcCommon(BaseInterface, Device): + """ + Common class for Abaco FMC digitizers. Used in Qadc and Qadc134. + """ + + ch0 = Cpt(EpicsSignal, ":CH0", kind="normal") + ch1 = Cpt(EpicsSignal, ":CH1", kind="normal") + ch2 = Cpt(EpicsSignal, ":CH2", kind="normal") + ch3 = Cpt(EpicsSignal, ":CH3", kind="normal") + config = Cpt(EpicsSignal, ":CONFIG", kind="config") + start = Cpt(EpicsSignal, ":START", kind="normal") + + +class QadcLcls1Timing(BaseInterface, Device): + """ + LCLS-I timing interface for FMC134 QADCs. + """ + trig_event = Cpt( + EpicsSignal, ":TRIG_EVENT_RBV", write_pv=":TRIG_EVENT", kind="config" + ) + + +class QadcLcls2Timing(BaseInterface, Device): + """ + LCLS-II timing interface for FMC134 QADCs. + """ + trig_rate_mode = Cpt(EpicsSignal, ":TRIG_RATEMODE", kind="config") + trig_fixed_rate = Cpt(EpicsSignal, ":TRIG_FIXEDRATE", kind="config") + trig_ac_rate = Cpt(EpicsSignal, ":TRIG_ACRATE", kind="config") + trig_ts_mask = Cpt(EpicsSignal, ":TRIG_TSMASK", kind="config") + trig_seq_num = Cpt(EpicsSignal, ":TRIG_SEQNUM", kind="config") + trig_seq_bit = Cpt(EpicsSignal, ":TRIG_SEQBIT", kind="config") + trig_partition = Cpt(EpicsSignal, ":TRIG_PARTITION", kind="config") + + +class Qadc134Common(QadcCommon): + """ + Common class for FMC134 digitizers. + """ + trig_delay = Cpt( + EpicsSignal, ":TRIG_DELAY_RBV", write_pv=":TRIG_DELAY", kind="config" + ) + full_en = Cpt(EpicsSignal, ":FULL_EN_RBV", write_pv=":FULL_EN", kind="config") + hi_thresh = Cpt(EpicsSignal, ":HI_THRESH_RBV", write_pv=":HI_THRESH", kind="config") + hi_thresh_raw = Cpt( + EpicsSignal, ":HI_THRESH_RAW_RBV", write_pv=":HI_THRESH_RAW", kind="config" + ) + ichan = Cpt(EpicsSignal, ":ICHAN_RBV", write_pv=":ICHAN", kind="config") + interleave = Cpt( + EpicsSignal, ":INTERLEAVE_RBV", write_pv=":INTERLEAVE", kind="config" + ) + length = Cpt(EpicsSignal, ":LENGTH_RBV", write_pv=":LENGTH", kind="config") + lo_thresh = Cpt(EpicsSignal, ":LO_THRESH_RBV", write_pv=":LO_THRESH", kind="config") + lo_thresh_raw = Cpt( + EpicsSignal, ":LO_THRESH_RAW_RBV", write_pv=":LO_THRESH_RAW", kind="config" + ) + prescale = Cpt(EpicsSignal, ":PRESCALE_RBV", write_pv=":PRESCALE", kind="config") + rows_after = Cpt( + EpicsSignal, ":ROWS_AFTER_RBV", write_pv=":ROWS_AFTER", kind="config" + ) + rows_before = Cpt( + EpicsSignal, ":ROWS_BEFORE_RBV", write_pv=":ROWS_BEFORE", kind="config" + ) + sparse_en = Cpt(EpicsSignal, ":SPARSE_EN_RBV", write_pv=":SPARSE_EN", kind="config") + clear_config = Cpt(EpicsSignal, ":CLEAR_CONFIG", kind="config") + set_metadata(clear_config, dict(variety='command-proc', value=1)) + out0 = Cpt(EpicsSignal, ":OUT0", kind="normal") + out1 = Cpt(EpicsSignal, ":OUT1", kind="normal") + rawdata0 = Cpt(EpicsSignal, ":RAWDATA0", kind="normal") + rawdata1 = Cpt(EpicsSignal, ":RAWDATA1", kind="normal") + sparse0 = Cpt(EpicsSignal, ":SPARSE0", kind="normal") + sparse1 = Cpt(EpicsSignal, ":SPARSE1", kind="normal") + + +class Qadc134(Qadc134Common, QadcLcls1Timing): + """ + Class for LCLS-I FMC134 digitizers. Implements LCLS-I timing interface. + """ + + +class Qadc134Lcls2(Qadc134Common, QadcLcls2Timing): + """ + Class for LCLS-2 FMC134 digitizers. Implements LCLS-2 timing interface. + """ + + +class Qadc(QadcCommon): + """ + Class for an older Abaco FMC PCIe digitzer, used in the LCLS-I hutches. + """ + + gain0_i = Cpt(EpicsSignal, ":GAIN0_I", kind="config") + gain0_ni = Cpt(EpicsSignal, ":GAIN0_NI", kind="config") + gain1_i = Cpt(EpicsSignal, ":GAIN1_I", kind="config") + gain1_ni = Cpt(EpicsSignal, ":GAIN1_NI", kind="config") + gain2_i = Cpt(EpicsSignal, ":GAIN2_I", kind="config") + gain2_ni = Cpt(EpicsSignal, ":GAIN2_NI", kind="config") + gain3_i = Cpt(EpicsSignal, ":GAIN3_I", kind="config") + gain3_ni = Cpt(EpicsSignal, ":GAIN3_NI", kind="config") + ichan = Cpt(EpicsSignal, ":ICHAN", kind="config") + interleave = Cpt(EpicsSignal, ":INTERLEAVE", kind="config") + length = Cpt(EpicsSignal, ":LENGTH", kind="config") + off0_i = Cpt(EpicsSignal, ":OFF0_I", kind="config") + off0_ni = Cpt(EpicsSignal, ":OFF0_NI", kind="config") + off1_i = Cpt(EpicsSignal, ":OFF1_I", kind="config") + off1_ni = Cpt(EpicsSignal, ":OFF1_NI", kind="config") + off2_i = Cpt(EpicsSignal, ":OFF2_I", kind="config") + off2_ni = Cpt(EpicsSignal, ":OFF2_NI", kind="config") + off3_i = Cpt(EpicsSignal, ":OFF3_I", kind="config") + off3_ni = Cpt(EpicsSignal, ":OFF3_NI", kind="config") + out = Cpt(EpicsSignal, ":OUT", kind="normal") + rawdata = Cpt(EpicsSignal, ":RAWDATA", kind="normal") + train = Cpt(EpicsSignal, ":TRAIN", kind="config") + trig_delay = Cpt(EpicsSignal, ":TRIG_DELAY", kind="config") + trig_event = Cpt(EpicsSignal, ":TRIG_EVENT", kind="config") From 7e4c81d030a239d24b705c8765bbcd8e3d635b63 Mon Sep 17 00:00:00 2001 From: slactjohnson Date: Wed, 25 Oct 2023 11:46:33 -0700 Subject: [PATCH 2/5] Add in pre-release notes. --- ...Add_LCLS-II_timing_support_for_Qadc134.rst | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst diff --git a/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst b/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst new file mode 100644 index 00000000000..e1f8c2a5deb --- /dev/null +++ b/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst @@ -0,0 +1,30 @@ +1155 Add LCLS-II timing support for Qadc134 +################# + +API Breaks +---------- +- N/A + +Features +-------- +- N/A + +Device Updates +-------------- +- Restructure Qadc134 + +New Devices +----------- +- Qadc134Lcls2: A class for LCLS-II timing versions of the FMC134 + +Bugfixes +-------- +- N/A + +Maintenance +----------- +- N/A + +Contributors +------------ +- tjohnson From 6bab91383911adec2eab26c8c330c71c779cbbbf Mon Sep 17 00:00:00 2001 From: slactjohnson Date: Thu, 26 Oct 2023 10:13:49 -0700 Subject: [PATCH 3/5] Update release notes. --- .../1155-Add_LCLS-II_timing_support_for_Qadc134.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst b/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst index e1f8c2a5deb..d461edb19a0 100644 --- a/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst +++ b/docs/source/upcoming_release_notes/1155-Add_LCLS-II_timing_support_for_Qadc134.rst @@ -11,7 +11,8 @@ Features Device Updates -------------- -- Restructure Qadc134 +- Restructured Qadc134 with new Qadc134Common and QadcLcls1Timing parent + classes. New Devices ----------- @@ -27,4 +28,4 @@ Maintenance Contributors ------------ -- tjohnson +- slactjohnson From 25761e7244a275caf68fb9ebb86d25ba0afc2dab Mon Sep 17 00:00:00 2001 From: slactjohnson Date: Thu, 26 Oct 2023 11:02:58 -0700 Subject: [PATCH 4/5] Add doc info to various Qadc components. --- pcdsdevices/qadc.py | 91 +++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/pcdsdevices/qadc.py b/pcdsdevices/qadc.py index bae3953a22e..34214d60e26 100644 --- a/pcdsdevices/qadc.py +++ b/pcdsdevices/qadc.py @@ -10,12 +10,14 @@ class QadcCommon(BaseInterface, Device): Common class for Abaco FMC digitizers. Used in Qadc and Qadc134. """ - ch0 = Cpt(EpicsSignal, ":CH0", kind="normal") - ch1 = Cpt(EpicsSignal, ":CH1", kind="normal") - ch2 = Cpt(EpicsSignal, ":CH2", kind="normal") - ch3 = Cpt(EpicsSignal, ":CH3", kind="normal") - config = Cpt(EpicsSignal, ":CONFIG", kind="config") - start = Cpt(EpicsSignal, ":START", kind="normal") + ch0 = Cpt(EpicsSignal, ":CH0", kind="normal", doc="Input 0 of the ADC") + ch1 = Cpt(EpicsSignal, ":CH1", kind="normal", doc="Input 1 of the ADC") + ch2 = Cpt(EpicsSignal, ":CH2", kind="normal", doc="Input 2 of the ADC") + ch3 = Cpt(EpicsSignal, ":CH3", kind="normal", doc="Input 3 of the ADC") + config = Cpt(EpicsSignal, ":CONFIG", kind="config", + doc="Write the current config to the QADC") + start = Cpt(EpicsSignal, ":START", kind="normal", + doc="Start/stop acquisition") class QadcLcls1Timing(BaseInterface, Device): @@ -23,7 +25,8 @@ class QadcLcls1Timing(BaseInterface, Device): LCLS-I timing interface for FMC134 QADCs. """ trig_event = Cpt( - EpicsSignal, ":TRIG_EVENT_RBV", write_pv=":TRIG_EVENT", kind="config" + EpicsSignal, ":TRIG_EVENT_RBV", write_pv=":TRIG_EVENT", kind="config", + doc="LCLS-I event code to trigger on" ) @@ -31,13 +34,20 @@ class QadcLcls2Timing(BaseInterface, Device): """ LCLS-II timing interface for FMC134 QADCs. """ - trig_rate_mode = Cpt(EpicsSignal, ":TRIG_RATEMODE", kind="config") - trig_fixed_rate = Cpt(EpicsSignal, ":TRIG_FIXEDRATE", kind="config") - trig_ac_rate = Cpt(EpicsSignal, ":TRIG_ACRATE", kind="config") - trig_ts_mask = Cpt(EpicsSignal, ":TRIG_TSMASK", kind="config") - trig_seq_num = Cpt(EpicsSignal, ":TRIG_SEQNUM", kind="config") - trig_seq_bit = Cpt(EpicsSignal, ":TRIG_SEQBIT", kind="config") - trig_partition = Cpt(EpicsSignal, ":TRIG_PARTITION", kind="config") + trig_rate_mode = Cpt(EpicsSignal, ":TRIG_RATEMODE", kind="config", + doc="LCLS-II trigger mode") + trig_fixed_rate = Cpt(EpicsSignal, ":TRIG_FIXEDRATE", kind="config", + doc="Rate to use for fixed trigger mode") + trig_ac_rate = Cpt(EpicsSignal, ":TRIG_ACRATE", kind="config", + doc="Rate to use for AC trigger mode") + trig_ts_mask = Cpt(EpicsSignal, ":TRIG_TSMASK", kind="config", + doc="Trigger mask") + trig_seq_num = Cpt(EpicsSignal, ":TRIG_SEQNUM", kind="config", + doc="Trigger sequence number") + trig_seq_bit = Cpt(EpicsSignal, ":TRIG_SEQBIT", kind="config", + doc="Trigger sequence bit") + trig_partition = Cpt(EpicsSignal, ":TRIG_PARTITION", kind="config", + doc="Trigger partition number") class Qadc134Common(QadcCommon): @@ -45,38 +55,53 @@ class Qadc134Common(QadcCommon): Common class for FMC134 digitizers. """ trig_delay = Cpt( - EpicsSignal, ":TRIG_DELAY_RBV", write_pv=":TRIG_DELAY", kind="config" + EpicsSignal, ":TRIG_DELAY_RBV", write_pv=":TRIG_DELAY", kind="config", + doc="Trigger delay in EVR/TPR ticks" ) - full_en = Cpt(EpicsSignal, ":FULL_EN_RBV", write_pv=":FULL_EN", kind="config") - hi_thresh = Cpt(EpicsSignal, ":HI_THRESH_RBV", write_pv=":HI_THRESH", kind="config") + full_en = Cpt(EpicsSignal, ":FULL_EN_RBV", write_pv=":FULL_EN", kind="config", + doc="Enable full stream") + hi_thresh = Cpt(EpicsSignal, ":HI_THRESH_RBV", write_pv=":HI_THRESH", kind="config", + doc="High threshold, in Volts") hi_thresh_raw = Cpt( - EpicsSignal, ":HI_THRESH_RAW_RBV", write_pv=":HI_THRESH_RAW", kind="config" + EpicsSignal, ":HI_THRESH_RAW_RBV", write_pv=":HI_THRESH_RAW", kind="config", + doc="High threshold, raw" ) - ichan = Cpt(EpicsSignal, ":ICHAN_RBV", write_pv=":ICHAN", kind="config") + ichan = Cpt(EpicsSignal, ":ICHAN_RBV", write_pv=":ICHAN", kind="config", + doc="Channel to interleave on") interleave = Cpt( - EpicsSignal, ":INTERLEAVE_RBV", write_pv=":INTERLEAVE", kind="config" + EpicsSignal, ":INTERLEAVE_RBV", write_pv=":INTERLEAVE", kind="config", + doc="Interleave enabled?" ) - length = Cpt(EpicsSignal, ":LENGTH_RBV", write_pv=":LENGTH", kind="config") - lo_thresh = Cpt(EpicsSignal, ":LO_THRESH_RBV", write_pv=":LO_THRESH", kind="config") + length = Cpt(EpicsSignal, ":LENGTH_RBV", write_pv=":LENGTH", kind="config", + doc="Waveform length") + lo_thresh = Cpt(EpicsSignal, ":LO_THRESH_RBV", write_pv=":LO_THRESH", + kind="config", doc="Low threshold, in Volts") lo_thresh_raw = Cpt( - EpicsSignal, ":LO_THRESH_RAW_RBV", write_pv=":LO_THRESH_RAW", kind="config" - ) - prescale = Cpt(EpicsSignal, ":PRESCALE_RBV", write_pv=":PRESCALE", kind="config") + EpicsSignal, ":LO_THRESH_RAW_RBV", write_pv=":LO_THRESH_RAW", + kind="config", doc="Low threshold, raw") + prescale = Cpt(EpicsSignal, ":PRESCALE_RBV", write_pv=":PRESCALE", + kind="config", doc="Trigger prescale divider") rows_after = Cpt( EpicsSignal, ":ROWS_AFTER_RBV", write_pv=":ROWS_AFTER", kind="config" ) rows_before = Cpt( EpicsSignal, ":ROWS_BEFORE_RBV", write_pv=":ROWS_BEFORE", kind="config" ) - sparse_en = Cpt(EpicsSignal, ":SPARSE_EN_RBV", write_pv=":SPARSE_EN", kind="config") - clear_config = Cpt(EpicsSignal, ":CLEAR_CONFIG", kind="config") + sparse_en = Cpt(EpicsSignal, ":SPARSE_EN_RBV", write_pv=":SPARSE_EN", + kind="config", doc="Enable sparsified mode") + clear_config = Cpt(EpicsSignal, ":CLEAR_CONFIG", kind="config", + doc="Clear the current configuration") set_metadata(clear_config, dict(variety='command-proc', value=1)) - out0 = Cpt(EpicsSignal, ":OUT0", kind="normal") - out1 = Cpt(EpicsSignal, ":OUT1", kind="normal") - rawdata0 = Cpt(EpicsSignal, ":RAWDATA0", kind="normal") - rawdata1 = Cpt(EpicsSignal, ":RAWDATA1", kind="normal") - sparse0 = Cpt(EpicsSignal, ":SPARSE0", kind="normal") - sparse1 = Cpt(EpicsSignal, ":SPARSE1", kind="normal") + out0 = Cpt(EpicsSignal, ":OUT0", kind="normal", doc="Full output zero") + out1 = Cpt(EpicsSignal, ":OUT1", kind="normal", doc="Full output one") + rawdata0 = Cpt(EpicsSignal, ":RAWDATA0", kind="normal", + doc="Raw output zero") + rawdata1 = Cpt(EpicsSignal, ":RAWDATA1", kind="normal", + doc="Raw output one") + sparse0 = Cpt(EpicsSignal, ":SPARSE0", kind="normal", + doc="Sparsified output zero") + sparse1 = Cpt(EpicsSignal, ":SPARSE1", kind="normal", + doc="Sparsified output one") class Qadc134(Qadc134Common, QadcLcls1Timing): From c96ac5912e51f4c9ab41f89ac806887d171811dd Mon Sep 17 00:00:00 2001 From: slactjohnson Date: Fri, 27 Oct 2023 11:44:14 -0700 Subject: [PATCH 5/5] Add command-proc to config PV. --- pcdsdevices/qadc.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pcdsdevices/qadc.py b/pcdsdevices/qadc.py index 34214d60e26..60860ef3cf5 100644 --- a/pcdsdevices/qadc.py +++ b/pcdsdevices/qadc.py @@ -16,6 +16,7 @@ class QadcCommon(BaseInterface, Device): ch3 = Cpt(EpicsSignal, ":CH3", kind="normal", doc="Input 3 of the ADC") config = Cpt(EpicsSignal, ":CONFIG", kind="config", doc="Write the current config to the QADC") + set_metadata(config, dict(variety='command-proc', value=1)) start = Cpt(EpicsSignal, ":START", kind="normal", doc="Start/stop acquisition")