Skip to content

Commit 1a2ce76

Browse files
olichemayofaulknerk1o0mschart
authored
Atlas remap (#29)
* save all plots option, new pyqtgraph version changes * define save path of plots * save overview plots from GUI * save improvements, deal with sessions without no track * Removed video from repo * catch sessions with no data; attempt to fix c++ wrapper error * make compatible with latest pyqtgraph * Update DLC_labeled_video.py * update requirements * fix c++ wrapper deleted error * Atlas3 d features (#23) * add scatter feature * option to add region colour values * option for adding scatter plot and also heatmap over regions on slices * temporarily add sample data * double click bugfix * dual layers with alpha mapping * colored regions Co-authored-by: Mayo Faulkner <[email protected]> * Update DLC_labeled_video.py (#22) * update requirements, make save plot compatible with offline * add one setup to travis * add flatiron pass * fix import and flake * Added freeze trigger times and return QC obj * update extract_files to compute metrics * add passive plots to GUI * update experimenter evaluation to probe insertion json in alyx * passive stuff * fix bug propagating alignments when starting from 'original' * add user evaluation tests * prepare string for dj and alyx * task_qc_viewer: update doc * task_qc_viewer: update doc * only add passive to menu if it exists * remove flags * correct path for passive data, filter passive based on units * remove clusters.metrics.csv if it exists locally * flake * catch for nans in spikes.amps * sync incomplete time series * brain regions aggregation mappings * brain regions aggregation mappings (2/2) Co-authored-by: Mayo Faulkner <[email protected]> Co-authored-by: Miles Wells <[email protected]> Co-authored-by: mschart <[email protected]>
1 parent 32d6f7c commit 1a2ce76

23 files changed

+1059
-241
lines changed

.flake8

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,7 @@ exclude =
55
.git,
66
__pycache__,
77
__init__.py,
8-
data_expoloration_gui/
9-
dlc/
8+
data_exploration_gui/
109
launch_phy/
1110
histology/
12-
13-
tutorial_script.py,
14-
venv,
15-
test_imports.py,
16-
build,
17-
dist
18-
brainbox/
11+
qt_matplotlib.py

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ install:
99
- pip install git+https://github.com/int-brain-lab/ibllib.git@develop
1010

1111
# command to run tests
12+
before_script:
13+
- echo "exec('from oneibl.one import ONE; ONE(silent=True)')" | python
14+
- sed -i 's|null|"'$IBLFLATIRONPASS'"|g' /home/travis/.one_params
15+
# command to run tests
16+
1217
script:
1318
- bash ./run_tests
1419
- flake8 .

atlaselectrophysiology/ColorBar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, cmap_name, cbin=256, parent=None):
1717
colors = (cmap(cbins)[np.newaxis, :, :3][0]).tolist()
1818
else:
1919
colors = cmap.colors
20-
colors = [c + [1.] for c in colors]
20+
colors = [(np.array(c) * 255).astype(int).tolist() + [255.] for c in colors]
2121
positions = np.linspace(0, 1, len(colors))
2222
self.map = pg.ColorMap(positions, colors)
2323
self.lut = self.map.getLookupTable()
@@ -30,6 +30,7 @@ def makeColourBar(self, width, height, fig, min=0, max=1, label='', lim=False):
3030
self.cbar = HorizontalBar(width, height, self.grad)
3131
ax = fig.getAxis('top')
3232
ax.setPen('k')
33+
ax.setTextPen('k')
3334
ax.setStyle(stopAxisAtTick=((True, True)))
3435
# labelStyle = {'font-size': '8pt'}
3536
ax.setLabel(label)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import matplotlib.pyplot as plt
2+
from pathlib import Path
3+
import glob
4+
5+
6+
def make_overview_plot(folder, sess_info):
7+
8+
image_folder = folder
9+
image_info = sess_info
10+
11+
def load_image(image_name, ax):
12+
with image_name as ifile:
13+
image = plt.imread(ifile)
14+
15+
ax.spines['right'].set_visible(False)
16+
ax.spines['top'].set_visible(False)
17+
ax.spines['left'].set_visible(False)
18+
ax.spines['bottom'].set_visible(False)
19+
ax.set_axis_off()
20+
ax.set_aspect('equal')
21+
ax.imshow(image)
22+
return image
23+
24+
fig = plt.figure(constrained_layout=True, figsize=(18, 9))
25+
gs = fig.add_gridspec(3, 18)
26+
gs.update(wspace=0.025, hspace=0.05)
27+
28+
img_row_order = [0, 0, 0, 0, 0, 0, 1, 1, 1]
29+
img_column_order = [0, 3, 6, 9, 12, 15, 0, 3, 6]
30+
img_idx = [0, 5, 4, 6, 7, 8, 1, 2, 3]
31+
img_files = glob.glob(str(image_folder.joinpath(image_info + 'img_*.png')))
32+
img_files_sort = [img_files[idx] for idx in img_idx]
33+
34+
for iF, file in enumerate(img_files_sort):
35+
ax = fig.add_subplot(gs[img_row_order[iF], img_column_order[iF]:img_column_order[iF] + 3])
36+
load_image(Path(file), ax)
37+
38+
probe_row_order = [1, 1, 1, 1, 1, 1, 2, 2, 2]
39+
probe_column_order = [9, 10, 11, 12, 13, 14, 12, 13, 14]
40+
probe_idx = [0, 3, 1, 2, 4, 5, 6]
41+
probe_files = glob.glob(str(image_folder.joinpath(image_info + 'probe_*.png')))
42+
probe_files_sort = [probe_files[idx] for idx in probe_idx]
43+
line_files = glob.glob(str(image_folder.joinpath(image_info + 'line_*.png')))
44+
45+
for iF, file in enumerate(probe_files_sort + line_files):
46+
ax = fig.add_subplot(gs[probe_row_order[iF], probe_column_order[iF]])
47+
load_image(Path(file), ax)
48+
49+
slice_files = glob.glob(str(image_folder.joinpath(image_info + 'slice_*.png')))
50+
slice_row_order = [2, 2, 2, 2]
51+
slice_idx = [0, 1, 2, 3]
52+
slice_column_order = [0, 3, 6, 9]
53+
slice_files_sort = [slice_files[idx] for idx in slice_idx]
54+
55+
for iF, file in enumerate(slice_files_sort):
56+
ax = fig.add_subplot(gs[slice_row_order[iF],
57+
slice_column_order[iF]:slice_column_order[iF] + 3])
58+
load_image(Path(file), ax)
59+
60+
slice_files = glob.glob(str(image_folder.joinpath(image_info + 'slice_zoom*.png')))
61+
slice_row_order = [2, 2, 2, 2]
62+
slice_idx = [0, 1, 2, 3]
63+
slice_column_order = [2, 5, 8, 11]
64+
slice_files_sort = [slice_files[idx] for idx in slice_idx]
65+
66+
for iF, file in enumerate(slice_files_sort):
67+
ax = fig.add_subplot(gs[slice_row_order[iF], slice_column_order[iF]])
68+
load_image(Path(file), ax)
69+
70+
hist_files = glob.glob(str(image_folder.joinpath(image_info + 'hist*.png')))
71+
for iF, file in enumerate(hist_files):
72+
ax = fig.add_subplot(gs[1:3, 15:18])
73+
load_image(Path(file), ax)
74+
75+
ax.text(0.5, 0, image_info[:-1], va="center", ha="center", transform=ax.transAxes)
76+
77+
plt.savefig(image_folder.joinpath(image_info + "overview.png"),
78+
bbox_inches='tight', pad_inches=0)
79+
plt.show()

0 commit comments

Comments
 (0)