Skip to content

Commit

Permalink
moved get_start_datetime to convert_session
Browse files Browse the repository at this point in the history
  • Loading branch information
pauladkisson committed Dec 9, 2024
1 parent d74a9d6 commit 3e23fd0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/jadhav_lab_to_nwb/olson_2024/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .olson_2024_sorting_interface import Olson2024SortingInterface
from .olson_2024_spike_gadgets_lfp_interface import Olson2024SpikeGadgetsLFPInterface
from .olson_2024_epoch_interface import Olson2024EpochInterface
from .olson_2024_nwbconverter import Olson2024NWBConverter, get_start_datetime
from .olson_2024_nwbconverter import Olson2024NWBConverter
20 changes: 19 additions & 1 deletion src/jadhav_lab_to_nwb/olson_2024/olson_2024_convert_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,25 @@
) # TODO: remove after this issue gets fixed: https://github.com/catalystneuro/neuroconv/issues/1143
from neuroconv.utils import load_dict_from_file, dict_deep_update

from jadhav_lab_to_nwb.olson_2024 import Olson2024NWBConverter, get_start_datetime
from jadhav_lab_to_nwb.olson_2024 import Olson2024NWBConverter


def get_start_datetime(epoch_folder_name: str) -> datetime:
"""Get the start datetime of the epoch from the folder name.
Parameters
----------
epoch_folder_path : pathlib.Path
The path to the epoch folder.
Returns
-------
datetime.datetime
The start datetime of the epoch.
"""
split_name = epoch_folder_name.split("_")
start_datetime = datetime.strptime(split_name[-2] + "_" + split_name[-1], "%Y%m%d_%H%M%S")
return start_datetime


def session_to_nwb(
Expand Down
18 changes: 0 additions & 18 deletions src/jadhav_lab_to_nwb/olson_2024/olson_2024_nwbconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,3 @@ class Olson2024NWBConverter(NWBConverter):
Behavior=Olson2024BehaviorInterface,
Epoch=Olson2024EpochInterface,
)


def get_start_datetime(epoch_folder_name: str) -> datetime:
"""Get the start datetime of the epoch from the folder name.
Parameters
----------
epoch_folder_path : pathlib.Path
The path to the epoch folder.
Returns
-------
datetime.datetime
The start datetime of the epoch.
"""
split_name = epoch_folder_name.split("_")
start_datetime = datetime.strptime(split_name[-2] + "_" + split_name[-1], "%Y%m%d_%H%M%S")
return start_datetime

0 comments on commit 3e23fd0

Please sign in to comment.