Skip to content

Instantly share code, notes, and snippets.

@h-mayorquin
Created April 4, 2022 07:11
Show Gist options
  • Save h-mayorquin/8c30175a4f80ac9eb44ee4f46f07fe2c to your computer and use it in GitHub Desktop.
Save h-mayorquin/8c30175a4f80ac9eb44ee4f46f07fe2c to your computer and use it in GitHub Desktop.
To run with the profiler.
from pathlib import Path
def run_neuroscope(spikeextractors_backend):
from datetime import datetime
from nwb_conversion_tools import NWBConverter, NeuroscopeRecordingInterface
file_path = Path(
"/home/heberto/globus_data/Buzsaki/TingleyD/DT1/DT1_rLS_20150723_1584um/DT1_rLS_20150723_1584um.dat"
)
file_path = Path("/home/heberto/ephy_testing_data/neuroscope/test1/test1.dat")
stub_test = True
nwbfile_path = str(f"./{file_path.stem}_{stub_test=}_{spikeextractors_backend=}.nwb")
class TestConverter(NWBConverter):
data_interface_classes = dict(NeuroscopeRecording=NeuroscopeRecordingInterface)
conversion_options = dict()
conversion_options.update(
NeuroscopeRecording=dict(stub_test=stub_test, es_key="ElectricalSeries_raw", iterator_opts=dict(buffer_gb=4.0))
)
interface_kwargs = dict(file_path=str(file_path), spikeextractors_backend=spikeextractors_backend)
converter = TestConverter(source_data=dict(NeuroscopeRecording=interface_kwargs))
metadata = converter.get_metadata()
metadata["NWBFile"].update(session_start_time=datetime.now().astimezone().strftime("%Y-%m-%dT%H:%M:%S"))
converter.run_conversion(
nwbfile_path=nwbfile_path, conversion_options=conversion_options, overwrite=True, metadata=metadata
)
if __name__ == "__main__":
spikeextractors_backend = False
run_neuroscope(spikeextractors_backend)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment