When running the Optotagging Analysis code for the ecephys Neuropixels Visual Coding dataset, as shown in ecephys_optotagging, I run into an error when aligning spikes to light pulses by creating a DataArray. The following block of code returns an error:
trials = session.optogenetic_stimulation_epochs[(session.optogenetic_stimulation_epochs.duration > 0.009) &
(session.optogenetic_stimulation_epochs.duration < 0.02)]
units = session.units[session.units.ecephys_structure_acronym.str.match(‘VIS’)]
time_resolution = 0.0005 # 0.5 ms bins
bin_edges = np.arange(-0.01, 0.025, time_resolution)
def optotagging_spike_counts(bin_edges, trials, units):
time_resolution = np.mean(np.diff(bin_edges))
spike_matrix = np.zeros( (len(trials), len(bin_edges), len(units)) )
for unit_idx, unit_id in enumerate(units.index.values):
spike_times = session.spike_times[unit_id]
for trial_idx, trial_start in enumerate(trials.start_time.values):
in_range = (spike_times > (trial_start + bin_edges[0])) * \
(spike_times < (trial_start + bin_edges[-1]))
binned_times = ((spike_times[in_range] - (trial_start + bin_edges[0])) / time_resolution).astype('int')
spike_matrix[trial_idx, binned_times, unit_idx] = 1
return xr.DataArray(
name='spike_counts',
data=spike_matrix,
coords={
'trial_id': trials.index.values,
'time_relative_to_stimulus_onset': bin_edges,
'unit_id': units.index.values
},
dims=['trial_id', 'time_relative_to_stimulus_onset', 'unit_id']
)
da = optotagging_spike_counts(bin_edges, trials, units)
The code above returns the following error:
PermissionError: [Errno 13] Permission denied: ‘/overflow/NSCI274/projects/ecephysdata/session_829720705/session_829720705_analysis_metrics.csv’
When I looked through my ecephys data folder that was downloaded from the Allen Institute, none of the session folders contained a session analysis metrics csv file. My session folders only contain an nwb file. How can I download the session analysis metrics csv files and/or gain permission to access them?