From 1e64df9d0929358fe17a4e2a17f64e731dbdccd3 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Wed, 20 Mar 2024 23:30:14 -0500 Subject: [PATCH 01/11] Update dfmux HousekeepingConsumer for v4 firmware New "isv4" boolean determines whether the appropriate entries are populated. Maintain backwards compatibility with 3G firmware throughout. --- dfmux/include/dfmux/Housekeeping.h | 19 +++++++++++++++---- dfmux/python/Housekeeping.py | 21 +++++++++++++++++---- dfmux/src/Housekeeping.cxx | 24 ++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/dfmux/include/dfmux/Housekeeping.h b/dfmux/include/dfmux/Housekeeping.h index 1270224f..ddc30949 100644 --- a/dfmux/include/dfmux/Housekeeping.h +++ b/dfmux/include/dfmux/Housekeeping.h @@ -25,7 +25,9 @@ class HkChannelInfo : public G3FrameObject HkChannelInfo() : G3FrameObject(), channel_number(-1), carrier_amplitude(NAN), carrier_frequency(NAN), dan_accumulator_enable(false), dan_feedback_enable(false), dan_streaming_enable(false), dan_gain(NAN), demod_frequency(NAN), nuller_amplitude(NAN), - dan_railed(false), rlatched(NAN), rnormal(NAN), rfrac_achieved(NAN), loopgain(NAN) {} + dan_railed(false), rlatched(NAN), rnormal(NAN), rfrac_achieved(NAN), loopgain(NAN), + carrier_phase(NAN), nuller_phase(NAN), demod_phase(NAN), dan_zero_enable(false), + dan_zeroed(false) {} int32_t channel_number; // 1-indexed double carrier_amplitude; @@ -45,12 +47,20 @@ class HkChannelInfo : public G3FrameObject double rfrac_achieved; double loopgain; + // hidfmux properties + double carrier_phase; + double nuller_phase; + double demod_phase; + + bool dan_zero_enable; + bool dan_zeroed; + template void serialize(A &ar, unsigned v); std::string Description() const; }; G3_POINTERS(HkChannelInfo); -G3_SERIALIZABLE(HkChannelInfo, 5); +G3_SERIALIZABLE(HkChannelInfo, 6); class HkModuleInfo : public G3FrameObject { @@ -124,7 +134,7 @@ G3_SERIALIZABLE(HkMezzanineInfo, 2); class HkBoardInfo : public G3FrameObject { public: - HkBoardInfo() : G3FrameObject(), fir_stage(-1), is128x(false) {} + HkBoardInfo() : G3FrameObject(), fir_stage(-1), is128x(false), isv4(false) {} G3Time timestamp; @@ -132,6 +142,7 @@ class HkBoardInfo : public G3FrameObject std::string serial; int32_t fir_stage; bool is128x; + bool isv4; std::map currents; std::map voltages; @@ -144,7 +155,7 @@ class HkBoardInfo : public G3FrameObject }; G3_POINTERS(HkBoardInfo); -G3_SERIALIZABLE(HkBoardInfo, 2); +G3_SERIALIZABLE(HkBoardInfo, 3); G3MAP_OF(int32_t, HkBoardInfo, DfMuxHousekeepingMap); diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index ef57d35a..5d599eb5 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -1,7 +1,6 @@ from spt3g import core from spt3g.dfmux import DfMuxHousekeepingMap, HkBoardInfo, HkMezzanineInfo, HkModuleInfo, HkChannelInfo, DfMuxWiringMap, DfMuxChannelMapping -from spt3g.dfmux.IceboardConversions import convert_TF from .TuberClient import TuberClient import socket, struct, time import numpy @@ -198,6 +197,10 @@ def HousekeepingFromJSON(cls, dat): boardhk.is128x = dat['is128x'] else: boardhk.is128x = False + if 'isv4' in dat: + boardhk.isv4 = dat['isv4'] + else: + boardhk.isv4 = False year = dat['timestamp']['y'] if year == 0: # It probably isn't 1900 @@ -237,7 +240,8 @@ def HousekeepingFromJSON(cls, dat): mezzhk.voltages[str(i[0])] = i[1] if mezzhk.present and mezzhk.power: - mezzhk.temperature = mezz['temperature'] + # this is not present in v4 firmware + mezzhk.temperature = mezz.get('temperature', 0.0) # these parameters are not in the 64x housekeeping tuber mezzhk.squid_heater = mezz.get('squid_heater', 0.0) mezzhk.squid_controller_power = mezz.get('squid_controller_power', False) @@ -275,7 +279,15 @@ def HousekeepingFromJSON(cls, dat): chanhk.nuller_amplitude = chan['nuller_amplitude'] chanhk.dan_gain = chan['dan_gain'] chanhk.dan_streaming_enable = chan['dan_streaming_enable'] - if boardhk.is128x: + if boardhk.isv4: + chanhk.carrier_frequency = chan['frequency'] * core.G3Units.Hz + chanhk.demod_frequency = chan['frequency'] * core.G3Units.Hz + chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.rad + chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.rad + chanhk.demod_phase = chan['demod_phase'] * core.G3Units.rad + chanhk.dan_zero_enable = chan['dan_zero_enable'] + chanhk.dan_zeroed = chan['dan_zeroed'] + elif boardhk.is128x: chanhk.carrier_frequency = chan['frequency']*core.G3Units.Hz chanhk.demod_frequency = chan['frequency']*core.G3Units.Hz else: @@ -317,6 +329,7 @@ def WiringFromJSON(cls, dat, ip, crate, slot): serial = int(dat['serial']) for imezz, mezz in enumerate(dat['mezzanines']): for imod, mod in enumerate(mezz['modules']): + module = imod + len(mezz['modules']) * imezz for ichan, chan in enumerate(mod['channels']): name = (chan.get('tuning', {}) or {}).get('name', None) if not name: @@ -326,7 +339,7 @@ def WiringFromJSON(cls, dat, ip, crate, slot): mapping.board_serial = serial mapping.board_slot = slot mapping.crate_serial = crate - mapping.module = imod + 4 * imezz + mapping.module = module mapping.channel = ichan try: name = str(name) diff --git a/dfmux/src/Housekeeping.cxx b/dfmux/src/Housekeeping.cxx index 06229c02..937216a2 100644 --- a/dfmux/src/Housekeeping.cxx +++ b/dfmux/src/Housekeeping.cxx @@ -48,6 +48,14 @@ template void HkChannelInfo::serialize(A &ar, unsigned v) if (v > 4) { ar & make_nvp("loopgain", loopgain); } + + if (v > 5) { + ar & make_nvp("carrier_phase", carrier_phase); + ar & make_nvp("nuller_phase", nuller_phase); + ar & make_nvp("demod_phase", demod_phase); + ar & make_nvp("dan_zero_enable", dan_zero_enable); + ar & make_nvp("dan_zeroed", dan_zeroed); + } } std::string HkModuleInfo::Description() const @@ -146,6 +154,10 @@ template void HkBoardInfo::serialize(A &ar, unsigned v) if (v >= 2) { ar & make_nvp("is128x", is128x); } + + if (v >= 3) { + ar & make_nvp("isv4", isv4); + } } G3_SERIALIZABLE_CODE(HkChannelInfo); @@ -197,6 +209,16 @@ PYBINDINGS("dfmux") { .def_readwrite("loopgain", &HkChannelInfo::loopgain, "Measured loopgain of the detector as stored by the " "control software tuning script.") + .def_readwrite("carrier_phase", &HkChannelInfo::carrier_phase, + "Carrier phase in standard angle units (v4 only)") + .def_readwrite("nuller_phase", &HkChannelInfo::nuller_phase, + "Nuller phase in standard angle units (v4 only)") + .def_readwrite("demod_phase", &HkChannelInfo::demod_phase, + "Demodulator phase in standard angle units (v4 only)") + .def_readwrite("dan_zero_enable", &HkChannelInfo::dan_zero_enable, + "True if the DAN zero enable functionality is turned on (v4 only)") + .def_readwrite("dan_zeroed", &HkChannelInfo::dan_zeroed, + "True if the DAN channel is zeroed (v4 only)") ; register_map >("HkChannelInfoMap", "Mapping of channel number (1-indexed) to channel status " @@ -288,6 +310,8 @@ PYBINDINGS("dfmux") { "faster and grow by factors of two with each decrement") .def_readwrite("is128x", &HkBoardInfo::is128x, "Boolean for whether 128x firmware is running") + .def_readwrite("isv4", &HkBoardInfo::isv4, + "Boolean for whether v4 firmware is running") .def_readwrite("currents", &HkBoardInfo::currents, "Dictionary of data from on-board current sensors") .def_readwrite("voltages", &HkBoardInfo::voltages, From cb3827c36a3ca84fbc744eb67201588fcb6cd980 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Wed, 20 Mar 2024 23:49:51 -0500 Subject: [PATCH 02/11] update ReadoutSystem for hidfmux firmware --- dfmux/python/Housekeeping.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index 5d599eb5..885cb56c 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -126,10 +126,12 @@ def ProcessBuffered(self, frame): # avoid overloading the network on the return found = False + isv4 = False for board in self.board_serials: dat = self.tuber[board].GetReply()[0]['result'] boardhk = self.HousekeepingFromJSON(dat) + isv4 = isv4 or boardhk.isv4 hkdata[int(boardhk.serial)] = boardhk ip, crate, slot = self.board_map[board] @@ -149,7 +151,7 @@ def ProcessBuffered(self, frame): hwmf = core.G3Frame(core.G3FrameType.Wiring) hwmf['WiringMap'] = hwm - hwmf['ReadoutSystem'] = 'ICE' + hwmf['ReadoutSystem'] = 'ICE4' if isv4 else 'ICE' if self.hwmf is None: self.hwmf = hwmf From f5437174b1131d4bb9dc02a3631a5530b62adf03 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Sun, 24 Mar 2024 15:36:14 -0500 Subject: [PATCH 03/11] add demod_amplitude --- dfmux/include/dfmux/Housekeeping.h | 6 ++++-- dfmux/python/Housekeeping.py | 20 +++++++++----------- dfmux/src/Housekeeping.cxx | 3 +++ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/dfmux/include/dfmux/Housekeeping.h b/dfmux/include/dfmux/Housekeeping.h index ddc30949..48586a87 100644 --- a/dfmux/include/dfmux/Housekeeping.h +++ b/dfmux/include/dfmux/Housekeeping.h @@ -26,8 +26,8 @@ class HkChannelInfo : public G3FrameObject carrier_frequency(NAN), dan_accumulator_enable(false), dan_feedback_enable(false), dan_streaming_enable(false), dan_gain(NAN), demod_frequency(NAN), nuller_amplitude(NAN), dan_railed(false), rlatched(NAN), rnormal(NAN), rfrac_achieved(NAN), loopgain(NAN), - carrier_phase(NAN), nuller_phase(NAN), demod_phase(NAN), dan_zero_enable(false), - dan_zeroed(false) {} + demod_amplitude(NAN), carrier_phase(NAN), nuller_phase(NAN), demod_phase(NAN), + dan_zero_enable(false), dan_zeroed(false) {} int32_t channel_number; // 1-indexed double carrier_amplitude; @@ -48,6 +48,8 @@ class HkChannelInfo : public G3FrameObject double loopgain; // hidfmux properties + double demod_amplitude; + double carrier_phase; double nuller_phase; double demod_phase; diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index 885cb56c..3367ccab 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -242,8 +242,7 @@ def HousekeepingFromJSON(cls, dat): mezzhk.voltages[str(i[0])] = i[1] if mezzhk.present and mezzhk.power: - # this is not present in v4 firmware - mezzhk.temperature = mezz.get('temperature', 0.0) + mezzhk.temperature = mezz['temperature'] # these parameters are not in the 64x housekeeping tuber mezzhk.squid_heater = mezz.get('squid_heater', 0.0) mezzhk.squid_controller_power = mezz.get('squid_controller_power', False) @@ -281,17 +280,16 @@ def HousekeepingFromJSON(cls, dat): chanhk.nuller_amplitude = chan['nuller_amplitude'] chanhk.dan_gain = chan['dan_gain'] chanhk.dan_streaming_enable = chan['dan_streaming_enable'] - if boardhk.isv4: - chanhk.carrier_frequency = chan['frequency'] * core.G3Units.Hz - chanhk.demod_frequency = chan['frequency'] * core.G3Units.Hz - chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.rad - chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.rad - chanhk.demod_phase = chan['demod_phase'] * core.G3Units.rad - chanhk.dan_zero_enable = chan['dan_zero_enable'] - chanhk.dan_zeroed = chan['dan_zeroed'] - elif boardhk.is128x: + if boardhk.is128x or boardhk.isv4: chanhk.carrier_frequency = chan['frequency']*core.G3Units.Hz chanhk.demod_frequency = chan['frequency']*core.G3Units.Hz + if boardhk.isv4: + chanhk.demod_amplitude = chan['demod_amplitude'] + chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.rad + chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.rad + chanhk.demod_phase = chan['demod_phase'] * core.G3Units.rad + chanhk.dan_zero_enable = chan['dan_zero_enable'] + chanhk.dan_zeroed = chan['dan_zeroed'] else: chanhk.carrier_frequency = chan['carrier_frequency']*core.G3Units.Hz chanhk.demod_frequency = chan['demod_frequency']*core.G3Units.Hz diff --git a/dfmux/src/Housekeeping.cxx b/dfmux/src/Housekeeping.cxx index 937216a2..312967ac 100644 --- a/dfmux/src/Housekeeping.cxx +++ b/dfmux/src/Housekeeping.cxx @@ -50,6 +50,7 @@ template void HkChannelInfo::serialize(A &ar, unsigned v) } if (v > 5) { + ar & make_nvp("demod_amplitude", demod_amplitude); ar & make_nvp("carrier_phase", carrier_phase); ar & make_nvp("nuller_phase", nuller_phase); ar & make_nvp("demod_phase", demod_phase); @@ -209,6 +210,8 @@ PYBINDINGS("dfmux") { .def_readwrite("loopgain", &HkChannelInfo::loopgain, "Measured loopgain of the detector as stored by the " "control software tuning script.") + .def_readwrite("demod_amplitude", &HkChannelInfo::demod_amplitude, + "Demodulator amplitude in normalized units (0-1) (v4 only)") .def_readwrite("carrier_phase", &HkChannelInfo::carrier_phase, "Carrier phase in standard angle units (v4 only)") .def_readwrite("nuller_phase", &HkChannelInfo::nuller_phase, From de800f72b9d5bbdc2d5dd9a616dc649aa625cbcd Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Sun, 24 Mar 2024 16:41:31 -0500 Subject: [PATCH 04/11] add attributes from icecore-mkids nuber branch --- dfmux/include/dfmux/Housekeeping.h | 12 ++++++++---- dfmux/python/Housekeeping.py | 19 ++++++++++--------- dfmux/src/Housekeeping.cxx | 28 +++++++++++++++++++--------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/dfmux/include/dfmux/Housekeeping.h b/dfmux/include/dfmux/Housekeeping.h index 48586a87..9acd1b24 100644 --- a/dfmux/include/dfmux/Housekeeping.h +++ b/dfmux/include/dfmux/Housekeeping.h @@ -70,7 +70,8 @@ class HkModuleInfo : public G3FrameObject HkModuleInfo() : G3FrameObject(), module_number(-1), carrier_gain(-1), nuller_gain(-1), demod_gain(-1), carrier_railed(false), nuller_railed(false), demod_railed(false), squid_flux_bias(NAN), squid_current_bias(NAN), - squid_stage1_offset(NAN), squid_p2p(NAN), squid_transimpedance(NAN) {} + squid_stage1_offset(NAN), squid_p2p(NAN), squid_transimpedance(NAN), + nco_frequency (NAN) {} int32_t module_number; // 1-indexed @@ -93,6 +94,8 @@ class HkModuleInfo : public G3FrameObject std::string squid_feedback; std::string routing_type; + double nco_frequency; + std::map channels; // 1-indexed template void serialize(A &ar, unsigned v); @@ -100,7 +103,7 @@ class HkModuleInfo : public G3FrameObject }; G3_POINTERS(HkModuleInfo); -G3_SERIALIZABLE(HkModuleInfo, 2); +G3_SERIALIZABLE(HkModuleInfo, 3); class HkMezzanineInfo : public G3FrameObject { @@ -136,15 +139,16 @@ G3_SERIALIZABLE(HkMezzanineInfo, 2); class HkBoardInfo : public G3FrameObject { public: - HkBoardInfo() : G3FrameObject(), fir_stage(-1), is128x(false), isv4(false) {} + HkBoardInfo() : G3FrameObject(), fir_stage(-1), is128x(false) {} G3Time timestamp; std::string timestamp_port; std::string serial; + std::string firmware_version; + std::string firmware_name; int32_t fir_stage; bool is128x; - bool isv4; std::map currents; std::map voltages; diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index 3367ccab..e6beb238 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -126,12 +126,12 @@ def ProcessBuffered(self, frame): # avoid overloading the network on the return found = False - isv4 = False + ismkid = False for board in self.board_serials: dat = self.tuber[board].GetReply()[0]['result'] boardhk = self.HousekeepingFromJSON(dat) - isv4 = isv4 or boardhk.isv4 + ismkid = ismkid or "mkid" in boardhk.firmware_name.lower() hkdata[int(boardhk.serial)] = boardhk ip, crate, slot = self.board_map[board] @@ -151,7 +151,7 @@ def ProcessBuffered(self, frame): hwmf = core.G3Frame(core.G3FrameType.Wiring) hwmf['WiringMap'] = hwm - hwmf['ReadoutSystem'] = 'ICE4' if isv4 else 'ICE' + hwmf['ReadoutSystem'] = 'ICE-MKID' if ismkid else 'ICE' if self.hwmf is None: self.hwmf = hwmf @@ -199,10 +199,6 @@ def HousekeepingFromJSON(cls, dat): boardhk.is128x = dat['is128x'] else: boardhk.is128x = False - if 'isv4' in dat: - boardhk.isv4 = dat['isv4'] - else: - boardhk.isv4 = False year = dat['timestamp']['y'] if year == 0: # It probably isn't 1900 @@ -219,6 +215,9 @@ def HousekeepingFromJSON(cls, dat): boardhk.timestamp_port = str(dat['timestamp_port']) boardhk.serial = str(dat['serial']) + boardhk.firmware_name = str(dat.get('firmware_name', '')) + ismkid = 'mkid' in board.firmware_name.lower() + boardhk.firmware_version = str(dat.get('firmware_version', '')) boardhk.fir_stage = dat['fir_stage'] for i in dat['currents'].items(): boardhk.currents[str(i[0])] = i[1] @@ -267,6 +266,8 @@ def HousekeepingFromJSON(cls, dat): modhk.squid_current_bias = mod['squid_flux_bias'] if 'squid_feedback' in mod: modhk.squid_feedback = str(mod['squid_feedback']) + if 'nco_frequency' in mod: + modhk.nco_frequency = mod['nco_frequency'] * core.G3Units.Hz if 'squid_tuning' in mod and mod['squid_tuning'] is not None: modhk.squid_state = str(mod['squid_tuning']['state']) @@ -280,10 +281,10 @@ def HousekeepingFromJSON(cls, dat): chanhk.nuller_amplitude = chan['nuller_amplitude'] chanhk.dan_gain = chan['dan_gain'] chanhk.dan_streaming_enable = chan['dan_streaming_enable'] - if boardhk.is128x or boardhk.isv4: + if boardhk.is128x or ismkid: chanhk.carrier_frequency = chan['frequency']*core.G3Units.Hz chanhk.demod_frequency = chan['frequency']*core.G3Units.Hz - if boardhk.isv4: + if ismkid: chanhk.demod_amplitude = chan['demod_amplitude'] chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.rad chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.rad diff --git a/dfmux/src/Housekeeping.cxx b/dfmux/src/Housekeeping.cxx index 312967ac..8961f5c3 100644 --- a/dfmux/src/Housekeeping.cxx +++ b/dfmux/src/Housekeeping.cxx @@ -92,6 +92,10 @@ template void HkModuleInfo::serialize(A &ar, unsigned v) ar & make_nvp("squid_p2p", squid_p2p); ar & make_nvp("squid_transimpedance", squid_transimpedance); } + + if (v >= 3) { + ar & make_nvp("nco_frequency", nco_frequency); + } } std::string HkMezzanineInfo::Description() const @@ -157,7 +161,8 @@ template void HkBoardInfo::serialize(A &ar, unsigned v) } if (v >= 3) { - ar & make_nvp("isv4", isv4); + ar & make_nvp("firmware_version", firmware_version); + ar & make_nvp("firmware_name", firmware_name); } } @@ -211,17 +216,17 @@ PYBINDINGS("dfmux") { "Measured loopgain of the detector as stored by the " "control software tuning script.") .def_readwrite("demod_amplitude", &HkChannelInfo::demod_amplitude, - "Demodulator amplitude in normalized units (0-1) (v4 only)") + "Demodulator amplitude in normalized units (0-1) (mkid only)") .def_readwrite("carrier_phase", &HkChannelInfo::carrier_phase, - "Carrier phase in standard angle units (v4 only)") + "Carrier phase in standard angle units (mkid only)") .def_readwrite("nuller_phase", &HkChannelInfo::nuller_phase, - "Nuller phase in standard angle units (v4 only)") + "Nuller phase in standard angle units (mkid only)") .def_readwrite("demod_phase", &HkChannelInfo::demod_phase, - "Demodulator phase in standard angle units (v4 only)") + "Demodulator phase in standard angle units (mkid only)") .def_readwrite("dan_zero_enable", &HkChannelInfo::dan_zero_enable, - "True if the DAN zero enable functionality is turned on (v4 only)") + "True if the DAN zero enable functionality is turned on (mkid only)") .def_readwrite("dan_zeroed", &HkChannelInfo::dan_zeroed, - "True if the DAN channel is zeroed (v4 only)") + "True if the DAN channel is zeroed (mkid only)") ; register_map >("HkChannelInfoMap", "Mapping of channel number (1-indexed) to channel status " @@ -258,6 +263,9 @@ PYBINDINGS("dfmux") { "tuning script to describe SQUID state") .def_readwrite("squid_feedback", &HkModuleInfo::squid_feedback, "SQUID feedback mechanism employed") + .def_readwrite("nco_frequency", + &HkModuleInfo::nco_frequency, + "NCO frequency in standard frequency units (mkid only)") .def_readwrite("routing_type", &HkModuleInfo::routing_type, "Whether DAC are routed directly to ADCs or to the cryostat") .def_readwrite("channels", &HkModuleInfo::channels, @@ -313,8 +321,10 @@ PYBINDINGS("dfmux") { "faster and grow by factors of two with each decrement") .def_readwrite("is128x", &HkBoardInfo::is128x, "Boolean for whether 128x firmware is running") - .def_readwrite("isv4", &HkBoardInfo::isv4, - "Boolean for whether v4 firmware is running") + .def_readwrite("firmware_version", &HkBoardInfo::firmware_version, + "Firmware version") + .def_readwrite("firmware_name", &HkBoardInfo::firmware_name, + "Firmware name") .def_readwrite("currents", &HkBoardInfo::currents, "Dictionary of data from on-board current sensors") .def_readwrite("voltages", &HkBoardInfo::voltages, From f990f6a396311647647d104186588980ea1c1204 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Sun, 24 Mar 2024 16:42:10 -0500 Subject: [PATCH 05/11] space --- dfmux/include/dfmux/Housekeeping.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dfmux/include/dfmux/Housekeeping.h b/dfmux/include/dfmux/Housekeeping.h index 9acd1b24..116e56e2 100644 --- a/dfmux/include/dfmux/Housekeeping.h +++ b/dfmux/include/dfmux/Housekeeping.h @@ -71,7 +71,7 @@ class HkModuleInfo : public G3FrameObject nuller_gain(-1), demod_gain(-1), carrier_railed(false), nuller_railed(false), demod_railed(false), squid_flux_bias(NAN), squid_current_bias(NAN), squid_stage1_offset(NAN), squid_p2p(NAN), squid_transimpedance(NAN), - nco_frequency (NAN) {} + nco_frequency(NAN) {} int32_t module_number; // 1-indexed From b329db7cb6a772c2222d2dda05c2780b5e41d930 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Mon, 25 Mar 2024 23:20:12 -0500 Subject: [PATCH 06/11] format --- dfmux/src/Housekeeping.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dfmux/src/Housekeeping.cxx b/dfmux/src/Housekeeping.cxx index 8961f5c3..923a4502 100644 --- a/dfmux/src/Housekeeping.cxx +++ b/dfmux/src/Housekeeping.cxx @@ -263,8 +263,7 @@ PYBINDINGS("dfmux") { "tuning script to describe SQUID state") .def_readwrite("squid_feedback", &HkModuleInfo::squid_feedback, "SQUID feedback mechanism employed") - .def_readwrite("nco_frequency", - &HkModuleInfo::nco_frequency, + .def_readwrite("nco_frequency", &HkModuleInfo::nco_frequency, "NCO frequency in standard frequency units (mkid only)") .def_readwrite("routing_type", &HkModuleInfo::routing_type, "Whether DAC are routed directly to ADCs or to the cryostat") From 42dd8930455d891cc2af2b0e7bda3ac8cb051319 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Tue, 26 Mar 2024 14:50:25 -0500 Subject: [PATCH 07/11] remove dan flags, demod_amplitude; fix phase units --- dfmux/include/dfmux/Housekeeping.h | 8 +------- dfmux/python/Housekeeping.py | 30 +++++++++++++++--------------- dfmux/src/Housekeeping.cxx | 9 --------- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/dfmux/include/dfmux/Housekeeping.h b/dfmux/include/dfmux/Housekeeping.h index 116e56e2..951ece46 100644 --- a/dfmux/include/dfmux/Housekeeping.h +++ b/dfmux/include/dfmux/Housekeeping.h @@ -26,8 +26,7 @@ class HkChannelInfo : public G3FrameObject carrier_frequency(NAN), dan_accumulator_enable(false), dan_feedback_enable(false), dan_streaming_enable(false), dan_gain(NAN), demod_frequency(NAN), nuller_amplitude(NAN), dan_railed(false), rlatched(NAN), rnormal(NAN), rfrac_achieved(NAN), loopgain(NAN), - demod_amplitude(NAN), carrier_phase(NAN), nuller_phase(NAN), demod_phase(NAN), - dan_zero_enable(false), dan_zeroed(false) {} + carrier_phase(NAN), nuller_phase(NAN), demod_phase(NAN) {} int32_t channel_number; // 1-indexed double carrier_amplitude; @@ -48,15 +47,10 @@ class HkChannelInfo : public G3FrameObject double loopgain; // hidfmux properties - double demod_amplitude; - double carrier_phase; double nuller_phase; double demod_phase; - bool dan_zero_enable; - bool dan_zeroed; - template void serialize(A &ar, unsigned v); std::string Description() const; }; diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index e6beb238..a930bc71 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -216,7 +216,6 @@ def HousekeepingFromJSON(cls, dat): boardhk.timestamp_port = str(dat['timestamp_port']) boardhk.serial = str(dat['serial']) boardhk.firmware_name = str(dat.get('firmware_name', '')) - ismkid = 'mkid' in board.firmware_name.lower() boardhk.firmware_version = str(dat.get('firmware_version', '')) boardhk.fir_stage = dat['fir_stage'] for i in dat['currents'].items(): @@ -279,22 +278,23 @@ def HousekeepingFromJSON(cls, dat): chanhk.channel_number = k+1 chanhk.carrier_amplitude = chan['carrier_amplitude'] chanhk.nuller_amplitude = chan['nuller_amplitude'] - chanhk.dan_gain = chan['dan_gain'] - chanhk.dan_streaming_enable = chan['dan_streaming_enable'] - if boardhk.is128x or ismkid: - chanhk.carrier_frequency = chan['frequency']*core.G3Units.Hz - chanhk.demod_frequency = chan['frequency']*core.G3Units.Hz - if ismkid: - chanhk.demod_amplitude = chan['demod_amplitude'] - chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.rad - chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.rad - chanhk.demod_phase = chan['demod_phase'] * core.G3Units.rad - chanhk.dan_zero_enable = chan['dan_zero_enable'] - chanhk.dan_zeroed = chan['dan_zeroed'] + if 'dan_gain' in chan: + chanhk.dan_gain = chan['dan_gain'] + if 'dan_streaming_enable' in chan: + chanhk.dan_streaming_enable = chan['dan_streaming_enable'] + if 'frequency' in chan: + chanhk.carrier_frequency = chan['frequency'] * core.G3Units.Hz + chanhk.demod_frequency = chan['frequency'] * core.G3Units.Hz else: - chanhk.carrier_frequency = chan['carrier_frequency']*core.G3Units.Hz - chanhk.demod_frequency = chan['demod_frequency']*core.G3Units.Hz + chanhk.carrier_frequency = chan['carrier_frequency'] * core.G3Units.Hz + chanhk.demod_frequency = chan['demod_frequency'] * core.G3Units.Hz + if 'carrier_phase' in chan: + chanhk.carrier_phase = chan['carrier_phase'] * core.G3Units.deg + chanhk.nuller_phase = chan['nuller_phase'] * core.G3Units.deg + chanhk.demod_phase = chan['demod_phase'] * core.G3Units.deg + if 'dan_accumulator_enable' in chan: chanhk.dan_accumulator_enable = chan['dan_accumulator_enable'] + if 'dan_feedback_enable' in chan: chanhk.dan_feedback_enable = chan['dan_feedback_enable'] if 'dan_railed' in chan: chanhk.dan_railed = chan['dan_railed'] diff --git a/dfmux/src/Housekeeping.cxx b/dfmux/src/Housekeeping.cxx index 923a4502..e09c96a8 100644 --- a/dfmux/src/Housekeeping.cxx +++ b/dfmux/src/Housekeeping.cxx @@ -50,12 +50,9 @@ template void HkChannelInfo::serialize(A &ar, unsigned v) } if (v > 5) { - ar & make_nvp("demod_amplitude", demod_amplitude); ar & make_nvp("carrier_phase", carrier_phase); ar & make_nvp("nuller_phase", nuller_phase); ar & make_nvp("demod_phase", demod_phase); - ar & make_nvp("dan_zero_enable", dan_zero_enable); - ar & make_nvp("dan_zeroed", dan_zeroed); } } @@ -215,18 +212,12 @@ PYBINDINGS("dfmux") { .def_readwrite("loopgain", &HkChannelInfo::loopgain, "Measured loopgain of the detector as stored by the " "control software tuning script.") - .def_readwrite("demod_amplitude", &HkChannelInfo::demod_amplitude, - "Demodulator amplitude in normalized units (0-1) (mkid only)") .def_readwrite("carrier_phase", &HkChannelInfo::carrier_phase, "Carrier phase in standard angle units (mkid only)") .def_readwrite("nuller_phase", &HkChannelInfo::nuller_phase, "Nuller phase in standard angle units (mkid only)") .def_readwrite("demod_phase", &HkChannelInfo::demod_phase, "Demodulator phase in standard angle units (mkid only)") - .def_readwrite("dan_zero_enable", &HkChannelInfo::dan_zero_enable, - "True if the DAN zero enable functionality is turned on (mkid only)") - .def_readwrite("dan_zeroed", &HkChannelInfo::dan_zeroed, - "True if the DAN channel is zeroed (mkid only)") ; register_map >("HkChannelInfoMap", "Mapping of channel number (1-indexed) to channel status " From 916c248729f5ecb0626184418f818c3b98451d6e Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Tue, 26 Mar 2024 15:07:24 -0500 Subject: [PATCH 08/11] mezz temp may be missing --- dfmux/python/Housekeeping.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index a930bc71..6b363974 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -240,7 +240,8 @@ def HousekeepingFromJSON(cls, dat): mezzhk.voltages[str(i[0])] = i[1] if mezzhk.present and mezzhk.power: - mezzhk.temperature = mezz['temperature'] + if 'temperature' in mezz: + mezzhk.temperature = mezz['temperature'] # these parameters are not in the 64x housekeeping tuber mezzhk.squid_heater = mezz.get('squid_heater', 0.0) mezzhk.squid_controller_power = mezz.get('squid_controller_power', False) From fe9298695d32a6803e19d909767fe9b87e305ec4 Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Tue, 26 Mar 2024 15:25:08 -0500 Subject: [PATCH 09/11] optional board and mezz values --- dfmux/python/Housekeeping.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index 6b363974..e17af4ea 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -215,8 +215,9 @@ def HousekeepingFromJSON(cls, dat): boardhk.timestamp_port = str(dat['timestamp_port']) boardhk.serial = str(dat['serial']) - boardhk.firmware_name = str(dat.get('firmware_name', '')) - boardhk.firmware_version = str(dat.get('firmware_version', '')) + if 'firmware_name' in dat: + boardhk.firmware_name = str(dat['firmware_name']) + boardhk.firmware_version = str(dat['firmware_version']) boardhk.fir_stage = dat['fir_stage'] for i in dat['currents'].items(): boardhk.currents[str(i[0])] = i[1] @@ -231,13 +232,16 @@ def HousekeepingFromJSON(cls, dat): mezzhk.present = mezz['present'] mezzhk.power = mezz['power'] if mezzhk.present: - mezzhk.serial = str(mezz['ipmi']['product']['serial_number']) - mezzhk.part_number = str(mezz['ipmi']['product']['part_number']) - mezzhk.revision = str(mezz['ipmi']['product']['version_number']) - for i in mezz['currents'].items(): - mezzhk.currents[str(i[0])] = i[1] - for i in mezz['voltages'].items(): - mezzhk.voltages[str(i[0])] = i[1] + if 'ipmi' in mezz: + mezzhk.serial = str(mezz['ipmi']['product']['serial_number']) + mezzhk.part_number = str(mezz['ipmi']['product']['part_number']) + mezzhk.revision = str(mezz['ipmi']['product']['version_number']) + if 'currents' in mezz: + for i in mezz['currents'].items(): + mezzhk.currents[str(i[0])] = i[1] + if 'voltages' in mezz: + for i in mezz['voltages'].items(): + mezzhk.voltages[str(i[0])] = i[1] if mezzhk.present and mezzhk.power: if 'temperature' in mezz: From 4ff44a46adddedb5120d23bd0c119770527a2927 Mon Sep 17 00:00:00 2001 From: Alexandra Rahlin Date: Mon, 1 Apr 2024 08:25:55 -0500 Subject: [PATCH 10/11] Use the actual readout system name --- dfmux/python/Housekeeping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index e17af4ea..a2fb7db8 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -151,7 +151,7 @@ def ProcessBuffered(self, frame): hwmf = core.G3Frame(core.G3FrameType.Wiring) hwmf['WiringMap'] = hwm - hwmf['ReadoutSystem'] = 'ICE-MKID' if ismkid else 'ICE' + hwmf['ReadoutSystem'] = 'RF-ICE' if ismkid else 'ICE' if self.hwmf is None: self.hwmf = hwmf From 6726a2db93b4ebb2bf80b64a9255cf526e84c47b Mon Sep 17 00:00:00 2001 From: Sasha Rahlin Date: Fri, 5 Apr 2024 11:30:08 -0500 Subject: [PATCH 11/11] more rebust firmware check --- dfmux/python/Housekeeping.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dfmux/python/Housekeeping.py b/dfmux/python/Housekeeping.py index a2fb7db8..7ceda175 100644 --- a/dfmux/python/Housekeeping.py +++ b/dfmux/python/Housekeeping.py @@ -131,7 +131,8 @@ def ProcessBuffered(self, frame): dat = self.tuber[board].GetReply()[0]['result'] boardhk = self.HousekeepingFromJSON(dat) - ismkid = ismkid or "mkid" in boardhk.firmware_name.lower() + if boardhk.firmware_name: + ismkid = ismkid or "mkid" in boardhk.firmware_name.lower() hkdata[int(boardhk.serial)] = boardhk ip, crate, slot = self.board_map[board]