Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EDF #239

Merged
merged 8 commits into from
Oct 17, 2023
Merged

Add EDF #239

merged 8 commits into from
Oct 17, 2023

Conversation

garrettmflynn
Copy link
Member

Add the EDFRecordingInterface to the list of accepted interfaces.

@garrettmflynn garrettmflynn self-assigned this Jul 12, 2023
@garrettmflynn garrettmflynn changed the base branch from main to biocam July 12, 2023 22:45
Base automatically changed from biocam to neuroscope-sorting July 14, 2023 17:56
Base automatically changed from neuroscope-sorting to main August 4, 2023 04:45
@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn Do you run into any errors regarding file I/O when you reach the final step using this interface? Just checking if it's platform dependent

@garrettmflynn
Copy link
Member Author

I can't get past the GuidedSourceData page because of the following issue:

cannot import name 'Tester' from 'numpy.testing'

@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn Interesting... does that happen if you regenerate a fresh conda environment?

@garrettmflynn
Copy link
Member Author

Ah I see what you got now. For some reason, clicking the Run Conversion button again allowed me to go through.

I'd seen this issue before because I forgot to add io.close() after reading the HTML representation—but I thought I got rid of it.

Oddly enough, I also saw the same issue—though temporary—when I went back to the Source Data and tried to request the metadata again:

Traceback (most recent call last):
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/apis/apiNeuroConv.py", line 65, in post
    return get_metadata_schema(api.payload.get("source_data"), api.payload.get("interfaces"))
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 128, in get_metadata_schema
    converter = instantiate_custom_converter(source_data, interfaces)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 90, in instantiate_custom_converter
    return CustomNWBConverter(source_data)
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/neuroconv/nwbconverter.py", line 65, in __init__
    self.data_interface_objects = {
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/neuroconv/nwbconverter.py", line 66, in <dictcomp>
    name: data_interface(**source_data[name])
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/neuroconv/datainterfaces/ecephys/edf/edfdatainterface.py", line 37, in __init__
    super().__init__(file_path=file_path, verbose=verbose, es_key=es_key)
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/neuroconv/datainterfaces/ecephys/baserecordingextractorinterface.py", line 32, in __init__
    self.recording_extractor = self.get_extractor()(**source_data)
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/edf.py", line 33, in __init__
    NeoBaseRecordingExtractor.__init__(
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 185, in __init__
    _NeoBaseExtractor.__init__(self, block_index, **neo_kwargs)
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 25, in __init__
    self.neo_reader = self.get_neo_io_reader(self.NeoRawIOClass, **neo_kwargs)
  File "/opt/anaconda3/envs/nwb-guide-edf/lib/python3.9/site-packages/spikeinterface/extractors/neoextractors/neobaseextractor.py", line 64, in get_neo_io_reader
    neo_reader.parse_header()
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/neo/rawio/baserawio.py", line 179, in parse_header
    self._parse_header()
  File "/opt/anaconda3/envs/env-electron-python/lib/python3.9/site-packages/neo/rawio/edfrawio.py", line 70, in _parse_header
    self.edf_reader = EdfReader(self.filename)
  File "pyedflib/_extensions/_pyedflib.pyx", line 146, in pyedflib._extensions._pyedflib.CyEdfReader.__init__
  File "pyedflib/_extensions/_pyedflib.pyx", line 209, in pyedflib._extensions._pyedflib.CyEdfReader.open
  File "pyedflib/_extensions/_pyedflib.pyx", line 181, in pyedflib._extensions._pyedflib.CyEdfReader.check_open_ok
OSError: /Users/garrettflynn/Desktop/GUIDE/ephy_testing_data/edf/edf+C.edf: file has already been opened```

Base automatically changed from accidental_push_to_main to main August 19, 2023 00:25
@CodyCBakerPhD CodyCBakerPhD marked this pull request as draft August 21, 2023 15:32
@CodyCBakerPhD
Copy link
Collaborator

Moving to draft until further investigation and possible fix is found

@garrettmflynn garrettmflynn added the interface Add support for a specific NeuroConv interface / converter label Sep 28, 2023
@garrettmflynn
Copy link
Member Author

garrettmflynn commented Oct 17, 2023

@CodyCBakerPhD Just tested this again. I can run a successful conversion with an .edf file—so we could push ahead with this and transfer to an issue.

Upon further testing, it seems that the conversion script releases the file some time after returning (on the order of 3-5s). So this is a temporary hold-up, and only if the user goes back to the Source Data page immediately after previewing / converting.

@CodyCBakerPhD
Copy link
Collaborator

Ohhhh, huh... right you are

Just waiting 4-5 seconds clears it up. How weird

@CodyCBakerPhD CodyCBakerPhD marked this pull request as ready for review October 17, 2023 22:52
@CodyCBakerPhD CodyCBakerPhD merged commit 3e9d749 into main Oct 17, 2023
7 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the edf branch October 17, 2023 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interface Add support for a specific NeuroConv interface / converter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants