MCPcopy Create free account
hub / github.com/PyTTaMaster/PyTTa / _level_profile

Function _level_profile

pytta/classes/analysis.py:1167–1188  ·  view source on GitHub ↗

Get h(t) in octave bands and do the local time averaging in nblocks. Returns h^2_averaged(block).

(timeSignal, samplingRate,
                   numSamples, numChannels, blockSamples=None)

Source from the content-addressed store, hash-verified

1165
1166# @njit
1167def _level_profile(timeSignal, samplingRate,
1168 numSamples, numChannels, blockSamples=None):
1169 """Get h(t) in octave bands and do the local time averaging in nblocks. Returns h^2_averaged(block)."""
1170 def mean_squared(x):
1171 return np.mean(x**2)
1172
1173 if blockSamples is None:
1174 blockSamples = 100
1175 nblocks = int(numSamples // blockSamples)
1176 profile = np.zeros((nblocks, numChannels), dtype=np.float32)
1177 timeStamp = np.zeros((nblocks, 1))
1178
1179 for ch in range(numChannels):
1180 # if numChannels == 1:
1181 # tmp = timeSignal
1182 # else:
1183 tmp = timeSignal[:, ch]
1184 for idx in range(nblocks):
1185 profile[idx, ch] = mean_squared(tmp[:blockSamples])
1186 timeStamp[idx, 0] = idx*blockSamples/samplingRate
1187 tmp = tmp[blockSamples:]
1188 return profile, timeStamp
1189
1190
1191# @njit

Callers 2

_Lundeby_correctionFunction · 0.85
crop_IRFunction · 0.85

Calls 1

mean_squaredFunction · 0.85

Tested by

no test coverage detected