Skip to content

Commit 7ab25ca

Browse files
committed
Merge remote-tracking branch 'origin/atlas_xyz2i' into atlas_xyz2i
2 parents d6a6392 + 3b51602 commit 7ab25ca

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

brainbox/io/one.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ def _load_channel_locations_traj(eid, probe=None, one=None, revision=None, align
334334
# get the channels from histology tracing
335335
xyz = xyz[np.argsort(xyz[:, 2]), :]
336336
chans = histology.interpolate_along_track(xyz, (depths + TIP_SIZE_UM) / 1e6)
337-
338337
channels[probe] = _channels_traj2bunch(chans, brain_atlas)
339338
source = 'traced'
340339
channels[probe]['axial_um'] = chn_coords[:, 1]
@@ -894,6 +893,7 @@ class SpikeSortingLoader:
894893
collection: str = ''
895894
histology: str = '' # 'alf', 'resolved', 'aligned' or 'traced'
896895
spike_sorting_path: Path = None
896+
_sync: dict = None
897897

898898
def __post_init__(self):
899899
# pid gets precedence
@@ -1039,3 +1039,20 @@ def url(self):
10391039
"""Gets flatiron URL for the session"""
10401040
webclient = getattr(self.one, '_web_client', None)
10411041
return webclient.rel_path2url(get_alf_path(self.session_path)) if webclient else None
1042+
1043+
def samples2times(self, values, direction='forward'):
1044+
"""
1045+
:param values: numpy array of times in seconds or samples to resync
1046+
:param direction: 'forward' (samples probe time to seconds main time) or 'reverse'
1047+
(seconds main time to samples probe time)
1048+
:return:
1049+
"""
1050+
if self._sync is None:
1051+
timestamps = self.one.load_dataset(
1052+
self.eid, dataset='_spikeglx_*.timestamps.npy', collection=f'raw_ephys_data/{self.pname}')
1053+
self._sync = {
1054+
'timestamps': timestamps,
1055+
'forward': interp1d(timestamps[:, 0], timestamps[:, 1], fill_value='extrapolate'),
1056+
'reverse': interp1d(timestamps[:, 1], timestamps[:, 0], fill_value='extrapolate'),
1057+
}
1058+
return self._sync[direction](values)

ibllib/ephys/neuropixel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
', change your imports to neuropixel !', DeprecationWarning)
99

1010
from neuropixel import * # noqa
11+
from neuropixel import SITES_COORDINATES # noqa

ibllib/plots/figures.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -478,16 +478,16 @@ def gain2level(gain):
478478
if plot_backend == 'matplotlib':
479479
_, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [.95, .05]}, figsize=(16, 9))
480480
eqcs.append(Density(butt, fs=fs, taxis=1, ax=axs[0], title='highpass', vmin=eqc_levels[0], vmax=eqc_levels[1],
481-
cmap='Greys'))
481+
cmap='Greys-r'))
482482

483483
if destripe:
484484
dest = voltage.destripe(raw, fs=fs, channel_labels=channel_labels)
485485
_, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [.95, .05]}, figsize=(16, 9))
486486
eqcs.append(Density(dest, fs=fs, taxis=1, ax=axs[0], title='destripe', vmin=eqc_levels[0], vmax=eqc_levels[1],
487-
cmap='Greys'))
487+
cmap='Greys-r'))
488488
_, axs = plt.subplots(1, 2, gridspec_kw={'width_ratios': [.95, .05]}, figsize=(16, 9))
489489
eqcs.append(Density((butt - dest), fs=fs, taxis=1, ax=axs[0], title='difference', vmin=eqc_levels[0],
490-
vmax=eqc_levels[1], cmap='Greys'))
490+
vmax=eqc_levels[1], cmap='Greys-r'))
491491

492492
for eqc in eqcs:
493493
y, x = np.meshgrid(ioutside, np.linspace(0, rl * 1e3, 500))
@@ -618,7 +618,7 @@ def raw_destripe(raw, fs, t0, i_plt, n_plt,
618618
Tplot = Xs.shape[1] / fs
619619

620620
# PLOT RAW DATA
621-
d = Density(-Xs, fs=fs, taxis=1, ax=axs[i_plt], vmin=MIN_X, vmax=MAX_X, cmap='Greys') # noqa
621+
d = Density(-Xs, fs=fs, taxis=1, ax=axs[i_plt], vmin=MIN_X, vmax=MAX_X, cmap='Greys-r') # noqa
622622
axs[i_plt].set_ylabel('')
623623
axs[i_plt].set_xlim((0, Tplot * 1e3))
624624
axs[i_plt].set_ylim((0, nc))

0 commit comments

Comments
 (0)