Compare commits
No commits in common. "c7436ad6b61500b3a9540bd9af73dbf76179a404" and "8ace385ab117ea5a5b2beea78e77b8158d7cf2f5" have entirely different histories.
c7436ad6b6
...
8ace385ab1
55
code/test.py
55
code/test.py
@ -129,61 +129,6 @@ def remove_poor(files):
|
|||||||
good_files.append(files[i])
|
good_files.append(files[i])
|
||||||
return good_files
|
return good_files
|
||||||
|
|
||||||
def sam_data(sam):
|
|
||||||
'''
|
|
||||||
Gets metadata for each SAM
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
sam : ReproRun object
|
|
||||||
The sam the metdata should be extracted from.
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
sam_amp : float
|
|
||||||
amplitude in percent, relative to the fish amplitude.
|
|
||||||
sam_am : float
|
|
||||||
Amplitude modulation frequency.
|
|
||||||
sam_df : float
|
|
||||||
Difference from the stimulus to the current fish eodf.
|
|
||||||
sam_eodf : float
|
|
||||||
The current EODf.
|
|
||||||
sam_nyquist : float
|
|
||||||
The Nyquist frequency of the EODf.
|
|
||||||
sam_stim : float
|
|
||||||
The stimulus frequency.
|
|
||||||
|
|
||||||
'''
|
|
||||||
# create lists for the values we want
|
|
||||||
amplitudes = []
|
|
||||||
dfs = []
|
|
||||||
eodfs = []
|
|
||||||
stim_freqs = []
|
|
||||||
amp_mods = []
|
|
||||||
ny_freqs = []
|
|
||||||
|
|
||||||
# get the stimuli
|
|
||||||
stimuli = sam.stimuli
|
|
||||||
|
|
||||||
# loop over the stimuli
|
|
||||||
for stim in stimuli:
|
|
||||||
amplitude, df, eodf, stim_freq, amp_mod, ny_freq = extract_stim_data(stim)
|
|
||||||
amplitudes.append(amplitude)
|
|
||||||
dfs.append(df)
|
|
||||||
eodfs.append(eodf)
|
|
||||||
stim_freqs.append(stim_freq)
|
|
||||||
amp_mods.append(amp_mod)
|
|
||||||
ny_freqs.append(ny_freq)
|
|
||||||
|
|
||||||
# get the means
|
|
||||||
sam_amp = np.mean(amplitudes)
|
|
||||||
sam_am = np.mean(amp_mods)
|
|
||||||
sam_df = np.mean(dfs)
|
|
||||||
sam_eodf = np.mean(eodfs)
|
|
||||||
sam_nyquist = np.mean(ny_freqs)
|
|
||||||
sam_stim = np.mean(stim_freqs)
|
|
||||||
return sam_amp, sam_am,sam_df, sam_eodf, sam_nyquist, sam_stim
|
|
||||||
|
|
||||||
#find example data
|
#find example data
|
||||||
datafolder = "../../data"
|
datafolder = "../../data"
|
||||||
|
|
||||||
|
@ -171,58 +171,3 @@ def remove_poor(files):
|
|||||||
# if its good or fair add it to the good files
|
# if its good or fair add it to the good files
|
||||||
good_files.append(files[i])
|
good_files.append(files[i])
|
||||||
return good_files
|
return good_files
|
||||||
|
|
||||||
def sam_data(sam):
|
|
||||||
'''
|
|
||||||
Gets metadata for each SAM
|
|
||||||
|
|
||||||
Parameters
|
|
||||||
----------
|
|
||||||
sam : ReproRun object
|
|
||||||
The sam the metdata should be extracted from.
|
|
||||||
|
|
||||||
Returns
|
|
||||||
-------
|
|
||||||
sam_amp : float
|
|
||||||
amplitude in percent, relative to the fish amplitude.
|
|
||||||
sam_am : float
|
|
||||||
Amplitude modulation frequency.
|
|
||||||
sam_df : float
|
|
||||||
Difference from the stimulus to the current fish eodf.
|
|
||||||
sam_eodf : float
|
|
||||||
The current EODf.
|
|
||||||
sam_nyquist : float
|
|
||||||
The Nyquist frequency of the EODf.
|
|
||||||
sam_stim : float
|
|
||||||
The stimulus frequency.
|
|
||||||
|
|
||||||
'''
|
|
||||||
# create lists for the values we want
|
|
||||||
amplitudes = []
|
|
||||||
dfs = []
|
|
||||||
eodfs = []
|
|
||||||
stim_freqs = []
|
|
||||||
amp_mods = []
|
|
||||||
ny_freqs = []
|
|
||||||
|
|
||||||
# get the stimuli
|
|
||||||
stimuli = sam.stimuli
|
|
||||||
|
|
||||||
# loop over the stimuli
|
|
||||||
for stim in stimuli:
|
|
||||||
amplitude, df, eodf, stim_freq, amp_mod, ny_freq = extract_stim_data(stim)
|
|
||||||
amplitudes.append(amplitude)
|
|
||||||
dfs.append(df)
|
|
||||||
eodfs.append(eodf)
|
|
||||||
stim_freqs.append(stim_freq)
|
|
||||||
amp_mods.append(amp_mod)
|
|
||||||
ny_freqs.append(ny_freq)
|
|
||||||
|
|
||||||
# get the means
|
|
||||||
sam_amp = np.mean(amplitudes)
|
|
||||||
sam_am = np.mean(amp_mods)
|
|
||||||
sam_df = np.mean(dfs)
|
|
||||||
sam_eodf = np.mean(eodfs)
|
|
||||||
sam_nyquist = np.mean(ny_freqs)
|
|
||||||
sam_stim = np.mean(stim_freqs)
|
|
||||||
return sam_amp, sam_am,sam_df, sam_eodf, sam_nyquist, sam_stim
|
|
Loading…
Reference in New Issue
Block a user