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

Improve temporally_align_data_interfaces #1162

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
## Bug Fixes

## Features
* Added `metadata` and `conversion_options` as arguments to `NWBConverter.temporally_align_data_interfaces` [PR #1162](https://github.com/catalystneuro/neuroconv/pull/1162)

## Improvements

Expand Down
6 changes: 4 additions & 2 deletions src/neuroconv/nwbconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def run_conversion(
self.validate_metadata(metadata=metadata, append_mode=append_mode)
self.validate_conversion_options(conversion_options=conversion_options)

self.temporally_align_data_interfaces()
self.temporally_align_data_interfaces(metadata=metadata, conversion_options=conversion_options)

with make_or_load_nwbfile(
nwbfile_path=nwbfile_path,
Expand All @@ -274,7 +274,9 @@ def run_conversion(

configure_backend(nwbfile=nwbfile_out, backend_configuration=backend_configuration)

def temporally_align_data_interfaces(self):
def temporally_align_data_interfaces(
self, metadata: Optional[dict] = None, conversion_options: Optional[dict] = None
):
"""Override this method to implement custom alignment."""
pass

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from pathlib import Path
from shutil import rmtree
from tempfile import mkdtemp
from typing import Dict, Union
from typing import Dict, Optional, Union

import numpy as np
from hdmf.testing import TestCase
Expand Down Expand Up @@ -186,7 +186,9 @@ class TestAlignmentConverter(NWBConverter):
NIDQ=MockSpikeGLXNIDQInterface, Trials=CsvTimeIntervalsInterface, Behavior=MockBehaviorEventInterface
)

def temporally_align_data_interfaces(self):
def temporally_align_data_interfaces(
self, metadata: Optional[dict] = None, conversion_options: Optional[dict] = None
):
unaligned_trial_start_times = self.data_interface_objects["Trials"].get_original_timestamps(
column="start_time"
)
Expand Down
Loading