Skip to content

Commit

Permalink
Improve temporally_align_data_interfaces (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson authored Jan 20, 2025
1 parent 2b4112d commit 41f4b9a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
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 @@ -255,7 +255,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 @@ -273,7 +273,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

0 comments on commit 41f4b9a

Please sign in to comment.