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

Function energy_decay_calculation

pytta/classes/analysis.py:1402–1440  ·  view source on GitHub ↗

Calculate the Energy Decay Curve.

(band, timeSignal, timeVector, samplingRate,
                             numSamples, numChannels, timeLength, bypassLundeby,
                             suppressWarnings=True)

Source from the content-addressed store, hash-verified

1400
1401# @njit
1402def energy_decay_calculation(band, timeSignal, timeVector, samplingRate,
1403 numSamples, numChannels, timeLength, bypassLundeby,
1404 suppressWarnings=True):
1405 """Calculate the Energy Decay Curve."""
1406 if bypassLundeby is False:
1407 lundebyParams = \
1408 _Lundeby_correction(band,
1409 timeSignal,
1410 samplingRate,
1411 numSamples,
1412 numChannels,
1413 timeLength,
1414 suppressWarnings=suppressWarnings)
1415 _, c1, interIdx, BGL = lundebyParams
1416 lateRT = -60/c1 if c1 != 0 else 0
1417 else:
1418 interIdx = 0
1419 lateRT = 1
1420
1421 if interIdx == 0:
1422 interIdx = -1
1423
1424 truncatedTimeSignal = timeSignal[:interIdx, 0]
1425 truncatedTimeVector = timeVector[:interIdx]
1426
1427 if lateRT != 0.0:
1428 if not bypassLundeby:
1429 C = samplingRate*BGL*lateRT/(6*np.log(10))
1430 else:
1431 C = 0
1432 sqrInv = truncatedTimeSignal[::-1]**2
1433 energyDecayFull = np.cumsum(sqrInv)[::-1] + C
1434 energyDecay = energyDecayFull/energyDecayFull[0]
1435 else:
1436 if not suppressWarnings:
1437 print(band, "[Hz] band: could not estimate C factor")
1438 C = 0
1439 energyDecay = np.zeros(truncatedTimeVector.size)
1440 return (energyDecay, truncatedTimeVector, lundebyParams)
1441
1442
1443def cumulative_integration(inputSignal,

Callers 1

cumulative_integrationFunction · 0.85

Calls 1

_Lundeby_correctionFunction · 0.85

Tested by

no test coverage detected