21.09
This commit is contained in:
64
apteronotus_code/sin_all_normal.py
Normal file
64
apteronotus_code/sin_all_normal.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pylab
|
||||
from IPython import embed
|
||||
from scipy.optimize import curve_fit
|
||||
from jar_functions import gain_curve_fit
|
||||
from jar_functions import avgNestedLists
|
||||
|
||||
|
||||
identifier = [#'2018lepto1',
|
||||
#'2018lepto4',
|
||||
#'2018lepto5',
|
||||
#'2018lepto76',
|
||||
'2018lepto98',
|
||||
'2019lepto03',
|
||||
#'2019lepto24',
|
||||
#'2019lepto27',
|
||||
#'2019lepto30',
|
||||
#'2020lepto04',
|
||||
#'2020lepto06',
|
||||
'2020lepto16',
|
||||
'2020lepto19',
|
||||
'2020lepto20'
|
||||
]
|
||||
|
||||
tau = []
|
||||
f_c = []
|
||||
for ID in identifier:
|
||||
print(ID)
|
||||
amf = np.load('5Hz_amf_%s.npy' %ID)
|
||||
gain = np.load('5Hz_gain_%s.npy' %ID)
|
||||
|
||||
sinv, sinc = curve_fit(gain_curve_fit, amf, gain)
|
||||
#print('tau:', sinv[0])
|
||||
tau.append(sinv[0])
|
||||
f_cutoff = abs(1 / (2*np.pi*sinv[0]))
|
||||
print('f_cutoff:', f_cutoff)
|
||||
f_c.append(f_cutoff)
|
||||
|
||||
|
||||
amf = [0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1]
|
||||
|
||||
all = []
|
||||
|
||||
for ident in identifier:
|
||||
data = np.load('5Hz_gain_%s.npy' %ident)
|
||||
all.append(data)
|
||||
|
||||
av = avgNestedLists(all)
|
||||
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax.plot(amf, av, 'o')
|
||||
ax.set_xscale('log')
|
||||
ax.set_yscale('log')
|
||||
ax.set_title('gaincurve_average_allfish_5Hz')
|
||||
ax.set_ylabel('gain [Hz/(mV/cm)]')
|
||||
ax.set_xlabel('envelope_frequency [Hz]')
|
||||
ax.set_ylim(0.0008, )
|
||||
ax.plot(f_c, np.full((len(identifier)), 0.0015), 'o', label = 'cutoff frequencies')
|
||||
ax.legend()
|
||||
|
||||
plt.show()
|
||||
embed()
|
||||
97
apteronotus_code/sin_all_uniform.py
Normal file
97
apteronotus_code/sin_all_uniform.py
Normal file
@@ -0,0 +1,97 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
import pylab
|
||||
from IPython import embed
|
||||
from scipy.optimize import curve_fit
|
||||
from jar_functions import gain_curve_fit
|
||||
from jar_functions import avgNestedLists
|
||||
|
||||
|
||||
identifier_uniform = ['2018lepto1',
|
||||
# '2018lepto4',
|
||||
# '2018lepto5',
|
||||
#'2018lepto76',
|
||||
'2018lepto98',
|
||||
# '2019lepto03',
|
||||
'2019lepto24',
|
||||
#'2019lepto27',
|
||||
# '2019lepto30',
|
||||
'2020lepto04',
|
||||
# '2020lepto06',
|
||||
# '2020lepto16',
|
||||
'2020lepto19',
|
||||
# '2020lepto20'
|
||||
]
|
||||
identifier = ['2018lepto1',
|
||||
'2018lepto4',
|
||||
'2018lepto5',
|
||||
'2018lepto76',
|
||||
'2018lepto98',
|
||||
'2019lepto03',
|
||||
'2019lepto24',
|
||||
'2019lepto27',
|
||||
'2019lepto30',
|
||||
'2020lepto04',
|
||||
'2020lepto06',
|
||||
'2020lepto16',
|
||||
'2020lepto19',
|
||||
'2020lepto20'
|
||||
]
|
||||
|
||||
tau = []
|
||||
f_c = []
|
||||
for ID in identifier:
|
||||
print(ID)
|
||||
amf = np.load('amf_%s.npy' %ID)
|
||||
gain = np.load('gain_%s.npy' %ID)
|
||||
|
||||
sinv, sinc = curve_fit(gain_curve_fit, amf, gain)
|
||||
#print('tau:', sinv[0])
|
||||
tau.append(sinv[0])
|
||||
f_cutoff = abs(1 / (2*np.pi*sinv[0]))
|
||||
print('f_cutoff:', f_cutoff)
|
||||
f_c.append(f_cutoff)
|
||||
|
||||
tau_uniform = []
|
||||
f_c_uniform = []
|
||||
for ID in identifier_uniform:
|
||||
#print(ID)
|
||||
amf = np.load('amf_%s.npy' %ID)
|
||||
gain = np.load('gain_%s.npy' %ID)
|
||||
|
||||
sinv, sinc = curve_fit(gain_curve_fit, amf, gain)
|
||||
#print('tau:', sinv[0])
|
||||
tau_uniform.append(sinv[0])
|
||||
f_cutoff = abs(1 / (2*np.pi*sinv[0]))
|
||||
#print('f_cutoff:', f_cutoff)
|
||||
f_c_uniform.append(f_cutoff)
|
||||
amf = [0.001, 0.002, 0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1]
|
||||
|
||||
all = []
|
||||
new_all = []
|
||||
for ident in identifier:
|
||||
data = np.load('gain_%s.npy' %ident)
|
||||
all.append(data)
|
||||
for ident in identifier_uniform:
|
||||
data = np.load('gain_%s.npy' % ident)
|
||||
new_all.append(data)
|
||||
|
||||
av = avgNestedLists(all)
|
||||
new_av = avgNestedLists(new_all)
|
||||
lim = 0.001
|
||||
fig = plt.figure()
|
||||
ax = fig.add_subplot(111)
|
||||
ax.plot(amf, av, 'o', color = 'orange', label = 'normal')
|
||||
ax.plot(amf, new_av, 'o', color = 'blue', label = 'uniformed')
|
||||
ax.set_xscale('log')
|
||||
ax.set_yscale('log')
|
||||
ax.set_title('gaincurve_average_allfish')
|
||||
ax.set_ylabel('gain [Hz/(mV/cm)]')
|
||||
ax.set_xlabel('envelope_frequency [Hz]')
|
||||
ax.set_ylim(0.0008, )
|
||||
ax.plot(f_c, np.full((len(identifier)), 0.0015), 'o', color = 'orange', label = 'all cutoff frequencies')
|
||||
ax.plot(f_c_uniform, np.full((len(identifier_uniform)), 0.001), 'o', color = 'blue', label = 'uniformed cutoff frequencies')
|
||||
ax.legend()
|
||||
|
||||
plt.show()
|
||||
embed()
|
||||
Reference in New Issue
Block a user