def _after_load(self, folder): # load probe if (folder / 'probe.json').is_file(): probegroup = read_probeinterface(folder / 'probe.json') other = self.set_probegroup(probegroup) return other else: return self
def _extra_metadata_from_folder(self, folder): # load probe folder = Path(folder) if (folder / 'probe.json').is_file(): probegroup = read_probeinterface(folder / 'probe.json') self.set_probegroup(probegroup, in_place=True) # load time vector if any for segment_index, rs in enumerate(self._recording_segments): time_file = folder / f'times_cached_seg{segment_index}.npy' if time_file.is_file(): time_vector = np.load(time_file) rs.time_vector = time_vector
def test_probeinterface_format(): filename = 'test_pi_format.json' probegroup = generate_dummy_probe_group() write_probeinterface(filename, probegroup) probegroup2 = read_probeinterface(filename) assert len(probegroup.probes) == len(probegroup.probes) for i in range(len(probegroup.probes)): probe0 = probegroup.probes[i] probe1 = probegroup2.probes[i] assert probe0.get_electrode_count() == probe1.get_electrode_count() assert np.allclose(probe0.electrode_positions,probe1.electrode_positions) assert np.allclose(probe0.probe_planar_contour,probe1.probe_planar_contour)
probe0 = generate_dummy_probe(elec_shapes='square') probe1 = generate_dummy_probe(elec_shapes='circle') probe1.move([250, -90]) probegroup = ProbeGroup() probegroup.add_probe(probe0) probegroup.add_probe(probe1) ############################################################################## # With the `write_probeinterface` and `read_probeinterface` functions we can # write to and read from the json-based probeinterface format: write_probeinterface('my_two_probe_setup.json', probegroup) probegroup2 = read_probeinterface('my_two_probe_setup.json') plot_probe_group(probegroup2) ############################################################################## # The format looks like this: with open('my_two_probe_setup.json', mode='r') as f: txt = f.read() print(txt[:600], '...') ############################################################################## # PRB is an historical format introduced by the Klusta team and it is also # used by SpikeInterface, Spyking-circus, and Tridesclous. # The format is in fact a python script that describes a dictionary. # This format handles:
def _extra_metadata_from_folder(self, folder): # load probe folder = Path(folder) if (folder / 'probe.json').is_file(): probegroup = read_probeinterface(folder / 'probe.json') self.set_probegroup(probegroup, in_place=True)