test.py aktualisiert
This commit is contained in:
parent
7e02490a89
commit
54d10789b4
30
code/test.py
30
code/test.py
@ -41,6 +41,36 @@ def power_spectrum(rate, dt):
|
||||
freq, power = welch(rate, fs = 1/dt, nperseg = 2**16, noverlap = 2**15)
|
||||
return freq, power
|
||||
|
||||
def extract_stim_data(stimulus):
|
||||
'''
|
||||
extracts all necessary metadata for each stimulus
|
||||
|
||||
Parameters
|
||||
----------
|
||||
stimulus : Stimulus object or rlxnix.base.repro module
|
||||
The stimulus from which the data is needed.
|
||||
|
||||
Returns
|
||||
-------
|
||||
amplitude : float
|
||||
The relative signal amplitude in percent.
|
||||
df : float
|
||||
Distance of the stimulus to the current EODf.
|
||||
eodf : float
|
||||
Current EODf.
|
||||
stim_freq : float
|
||||
The total stimulus frequency (EODF+df).
|
||||
|
||||
'''
|
||||
# extract metadata
|
||||
# the stim.name adjusts the first key as it changes with every stimulus
|
||||
amplitude = stim.metadata[stim.name]['Contrast'][0][0]
|
||||
df = stim.metadata[stim.name]['DeltaF'][0][0]
|
||||
eodf = stim.metadata[stim.name]['EODf'][0][0]
|
||||
stim_freq = stim.metadata[stim.name]['Frequency'][0][0]
|
||||
return amplitude, df, eodf, stim_freq
|
||||
|
||||
|
||||
#find example data
|
||||
datafolder = "../data"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user