Measurement.fromnpy(): accept sensitivity as scalar or 0-dim numpy.ndarray
All checks were successful
Building, testing and releasing LASP if it has a tag / Build-Test-Ubuntu (push) Successful in -3m20s
Building, testing and releasing LASP if it has a tag / Release-Ubuntu (push) Has been skipped

This commit is contained in:
Casper Jansen 2024-09-10 13:40:47 +02:00
parent 6b0442fe90
commit 5a051d21a1
2 changed files with 7 additions and 10 deletions

View File

@ -10,11 +10,11 @@ from .lasp_cpp import *
# from .lasp_imptube import * # TwoMicImpedanceTube # from .lasp_imptube import * # TwoMicImpedanceTube
from .lasp_measurement import * # Measurement, scaleBlockSens from .lasp_measurement import * # Measurement, scaleBlockSens
from .lasp_octavefilter import * from .lasp_octavefilter import * # OverallFilterBank, SosOctaveFilterBank, SosThirdOctaveFilterBank
from .lasp_slm import * # SLM, Dummy from .lasp_slm import * # SLM, Dummy
from .lasp_record import * # RecordStatus, Recording from .lasp_record import * # RecordStatus, Recording
from .lasp_daqconfigs import * from .lasp_daqconfigs import * # DaqConfigurations
from .lasp_measurementset import * from .lasp_measurementset import * # MeasurementSet
# from .lasp_siggen import * # SignalType, NoiseType, SiggenMessage, SiggenData, Siggen # from .lasp_siggen import * # SignalType, NoiseType, SiggenMessage, SiggenData, Siggen
# from .lasp_weighcal import * # WeighCal # from .lasp_weighcal import * # WeighCal

View File

@ -77,9 +77,9 @@ class MeasurementType(Enum):
Measurement flags related to the measurement. Stored as bit flags in the measurement file. This is for possible changes in the API later. Measurement flags related to the measurement. Stored as bit flags in the measurement file. This is for possible changes in the API later.
""" """
# Not specific measurement type # Not specific measurement type
NotSpecific = 0 NotSpecific = 0
# Measurement serves as an insertion loss reference measurement # Measurement serves as an insertion loss reference measurement
ILReference = 1 << 0 ILReference = 1 << 0
@ -1156,11 +1156,8 @@ class Measurement:
if data.ndim != 2: if data.ndim != 2:
data = data[:, np.newaxis] data = data[:, np.newaxis]
try: if not (isinstance(sensitivity, np.ndarray) and sensitivity.ndim >= 1):
len(sensitivity) sensitivity = np.asarray(sensitivity)[np.newaxis]
except:
raise ValueError("Sensitivity should be given as array-like data type")
sensitivity = np.asarray(sensitivity)
nchannels = data.shape[1] nchannels = data.shape[1]
if nchannels != sensitivity.shape[0]: if nchannels != sensitivity.shape[0]: