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

Allow Non-Compliant JSON (e.g. NaN values) #374

Closed
wants to merge 6 commits into from

Conversation

garrettmflynn
Copy link
Member

@garrettmflynn garrettmflynn commented Sep 18, 2023

fix catalystneuro/neuroconv#515

This PR will prepare us to accept NaN values passed back as metadata from the Ophys interfaces.

@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn Should we try one ophys interface branched from this before merging? Or just take the dive

@garrettmflynn
Copy link
Member Author

Yeah worth the test. I'll see if Bruker loads, since that was the interface noted in the related Bug.

@garrettmflynn
Copy link
Member Author

@CodyCBakerPhD Any idea why this would happen?

[2023-09-18 11:18:15,008] ERROR in app: Exception on /neuroconv/metadata [POST]
Traceback (most recent call last):
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/api.py", line 404, in wrapper
    resp = resource(*args, **kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask/views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/flask_restx/resource.py", line 46, in dispatch_request
    resp = meth(*args, **kwargs)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/apis/neuroconv.py", line 70, in post
    return get_metadata_schema(neuroconv_api.payload.get("source_data"), neuroconv_api.payload.get("interfaces"))
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 117, in get_metadata_schema
    converter = instantiate_custom_converter(source_data, interfaces)
  File "/Users/garrettflynn/Documents/Github/nwb-guide/pyflask/manageNeuroconv/manage_neuroconv.py", line 80, in instantiate_custom_converter
    return CustomNWBConverter(source_data)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/nwbconverter.py", line 65, in __init__
    self.data_interface_objects = {
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/nwbconverter.py", line 66, in <dictcomp>
    name: data_interface(**source_data[name])
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/datainterfaces/ophys/brukertiff/brukertiffdatainterface.py", line 29, in __init__
    super().__init__(folder_path=folder_path, verbose=verbose)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/datainterfaces/ophys/baseimagingextractorinterface.py", line 25, in __init__
    self.imaging_extractor = self.get_extractor()(**source_data)
  File "/opt/anaconda3/envs/nwb-guide/lib/python3.10/site-packages/neuroconv/baseextractorinterface.py", line 25, in get_extractor
    extractor = getattr(
AttributeError: module 'roiextractors' has no attribute 'BrukerTiffImagingExtractor'

@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn Fresh conda environment? Are you using latest pip install -U roiextractors?

@CodyCBakerPhD
Copy link
Collaborator

@garrettmflynn I'm guessing a version mismatch between neuroconv and roiextractors here, these names were changed somewhat recently

The interface should be BrukerTiffSinglePlaneImagingInterface which uses the BrukerTiffSinglePlaneImagingExtractor which should be available with latest of both packages

@garrettmflynn
Copy link
Member Author

Okay sure. It prompted me to install roiextractors manually, so I likely have an outdated environment

@garrettmflynn
Copy link
Member Author

Correcting for #376, this works great.

@garrettmflynn
Copy link
Member Author

Replaced with #393

@CodyCBakerPhD CodyCBakerPhD deleted the noncompliant-json branch March 13, 2024 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Non-compliant JSON allowed through NWBMetadataEncoder
2 participants