Skip to content

Commit

Permalink
add direct fix internal to GUIDE
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyCBakerPhD committed Aug 7, 2024
1 parent 086cb16 commit 88f3e90
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/pyflask/manageNeuroconv/manage_neuroconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from shutil import copytree, rmtree
from typing import Any, Dict, List, Optional, Union

import signature
from pynwb import NWBFile
from tqdm_publisher import TQDMProgressHandler

from .info import (
Expand Down Expand Up @@ -364,6 +366,28 @@ class CustomNWBConverter(NWBConverter):
def temporally_align_data_interfaces(self):
set_interface_alignment(self, alignment_info=alignment_info)

# From previous issue regarding SpikeGLX not generating previews of correct size
def add_to_nwbfile(self, nwbfile: NWBFile, metadata, conversion_options: Optional[dict] = None) -> None:
conversion_options = conversion_options or dict()
for interface_key, data_interface in self.data_interface_objects.items():
if isinstance(data_interface, NWBConverter):
subconverter_kwargs = dict(nwbfile=nwbfile, metadata=metadata)

# Certain subconverters fully expose control over their interfaces conversion options
# (such as iterator options, including progress bar details)
subconverter_keyword_arguments = list(signature(data_interface.add_to_nwbfile).parameters.keys())
if "conversion_options" in subconverter_keyword_arguments:
subconverter_kwargs["conversion_options"] = conversion_options.get(interface_key, None)
# Others do not, and instead expose simplified global keywords similar to a classic interface
else:
subconverter_kwargs.update(conversion_options.get(interface_key, dict()))

data_interface.add_to_nwbfile(**subconverter_kwargs)
else:
data_interface.add_to_nwbfile(
nwbfile=nwbfile, metadata=metadata, **conversion_options.get(interface_key, dict())
)

return CustomNWBConverter


Expand Down

0 comments on commit 88f3e90

Please sign in to comment.