Skip to content

Commit 9776684

Browse files
authored
Merge pull request #317 from samuelgarcia/generate_cambridge
Regenerate ASSY-1-P1 and ASSY-1-P2
2 parents 48d759b + 4308e39 commit 9776684

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

resources/generate_cambridgeneurotech_libray.py

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
# work_dir = '/home/samuel/Documents/SpikeInterface/2022-05-20-probeinterface_CambridgeNeurotech/'
5151
# work_dir = '/home/samuel/Documents/SpikeInterface/2022-10-18-probeinterface_CambridgeNeurotech/'
5252
# work_dir = '/home/samuel/OwnCloudCNRS/probeinterface/2023-06-14-probeinterface-CambridgeNeurotech/'
53-
work_dir = '/home/samuel/OwnCloudCNRS/probeinterface/2023-10-30-probeinterface-CambridgeNeurotech/'
53+
# work_dir = '/home/samuel/OwnCloudCNRS/probeinterface/2023-10-30-probeinterface-CambridgeNeurotech/'
54+
work_dir = '/home/samuel/NextcloudCNRS/probeinterface/2025-01-27-probeinterface-CambridgeNeurotech/'
5455

5556

5657
library_folder = '/home/samuel/Documents/SpikeInterface/probeinterface_library/cambridgeneurotech/'
@@ -59,7 +60,7 @@
5960

6061
work_dir = Path(work_dir).absolute()
6162

62-
export_folder = work_dir / 'export_2023_10_30'
63+
export_folder = work_dir / 'export_2025_01_27'
6364
probe_map_file = work_dir / 'ProbeMaps_Final2023.xlsx'
6465
probe_info_table_file = work_dir / 'ProbesDataBase_Final2023.csv'
6566

@@ -112,18 +113,21 @@ def get_contact_order(connector, probe_type):
112113
if probe_type == 'H5' or probe_type == 'H9':
113114
probe_type = 'H5 & H9'
114115

115-
#~ print(df[probe_type])
116+
# print(df[probe_type])
116117
tmpList = []
117118
for i in df[probe_type].columns:
119+
# print('i', i, len(df[probe_type].columns))
118120
if len(df[probe_type].columns) == 1:
119121
tmpList = np.flip(df[probe_type].values.astype(int).flatten())
120122
else:
121123
tmp = df[probe_type][i].values
122124
tmp = tmp[~np.isnan(tmp)].astype(int) # get rid of nan and convert to integer
123125
tmp = np.flip(tmp) # this flips the value to match index that goes from tip to headstage of the probe
126+
# print('tmp', tmp)
124127
tmpList = np.append(tmpList, tmp)
125128
tmpList = tmpList.astype(int)
126129

130+
# print('tmpList', tmpList)
127131
return tmpList
128132

129133

@@ -200,7 +204,7 @@ def create_CN_figure(probe_name, probe):
200204
ax.spines['right'].set_visible(False) #remove external axis
201205
ax.spines['top'].set_visible(False) #remove external axis
202206

203-
ax.set_title('\n' +'CambridgeNeuroTech' +'\n'+ probe.annotations.get('name'), fontsize = 24)
207+
ax.set_title('\n' +'CambridgeNeuroTech' +'\n'+ probe.annotations.get('model_name'), fontsize = 24)
204208

205209
fig.tight_layout() #modif tight layout
206210

@@ -242,6 +246,11 @@ def generate_all_probes():
242246
for i, probe_info in probe_info_table.iterrows():
243247
print(i, probe_info['part'])
244248

249+
# DEBUG
250+
# if not probe_info['part'] in ('P-1', 'P-2'):
251+
# continue
252+
253+
# print(probe_info)
245254

246255
if probe_info['shanks_n'] == 1:
247256
# one shank
@@ -254,16 +263,29 @@ def generate_all_probes():
254263
for connector in list(probe_info[probe_info.index.str.contains('ASSY')].dropna().index):
255264
probe_name = connector+'-'+probe_info['part']
256265

257-
#~ if probe_name != 'ASSY-77-H10':
258-
#~ continue
266+
# DEBUG
267+
# if connector != 'ASSY-1':
268+
# continue
269+
270+
259271
print(' ', probe_name)
260272

261273
contact_order = get_contact_order(connector = connector, probe_type = probe_info['part'])
262274

275+
# print(probe_unordered)
276+
# print(probe_unordered.contact_ids)
277+
# print(contact_order)
278+
# print(probe_unordered.)
279+
# fig, ax = plt.subplots()
280+
# plot_probe(probe_unordered, ax=ax, with_contact_id=True)
281+
# plt.show()
282+
283+
284+
263285
sorted_indices = np.argsort(contact_order)
264286
probe = probe_unordered.get_slice(sorted_indices)
265287

266-
probe.annotate(name=probe_name, manufacturer='cambridgeneurotech')
288+
probe.annotate(model_name=probe_name, manufacturer='cambridgeneurotech')
267289

268290
# one based in cambridge neurotech
269291
contact_ids = np.arange(sorted_indices.size) + 1
@@ -272,6 +294,7 @@ def generate_all_probes():
272294

273295
export_one_probe(probe_name, probe)
274296

297+
# break
275298

276299
def synchronize_library():
277300

@@ -309,6 +332,8 @@ def synchronize_library():
309332

310333
# library_folder
311334

335+
336+
312337
if __name__ == '__main__':
313-
# generate_all_probes()
338+
generate_all_probes()
314339
synchronize_library()

0 commit comments

Comments
 (0)