Skip to content

Commit 405a2eb

Browse files
committed
prepare string for dj and alyx
1 parent 7f499e8 commit 405a2eb

File tree

2 files changed

+13
-41
lines changed

2 files changed

+13
-41
lines changed

atlaselectrophysiology/load_data.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,21 @@ def upload_dj(self, align_qc, ephys_qc, ephys_desc):
402402
# Upload qc results to datajoint table
403403
user = self.one._par.ALYX_LOGIN
404404
if len(ephys_desc) == 0:
405-
ephys_desc_str = None
405+
ephys_desc_str = 'None'
406+
ephys_dj_str = None
406407
else:
407408
ephys_desc_str = ", ".join(ephys_desc)
409+
ephys_dj_str = ephys_desc_str
408410

409-
#self.qc.insert1(dict(probe_insertion_uuid=self.probe_id, user_name=user,
410-
# alignment_qc=align_qc, ephys_qc=ephys_qc, ephys_qc_description=ephys_desc),
411-
# allow_direct_insert=True, replace=True)
411+
self.qc.insert1(dict(probe_insertion_uuid=self.probe_id, user_name=user,
412+
alignment_qc=align_qc, ephys_qc=ephys_qc,
413+
ephys_qc_description=ephys_dj_str),
414+
allow_direct_insert=True, replace=True)
412415
self.alyx_str = ephys_qc.upper() + ': ' + ephys_desc_str
413416

414417

415418
def update_qc(self, upload_alyx=True, upload_flatiron=True):
416419
# if resolved just update the alignment_number
417-
upload_flatiron=False
418420
align_qc = AlignmentQC(self.probe_id, one=self.one, brain_atlas=self.brain_atlas)
419421
align_qc.load_data(prev_alignments=self.alignments, xyz_picks=self.xyz_picks,
420422
depths=self.chn_depths, cluster_chns=self.cluster_chns)

atlaselectrophysiology/plot_data.py

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -517,42 +517,12 @@ def get_passive_events(self):
517517
base_stim = 1
518518
pre_stim = 0.4
519519
post_stim = 1
520-
stim_events = passive.get_stim_aligned_activity(stims, self.spikes['times'][self.spike_idx][self.kp_idx],
521-
self.spikes['depths'][self.spike_idx][self.kp_idx],
522-
pre_stim=pre_stim,post_stim=post_stim, base_stim=base_stim)
523-
524-
#T_BIN = 0.01
525-
#D_BIN = 20
526-
#base_stim = 1
527-
#pre_stim = 0.4
528-
#post_stim = 1
529-
#n_bins = int((pre_stim + post_stim) / T_BIN)
530-
#n_bins_base = int(np.ceil((base_stim - pre_stim) / T_BIN))
531-
#R, times, depths = bincount2D(self.spikes['times'][self.spike_idx][self.kp_idx],
532-
# self.spikes['depths'][self.spike_idx][self.kp_idx],
533-
# T_BIN, D_BIN, ylim=[0, np.max(self.chn_coords[:, 1])])
534-
#
535-
#for stim_type in stim_types:
536-
#
537-
# stim_times = stims[stim_type]
538-
# stim_intervals = np.c_[stim_times - pre_stim, stim_times + post_stim]
539-
# base_intervals = np.c_[stim_times - base_stim, stim_times - pre_stim]
540-
# idx_stim = np.searchsorted(times, stim_intervals)
541-
# idx_base = np.searchsorted(times, base_intervals)
542-
#
543-
# stim_trials = np.zeros((depths.shape[0], n_bins, idx_stim.shape[0]))
544-
# noise_trials = np.zeros((depths.shape[0], n_bins_base, idx_stim.shape[0]))
545-
# for i, (st, ba) in enumerate(zip(idx_stim, idx_base)):
546-
# stim_trials[:, :, i] = R[:, st[0]:st[1]]
547-
# noise_trials[:, :, i] = R[:, ba[0]:ba[1]]
548-
#
549-
# # Average across trials
550-
# avg_stim_trials = np.mean(stim_trials, axis=2)
551-
# # Average across trials and time
552-
# avg_base_trials = np.mean(np.mean(noise_trials, axis=2), axis=1)[:, np.newaxis]
553-
# std_base_trials = np.std(np.mean(noise_trials, axis=2), axis=1)[:, np.newaxis]
554-
# z_score = (avg_stim_trials - avg_base_trials) / std_base_trials
555-
# z_score[np.isnan(z_score)] = 0
520+
stim_events = passive.get_stim_aligned_activity(stims, self.spikes['times'][self.spike_idx]
521+
[self.kp_idx], self.spikes['depths']
522+
[self.spike_idx][self.kp_idx],
523+
pre_stim=pre_stim, post_stim=post_stim,
524+
base_stim=base_stim)
525+
556526
for stim_type, z_score in stim_events.items():
557527
xscale = (post_stim + pre_stim)/z_score.shape[1]
558528
yscale = ((np.max(self.chn_coords[:, 1]) - np.min(self.chn_coords[:, 1]))

0 commit comments

Comments
 (0)