diff --git a/code/test.py b/code/test.py index 677cc02..a0eddc9 100644 --- a/code/test.py +++ b/code/test.py @@ -1,4 +1,4 @@ -<<<<<<< HEAD + import glob import pathlib import numpy as np @@ -42,6 +42,38 @@ 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" @@ -99,6 +131,7 @@ ax = fig.add_subplot() ax.eventplot(spikes, linelength = 0.8) ax.set_xlabel('time [ms]') ax.set_ylabel('loop no.') +<<<<<<< HEAD ======= import glob import pathlib @@ -200,5 +233,4 @@ ax = fig.add_subplot() ax.eventplot(spikes, linelength = 0.8) ax.set_xlabel('time [ms]') ax.set_ylabel('loop no.') ->>>>>>> 7e02490a89d17a96689c3f0c0ad4919df2e09b93 plt.show() \ No newline at end of file