Added comments and maybe some minor repairs.

This commit is contained in:
Casper Jansen 2021-08-09 09:51:51 +02:00
parent c03979991d
commit 4c0f399505
6 changed files with 32 additions and 25 deletions

View File

@ -1,12 +1,14 @@
from .lasp_common import *
from .lasp_avstream import *
from .wrappers import *
from .lasp_atomic import *
from .lasp_imptube import *
from .lasp_measurement import *
from .lasp_octavefilter import *
from .lasp_slm import *
from .lasp_record import *
from .lasp_siggen import *
from .lasp_weighcal import *
from .tools import *
# Comments are what is imported, state of 6-8-2021
from .lasp_common import * # P_REF, FreqWeighting, TimeWeighting, getTime, getFreq, Qty, SIQtys, Window, lasp_shelve, this_lasp_shelve, W_REF, U_REF, I_REF, dBFS_REF, AvType
from .lasp_avstream import * # StreamManager, ignoreSigInt, StreamStatus
from .wrappers import * # AvPowerSpectra, SosFilterBank, FilterBank, Siggen, sweep_flag_forward, sweep_flag_backward, sweep_flag_linear, sweep_flag_exponential, load_fft_wisdom, store_fft_wisdom
from .lasp_atomic import * # Atomic
from .lasp_imptube import * # TwoMicImpedanceTube
from .lasp_measurement import * # Measurement, scaleBlockSens
from .lasp_octavefilter import * # FirOctaveFilterBank, FirThirdOctaveFilterBank, OverallFilterBank, SosOctaveFilterBank, SosThirdOctaveFilterBank
from .lasp_slm import * # SLM, Dummy
from .lasp_record import * # RecordStatus, Recording
from .lasp_siggen import * # SignalType, NoiseType, SiggenMessage, SiggenData, Siggen
from .lasp_weighcal import * # WeighCal
from .tools import * # SmoothingType, smoothSpectralData, SmoothingWidth

View File

@ -117,7 +117,7 @@ void PowerSpectra_compute(const PowerSpectra* ps,
TRACE(15,"fft done");
/* Scale fft such that power is easily comxputed */
/* Scale fft such that power is easily computed */
const c scale_fac = d_sqrt(2/win_pow)/nfft;
cmat_scale(&fft_work,scale_fac);
TRACE(15,"scale done");

View File

@ -1,5 +1,8 @@
from .soundpressureweighting import *
from .filterbank_design import *
from .fir_design import *
from .colorednoise import *
from .biquad import *
# Comments what modules are imported are state of 6-8-2021.
from .soundpressureweighting import * # SPLFilterDesigner
from .filterbank_design import * # OctaveBankDesigner, ThirdOctaveBankDesigner
from .fir_design import * # freqResponse, bandpass_fir_design, lowpass_fir_design, arbitrary_fir_design
from .colorednoise import * # PinkNoise # not imported: BrownianNoise, BlueNoise
from .biquad import * # peaking, biquadTF, notch, lowpass, highpass, highshelve, lowshelve
# Nothing is imported from decimation_fir.py

View File

@ -81,7 +81,7 @@ class FilterBankDesigner:
if self.nominal_txt(x) == nom_txt:
return x
raise ValueError(
f'Could not find an x-value corresponding to {nom_txt}.')
f'Could not find a nominal frequency corresponding to {nom_txt}. Hint: use \'5k\' instead of \'5000\'.')
def sanitize_input(self, input_):
if isinstance(input_, int):
@ -492,7 +492,7 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
index_start = x[0] - self.xs[0]
index_stop = x[-1] - self.xs[0]
return self._nominal_txt[index_start:index_stop+1]
def band_limits(self, x, filter_class=0):
"""Returns the third octave band filter limits for filter designator x.
@ -601,4 +601,3 @@ class ThirdOctaveBankDesigner(FilterBankDesigner):
else:
raise ValueError('Unimplemented sampling frequency for SOS'
'filter design')

View File

@ -160,7 +160,7 @@ class Recording:
return
# The 'Audio' dataset as specified in lasp_measurement, where data is
# send to. We use gzip as compression, this gives moderate a moderate
# sent to. We use gzip as compression, this gives moderate a moderate
# compression to the data.
f = self.f
blocksize = md.blocksize

View File

@ -101,9 +101,12 @@ def smoothSpectralData(freq, M, sw: SmoothingWidth,
# elif st == SmoothingType.tf:
# P = P**2
Psm = np.zeros_like(P) # smoothed power - to be calculated
x0 = 1 if freq[0]==0 else 0 # skip first data point if zero frequency
df = freq[1] - freq[0] # frequency step
# P is power while smoothing. x are indices of P.
Psm = np.zeros_like(P) # Smoothed power - to be calculated
x0 = 1 if freq[0]==0 else 0 # Skip first data point if zero frequency
Psm[0] = P[0] # Reuse old value in case first data..
# ..point is skipped. Not plotted any way.
df = freq[1] - freq[0] # Frequency step
# Loop through data points
for x in range(x0, L):