forked from mnislamraju/NeuroChaT
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added scripts to reproduce files in paper
- Loading branch information
1 parent
45711c3
commit c34ec39
Showing
3 changed files
with
229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
settings: | ||
format: NWB | ||
analysis_mode: Single Unit | ||
mode_id: 0 | ||
graphic_format: pdf | ||
unit_no: 1 | ||
lfp_file: C:\Users\smartin5\Recordings\NC_eg\112512_1.hdf5+/processing/Neural Continuous/LFP/eeg | ||
cell_type: '' | ||
spike_file: C:\Users\smartin5\Recordings\NC_eg\112512_1.hdf5+/processing/Shank/5 | ||
spatial_file: C:\Users\smartin5\Recordings\NC_eg\112512_1.hdf5+/processing/Behavioural/Position | ||
nwb_file: C:\Users\smartin5\Recordings\NC_eg\112512_1.hdf5 | ||
excel_file: '' | ||
data_directory: '' | ||
analyses: | ||
ang_vel: false | ||
border: false | ||
burst: false | ||
gradient: false | ||
grid: false | ||
hd_rate: false | ||
hd_shuffle: false | ||
hd_time_lapse: false | ||
hd_time_shift: false | ||
inter_depend: false | ||
isi: true | ||
isi_corr: true | ||
lfp_spectrum: true | ||
lfp_spike_causality: true | ||
loc_rate: false | ||
loc_shuffle: false | ||
loc_time_lapse: false | ||
loc_time_shift: false | ||
multiple_regression: false | ||
phase_lock: true | ||
spatial_corr: false | ||
speed: false | ||
spike_phase: true | ||
theta_cell: true | ||
theta_skip_cell: false | ||
wave_property: false | ||
parameters: | ||
ang_vel_bin: 10 | ||
ang_vel_cutoff: 10 | ||
ang_vel_kern_len: 3 | ||
ang_vel_max: 200 | ||
ang_vel_min: -200 | ||
ang_vel_rate_kern_len: 3 | ||
border_ang_bin: 3 | ||
border_firing_thresh: 0.1 | ||
border_stair_steps: 5 | ||
burst_thresh: 5 | ||
grad_asymp_lim: 0.25 | ||
grad_displace_lim: 0.25 | ||
grad_growth_rate_lim: 0.5 | ||
grid_ang_bin: 3 | ||
grid_ang_tol: 2 | ||
hd_ang_vel_cutoff: 10 | ||
hd_bin: 5 | ||
hd_rate_kern_len: 5 | ||
hd_shift_max: 10 | ||
hd_shift_min: -10 | ||
hd_shift_step: 1 | ||
hd_shuffle_bins: 100 | ||
hd_shuffle_limit: 0 | ||
hd_shuffle_total: 500 | ||
ibi_thresh: 50 | ||
isiLogLength: 350 | ||
isiLogNoBins: 70 | ||
isi_bin: 1 | ||
isi_corr_bin_long: 1 | ||
isi_corr_bin_short: 1 | ||
isi_corr_len_long: 350 | ||
isi_corr_len_short: 10 | ||
isi_length: 200 | ||
isi_refractory: 2.0 | ||
lfp_prefilt_highcut: 40 | ||
lfp_prefilt_lowcut: 1.5 | ||
lfp_prefilt_order: 5 | ||
lfp_pwelch_freq_max: 40 | ||
lfp_pwelch_nfft: 1024 | ||
lfp_pwelch_overlap: 1.0 | ||
lfp_pwelch_seg_size: 2.0 | ||
lfp_stft_freq_max: 40 | ||
lfp_stft_nfft: 1024 | ||
lfp_stft_overlap: 1.0 | ||
lfp_stft_seg_size: 2.0 | ||
loc_chop_bound: 5 | ||
loc_colormap: viridis | ||
loc_field_smooth: false | ||
loc_field_thresh: 0.2 | ||
loc_pixel_size: 3 | ||
loc_rate_filter: Box | ||
loc_rate_kern_len: 5 | ||
loc_shift_max: 10 | ||
loc_shift_min: -10 | ||
loc_shift_step: 1 | ||
loc_shuffle_limit: 0 | ||
loc_shuffle_nbins: 100 | ||
loc_shuffle_total: 500 | ||
loc_style: contour | ||
mra_episode: 120 | ||
mra_interval: 0.1 | ||
mra_nrep: 1000 | ||
phase_amp_thresh: 0.15 | ||
phase_bin: 7 | ||
phase_freq_max: 12.0 | ||
phase_freq_min: 6.0 | ||
phase_loc_freq_max: 40 | ||
phase_loc_nfft: 640 | ||
phase_loc_win_low: -0.4 | ||
phase_loc_win_up: 0.4 | ||
phase_power_thresh: 0.1 | ||
phase_raster_bin: 2 | ||
rot_corr_bin: 3 | ||
spatial_corr_filter: Box | ||
spatial_corr_kern_len: 5 | ||
spatial_corr_min_obs: 20 | ||
speedKernLen: 3 | ||
speed_bin: 1 | ||
speed_max: 40 | ||
speed_min: 0 | ||
speed_rate_kern_len: 3 | ||
spikesToBurst: 2 | ||
theta_cell_freq_max: 12.0 | ||
theta_cell_freq_min: 6.0 | ||
theta_cell_freq_start: 6.0 | ||
theta_cell_tau1_max: 5.0 | ||
theta_cell_tau1_start: 0.1 | ||
theta_cell_tau2_max: 0.05 | ||
theta_cell_tau2_start: 0.05 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
Use this file to reproduce Figure 6 in the NeuroChaT paper | ||
Please change line 13 to reflect the directory you saved 040512_1.hdf5 in | ||
""" | ||
import os | ||
import numpy as np | ||
from neurochat.nc_data import NData | ||
import neurochat.nc_plot as nc_plot | ||
|
||
|
||
def load_h5_data(): | ||
# Change this to the directory where the file 040513_1.hdf5 is saved | ||
data_dir = r'C:\Users\smartin5\Recordings\NC_eg' | ||
main_file = "040513_1.hdf5" | ||
spike_file = "/processing/Shank/6" | ||
pos_file = "/processing/Behavioural/Position" | ||
lfp_file = "/processing/Neural Continuous/LFP/eeg" | ||
unit_no = 3 | ||
|
||
def m_file(x): return os.path.join(data_dir, main_file + "+" + x) | ||
ndata = NData() | ||
ndata.set_data_format(data_format='NWB') | ||
ndata.set_spatial_file(m_file(pos_file)) | ||
ndata.set_spike_file(m_file(spike_file)) | ||
ndata.set_lfp_file(m_file(lfp_file)) | ||
ndata.load() | ||
ndata.set_unit_no(unit_no) | ||
|
||
return ndata | ||
|
||
|
||
def main(): | ||
ndata = load_h5_data() | ||
graph_data = ndata.place() | ||
fig = nc_plot.loc_firing( | ||
graph_data, style="digitized", colormap="default") | ||
fig.savefig("Figure6a_place.png") | ||
|
||
graph_data = ndata.hd_rate() | ||
figs = nc_plot.hd_firing(graph_data) | ||
figs[1].savefig("Figure6a_hd.png") | ||
|
||
graph_data = ndata.multiple_regression() | ||
fig = nc_plot.multiple_regression(graph_data) | ||
fig.savefig("Figure6b.png") | ||
|
||
graph_data = ndata.loc_shuffle(bins=50) | ||
fig = nc_plot.loc_shuffle(graph_data) | ||
fig.savefig("Figure6c.png") | ||
|
||
graph_data = ndata.loc_shift(shift_ind=np.arange(-10, 21)) | ||
figs = nc_plot.loc_time_shift( | ||
graph_data) | ||
figs[0].savefig("Figure6d.png") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
Use this file to reproduce Figure 8 in the NeuroChaT paper. | ||
Please replace all instances of | ||
C:\\Users\\smartin5\\Recordings\\NC_eg\\ with the folder | ||
that you downloaded 112512_1.hdf5 to | ||
""" | ||
|
||
import os | ||
import logging | ||
from neurochat.nc_config import Configuration | ||
from neurochat.nc_control import NeuroChaT | ||
|
||
|
||
def main(): | ||
nc = NeuroChaT() | ||
config = Configuration() | ||
|
||
root = os.path.dirname(os.path.realpath(__file__)) | ||
name = "Figure8Reproduce.ncfg" | ||
config_loc = os.path.join(root, "Configs", name) | ||
config.set_config_file(config_loc) | ||
config.load_config() | ||
|
||
nc.set_configuration(config) | ||
nc.run() | ||
|
||
excel_file = nc._pdf_file[:-3] + "xlsx" | ||
try: | ||
results = nc.get_results() | ||
results.to_excel(excel_file) | ||
logging.info("Analysis results exported to: " + | ||
excel_file.rstrip("\n\r").split(os.sep)[-1]) | ||
except: | ||
logging.error('Failed to export results!') | ||
|
||
|
||
if __name__ == "__main__": | ||
logging.basicConfig(level=logging.INFO) | ||
mpl_logger = logging.getLogger("matplotlib") | ||
mpl_logger.setLevel(level=logging.WARNING) | ||
main() |