Skip to content

Create converters module and prototype converter for Aeon Bonsai (Sumiya) #534

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JoeZiminski
Copy link
Member

This PR begins to add structure for converter for non-NeuroBlueprint formats into NeuroBlueprint, and adds a converter for Bonsai Aeon format that Sumiya is using.

The idea is to create something general and customizable, that we can also extend to have 'default' converters (e.g. from ONE). For writing customizable converters, the (suggested, not currently fixed) approach is to have a format where the converter must be in a python file and be called convterer_func(project) which takes the datashuttle project. Then the writer can search the project for files to converter, create the folders and do the conversion.

This can be trick in some cases because we want to handle a project that is part NeuroBlueprint, part non-NeuroBlueprint. In this case, data is collected in Aeon bonsai. We want to convert it to NeuroBlueprint, then transfer it. The next day, more data will be written in Aeon Bonsai format for conversion. So the converter needs to be able to determine whether the recent Aeon Bonsai file belongs to an existing subject or not (if it does, then the session must be added to this existing subject).
A new function get_sub_names_from_key_value_pair is introduced for this, and can be used alongside the existing project.get_next_sub() and project.get_next_ses().

The workflow is to call project.convert(path_to_module). The function will load the passed module, and run the converter_func() function. It will also initialise logging, and within the conveter function the user can log with project.log_and_message() or project.log_and_raise_error() which are now exposed on the datashuttle class.

Testing this PR

This PR is still in a prototyping phase. Sumiya if you'd like to test this out, you can run the datashuttle/converters/run_convert_sumiya.py script and it will try and convert any folders in /datashuttle/converters/example_project.
The main script that does the conversion and is passed to project.convert() is /datashuttle/converters/convert_sumiya.py. Just to play around you can run this directly.

However, feel free to move it and we can work on it elsewhere e.g. on vr-abcd, whatever is most convenient. Eventually on the datashuttle side, we will probably expose only the project.convert() function to allow any user to insert their convter of choice (and down the line provide only a few default converters e.g. to/from BIDS. Otherwise if it's easier, we can use this PR for prototype and test the Aeon converter function and remove it right at the end.

TODO

  • tidy up TODOs on the PR
  • write extensive tests for the Aeon-bonsai converter
  • tidy up and document datashuttle-side functions and test
  • add this to TUI

@JoeZiminski JoeZiminski changed the title Create conveters module and add convter for Aeon Bonsai (Sumiya) Create conveters module and prototype converter for Aeon Bonsai (Sumiya) Jun 27, 2025
@JoeZiminski JoeZiminski changed the title Create conveters module and prototype converter for Aeon Bonsai (Sumiya) Create converters module and prototype converter for Aeon Bonsai (Sumiya) Jul 3, 2025
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.

1 participant