Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 2 additions & 1 deletion src/trodes_to_nwb/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from trodes_to_nwb.convert_dios import add_dios
from trodes_to_nwb.convert_ephys import RecFileDataChunkIterator, add_raw_ephys
from trodes_to_nwb.convert_intervals import add_epochs, add_sample_count
from trodes_to_nwb.convert_optogenetics import add_optogenetics
from trodes_to_nwb.convert_optogenetics import add_optogenetic_epochs, add_optogenetics
from trodes_to_nwb.convert_position import add_associated_video_files, add_position
from trodes_to_nwb.convert_rec_header import (
add_header_device,
Expand Down Expand Up @@ -278,6 +278,7 @@ def _create_nwb(
nwb_file, metadata, session_df, video_directory, convert_video
)
add_optogenetics(nwb_file, metadata, device_metadata)
add_optogenetic_epochs(nwb_file, metadata)

if not behavior_only:
add_electrode_groups(
Expand Down
7 changes: 4 additions & 3 deletions src/trodes_to_nwb/convert_optogenetics.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def add_optogenetics(nwbfile: NWBFile, metadata: dict, device_metadata: List[dic
return

# Add optogenetic experiment metadata

logger.info("Adding optogenetic experiment metadata")
virus, virus_injection = make_virus_injecton(
metadata.get("virus_injection"), device_metadata
)
Expand Down Expand Up @@ -306,11 +306,12 @@ def add_optogenetic_epochs(
file_dir : str, optional
Directory appended to the file path given in the metadata. Default is empty string.
"""

logger = logging.getLogger("convert")
opto_epochs_metadata = metadata.get("fs_gui_yamls", [])
if len(opto_epochs_metadata) == 0:
print("No optogenetic epochs found in metadata.")
logger.info("No optogenetic epochs found in metadata.")
return
logger.info(f"Adding {len(opto_epochs_metadata)} optogenetic epochs.")

from ndx_franklab_novela import FrankLabOptogeneticEpochsTable

Expand Down
Loading