data is ready for plotting
This commit is contained in:
parent
ae6e78f9a7
commit
1daf5c244e
@ -4,6 +4,7 @@ from read_chirp_data import *
|
|||||||
from utility import *
|
from utility import *
|
||||||
from IPython import embed
|
from IPython import embed
|
||||||
|
|
||||||
|
sampling_rate = 40 #kHz
|
||||||
data_dir = "../data"
|
data_dir = "../data"
|
||||||
dataset = "2018-11-09-ad-invivo-1"
|
dataset = "2018-11-09-ad-invivo-1"
|
||||||
|
|
||||||
@ -21,37 +22,46 @@ for k in spikes.keys():
|
|||||||
|
|
||||||
# make phases together, 12 phases
|
# make phases together, 12 phases
|
||||||
phase_vec = np.arange(0, 1+1/12, 1/12)
|
phase_vec = np.arange(0, 1+1/12, 1/12)
|
||||||
phase_mat_df = {}
|
cut_range = np.arange(-50*sampling_rate, 50*sampling_rate, 1)
|
||||||
|
|
||||||
|
df_phase_time = {}
|
||||||
|
df_phase_binary = {}
|
||||||
|
|
||||||
for deltaf in df_map.keys():
|
for deltaf in df_map.keys():
|
||||||
phase_df = {}
|
df_phase_time[deltaf] = {}
|
||||||
|
df_phase_binary[deltaf] = {}
|
||||||
for rep in df_map[deltaf]:
|
for rep in df_map[deltaf]:
|
||||||
for phase in spikes[rep]:
|
for phase in spikes[rep]:
|
||||||
#print(phase)
|
#print(phase)
|
||||||
for idx in range(len(phase_vec)-1):
|
for idx in range(len(phase_vec)-1):
|
||||||
if phase[1] > phase_vec[idx] and phase[1] < phase_vec[idx+1]:
|
if phase[1] > phase_vec[idx] and phase[1] < phase_vec[idx+1]:
|
||||||
if phase_vec[idx] in phase_df.keys():
|
|
||||||
phase_df[phase_vec[idx]].append(phase)
|
|
||||||
else:
|
|
||||||
phase_df[phase_vec[idx]] = [phase]
|
|
||||||
|
|
||||||
#spikes_one_chirp = spikes[rep][phase]
|
|
||||||
|
|
||||||
|
spikes_to_cut = np.asarray(spikes[rep][phase])
|
||||||
|
spikes_cut = spikes_to_cut[(spikes_to_cut > -50) & (spikes_to_cut < 50)]
|
||||||
|
spikes_idx = np.round(spikes_cut*sampling_rate)
|
||||||
|
binary_spikes = np.isin(cut_range, spikes_idx)*1
|
||||||
|
|
||||||
phase_mat_df[deltaf] = phase_df
|
if phase_vec[idx] in df_phase_time[deltaf].keys():
|
||||||
|
df_phase_time[deltaf][phase_vec[idx]].append(spikes[rep][phase])
|
||||||
|
df_phase_binary[deltaf][phase_vec[idx]] = np.vstack((df_phase_binary[deltaf][phase_vec[idx]], binary_spikes))
|
||||||
|
else:
|
||||||
|
df_phase_time[deltaf][phase_vec[idx]] = [spikes[rep][phase]]
|
||||||
|
df_phase_binary[deltaf][phase_vec[idx]] = binary_spikes
|
||||||
|
|
||||||
#df_spikes = spikes[df_map['-50Hz'][0]]
|
|
||||||
#phase_spikes = df_spikes[phase_mat_df['-50Hz'][0.0][0]]
|
|
||||||
|
|
||||||
trial_spikes = np.asarray(spikes[(0, '-50Hz', '20%', '100Hz')][(0, 0.789)])
|
plot_trials = df_phase_binary['-50Hz'][0.0]
|
||||||
plot_spikes = trial_spikes[(trial_spikes < 50.0) & (trial_spikes > -50.0)]
|
#hist_data = plt.hist(plot_trials)
|
||||||
|
#ax.plot(hist_data[1][:-1], hist_data[0])
|
||||||
|
|
||||||
hist_data = plt.hist(plot_spikes, color='w')
|
|
||||||
fig, ax = plt.subplots()
|
fig, ax = plt.subplots()
|
||||||
ax.scatter(plot_spikes, np.ones(len(plot_spikes))*10, marker='|', color='k')
|
for i, trial in enumerate(plot_trials):
|
||||||
ax.plot(hist_data[1][:-1], hist_data[0])
|
embed()
|
||||||
|
exit()
|
||||||
|
trial[trial == 0] = np.nan
|
||||||
|
ax.scatter(np.ones(len(trial)), trial, marker='|', color='k', size=12)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
|
|
||||||
#mu = 1
|
#mu = 1
|
||||||
#sigma = 1
|
#sigma = 1
|
||||||
#time_gauss = np.arange(-4, 4, 1)
|
#time_gauss = np.arange(-4, 4, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user