Skip to content

Commit

Permalink
remove dan flags, demod_amplitude; fix phase units
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Mar 26, 2024
1 parent b329db7 commit 42dd893
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
8 changes: 1 addition & 7 deletions dfmux/include/dfmux/Housekeeping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 <class A> void serialize(A &ar, unsigned v);
std::string Description() const;
};
Expand Down
30 changes: 15 additions & 15 deletions dfmux/python/Housekeeping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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']
Expand Down
9 changes: 0 additions & 9 deletions dfmux/src/Housekeeping.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ template <class A> 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);
}
}

Expand Down Expand Up @@ -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<std::map<int, HkChannelInfo> >("HkChannelInfoMap",
"Mapping of channel number (1-indexed) to channel status "
Expand Down

0 comments on commit 42dd893

Please sign in to comment.