diff --git a/cpp_src/dsp/lasp_siggen_impl.cpp b/cpp_src/dsp/lasp_siggen_impl.cpp index f4e7223..5d795a2 100644 --- a/cpp_src/dsp/lasp_siggen_impl.cpp +++ b/cpp_src/dsp/lasp_siggen_impl.cpp @@ -184,7 +184,7 @@ void Sweep::resetImpl() /* dVARTRACE(15, eps); */ d phase = 0; - for (us n = 0; n <= Ns; n++) + for (us n = 0; n < Ns; n++) { /* iVARTRACE(17, n); */ if (n < N) @@ -285,7 +285,7 @@ void Sweep::resetImpl() DEBUGTRACE_PRINT(k); DEBUGTRACE_PRINT(E); - for (us n = 0; n <= Ns; n++) + for (us n = 0; n < Ns; n++) { /* iVARTRACE(17, n); */ if (n < Ns) diff --git a/python_src/lasp/lasp_measurement.py b/python_src/lasp/lasp_measurement.py index ab61e53..4f7dff8 100644 --- a/python_src/lasp/lasp_measurement.py +++ b/python_src/lasp/lasp_measurement.py @@ -306,6 +306,16 @@ class Measurement: except KeyError: self._type_int = 0 + try: + dat = {} + + for key in f['siggen']['Data'].attrs: + dat[key] = f['siggen']['Data'].attrs[key] + + self._siggen = {'Type': f['siggen'].attrs["Type"], 'Data': dat} + except KeyError: + self._siggen = {'Type': 'Muted', 'Data': {}} + # Due to a previous bug, the channel names were not stored # consistently, i.e. as 'channel_names' and later camelcase. try: @@ -571,11 +581,28 @@ class Measurement: """ self.setAttribute("type_int", type_.value) + def setSiggen(self, siggen_: dict): + """ + Set the signal generator data + """ + with self.file("r+") as f: + siggen_group = f.create_group("siggen", track_order=True) + siggen_group.attrs['Type'] = siggen_['Type'] + data_group = siggen_group.create_group("Data", track_order=True) + for key in siggen_['Data'].keys(): + data_group.attrs[key] = siggen_['Data'][key] + def measurementType(self): """ Returns type of measurement """ return MeasurementType(self._type_int) + + def signalGenerator(self): + """ + Returns signal generator data + """ + return self._siggen @property def name(self):