This commit is contained in:
sarah.eisele 2024-10-24 15:29:06 +02:00
commit 25e51d3eed
2 changed files with 24 additions and 5 deletions

View File

@ -136,7 +136,7 @@ def plot_highlighted_integrals(frequency, power, points, color_mapping, points_c
ax.set_title('Power Spectrum with Highlighted Integrals') ax.set_title('Power Spectrum with Highlighted Integrals')
ax.legend() ax.legend()
return fig return fig, ax

View File

@ -1,9 +1,5 @@
import glob
import pathlib
import numpy as np import numpy as np
import matplotlib.pyplot as plt
import rlxnix as rlx import rlxnix as rlx
from IPython import embed
from scipy.signal import welch from scipy.signal import welch
def all_coming_together(freq_array, power_array, points_list, categories, num_harmonics_list, colors, delta=2.5, threshold=0.5): def all_coming_together(freq_array, power_array, points_list, categories, num_harmonics_list, colors, delta=2.5, threshold=0.5):
@ -513,6 +509,29 @@ def spike_times(stim):
dt = ti.sampling_interval dt = ti.sampling_interval
return spikes, stim_dur, dt # se changed spike_times to spikes so its not the same as name of function return spikes, stim_dur, dt # se changed spike_times to spikes so its not the same as name of function
def true_eodf(eodf_file):
'''
Calculates the Eodf of the fish when it was awake from a nix file.
Parameters
----------
eodf_file : str
path to the file with nix-file for the eodf.
Returns
-------
orig_eodf : int
The original eodf.
'''
eod_data = rlx.Dataset(eodf_file)#load eodf file
baseline = eod_data.repro_runs('baseline')[0]
eod, time = baseline.trace_data('EOD') # get time and eod
dt = baseline.trace_info('EOD').sampling_interval
eod_freq, eod_power = welch(eod, fs = 1/dt, nperseg = 2**16, noverlap = 2**15)
orig_eodf = round(eod_freq[np.argmax(eod_power)])
return orig_eodf
def valid_integrals(integral, local_mean, point, threshold = 0.1): def valid_integrals(integral, local_mean, point, threshold = 0.1):
""" """
Check if the integral exceeds the threshold compared to the local mean and Check if the integral exceeds the threshold compared to the local mean and