Skip to content

Commit

Permalink
Merge branch 'main' into add_write_timestamps_to_imaging
Browse files Browse the repository at this point in the history
  • Loading branch information
h-mayorquin authored Nov 7, 2024
2 parents cb57c06 + cbf68d4 commit d59c19d
Show file tree
Hide file tree
Showing 14 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from neuroconv.utils import (
DeepDict,
dict_deep_update,
get_schema_from_method_signature,
get_json_schema_from_method_signature,
)


Expand All @@ -24,7 +24,7 @@ class LightningPoseConverter(NWBConverter):

@classmethod
def get_source_schema(cls):
return get_schema_from_method_signature(cls)
return get_json_schema_from_method_signature(cls)

@validate_call
def __init__(
Expand Down Expand Up @@ -71,7 +71,7 @@ def __init__(
self.data_interface_objects.update(dict(LabeledVideo=VideoInterface(file_paths=[labeled_video_file_path])))

def get_conversion_options_schema(self) -> dict:
conversion_options_schema = get_schema_from_method_signature(
conversion_options_schema = get_json_schema_from_method_signature(
method=self.add_to_nwbfile, exclude=["nwbfile", "metadata"]
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....basedatainterface import BaseDataInterface
from ....tools.nwb_helpers import get_module
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class AxonaRecordingInterface(BaseRecordingExtractorInterface):
Expand Down Expand Up @@ -186,7 +186,7 @@ class AxonaPositionDataInterface(BaseDataInterface):

@classmethod
def get_source_schema(cls) -> dict:
return get_schema_from_method_signature(cls.__init__)
return get_json_schema_from_method_signature(cls.__init__)

def __init__(self, file_path: str):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .header_tools import _parse_nev_basic_header, _parse_nsx_basic_header
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ..basesortingextractorinterface import BaseSortingExtractorInterface
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class BlackrockRecordingInterface(BaseRecordingExtractorInterface):
Expand All @@ -19,7 +19,7 @@ class BlackrockRecordingInterface(BaseRecordingExtractorInterface):

@classmethod
def get_source_schema(cls):
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["block_index", "seg_index"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["block_index", "seg_index"])
source_schema["properties"]["file_path"][
"description"
] = "Path to the Blackrock file with suffix being .ns1, .ns2, .ns3, .ns4m .ns4, or .ns6."
Expand Down Expand Up @@ -85,7 +85,7 @@ class BlackrockSortingInterface(BaseSortingExtractorInterface):

@classmethod
def get_source_schema(cls) -> dict:
metadata_schema = get_schema_from_method_signature(method=cls.__init__)
metadata_schema = get_json_schema_from_method_signature(method=cls.__init__)
metadata_schema["additionalProperties"] = True
metadata_schema["properties"]["file_path"].update(description="Path to Blackrock .nev file.")
return metadata_schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from pydantic import DirectoryPath

from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class OpenEphysBinaryRecordingInterface(BaseRecordingExtractorInterface):
Expand All @@ -29,7 +29,7 @@ def get_stream_names(cls, folder_path: DirectoryPath) -> list[str]:
@classmethod
def get_source_schema(cls) -> dict:
"""Compile input schema for the RecordingExtractor."""
source_schema = get_schema_from_method_signature(
source_schema = get_json_schema_from_method_signature(
method=cls.__init__, exclude=["recording_id", "experiment_id", "stub_test"]
)
source_schema["properties"]["folder_path"][
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pydantic import DirectoryPath, validate_call

from ..basesortingextractorinterface import BaseSortingExtractorInterface
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class OpenEphysSortingInterface(BaseSortingExtractorInterface):
Expand All @@ -14,7 +14,7 @@ class OpenEphysSortingInterface(BaseSortingExtractorInterface):
@classmethod
def get_source_schema(cls) -> dict:
"""Compile input schema for the SortingExtractor."""
metadata_schema = get_schema_from_method_signature(
metadata_schema = get_json_schema_from_method_signature(
method=cls.__init__, exclude=["recording_id", "experiment_id"]
)
metadata_schema["properties"]["folder_path"].update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....tools import get_package
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


def _test_sonpy_installation() -> None:
Expand All @@ -29,7 +29,7 @@ class Spike2RecordingInterface(BaseRecordingExtractorInterface):

@classmethod
def get_source_schema(cls) -> dict:
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["smrx_channel_ids"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["smrx_channel_ids"])
source_schema.update(additionalProperties=True)
source_schema["properties"]["file_path"].update(description="Path to .smrx file.")
return source_schema
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .spikeglxdatainterface import SpikeGLXRecordingInterface
from .spikeglxnidqinterface import SpikeGLXNIDQInterface
from ....nwbconverter import ConverterPipe
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class SpikeGLXConverterPipe(ConverterPipe):
Expand All @@ -23,7 +23,7 @@ class SpikeGLXConverterPipe(ConverterPipe):

@classmethod
def get_source_schema(cls):
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["streams"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["streams"])
source_schema["properties"]["folder_path"]["description"] = "Path to the folder containing SpikeGLX streams."
return source_schema

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from .spikeglx_utils import get_session_start_time
from ..baserecordingextractorinterface import BaseRecordingExtractorInterface
from ....tools.signal_processing import get_rising_frames_from_ttl
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class SpikeGLXNIDQInterface(BaseRecordingExtractorInterface):
Expand All @@ -22,7 +22,7 @@ class SpikeGLXNIDQInterface(BaseRecordingExtractorInterface):

@classmethod
def get_source_schema(cls) -> dict:
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["x_pitch", "y_pitch"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["x_pitch", "y_pitch"])
source_schema["properties"]["file_path"]["description"] = "Path to SpikeGLX .nidq file."
return source_schema

Expand Down
4 changes: 2 additions & 2 deletions src/neuroconv/datainterfaces/icephys/baseicephysinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from ...baseextractorinterface import BaseExtractorInterface
from ...tools.nwb_helpers import make_nwbfile_from_metadata
from ...utils import (
get_json_schema_from_method_signature,
get_metadata_schema_for_icephys,
get_schema_from_hdmf_class,
get_schema_from_method_signature,
)


Expand All @@ -22,7 +22,7 @@ class BaseIcephysInterface(BaseExtractorInterface):

@classmethod
def get_source_schema(cls) -> dict:
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=[])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=[])
return source_schema

@validate_call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)
from ....nwbconverter import NWBConverter
from ....tools.nwb_helpers import make_or_load_nwbfile
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class BrukerTiffMultiPlaneConverter(NWBConverter):
Expand All @@ -24,7 +24,7 @@ class BrukerTiffMultiPlaneConverter(NWBConverter):

@classmethod
def get_source_schema(cls):
source_schema = get_schema_from_method_signature(cls)
source_schema = get_json_schema_from_method_signature(cls)
source_schema["properties"]["folder_path"][
"description"
] = "The folder that contains the Bruker TIF image files (.ome.tif) and configuration files (.xml, .env)."
Expand Down Expand Up @@ -138,7 +138,7 @@ class BrukerTiffSinglePlaneConverter(NWBConverter):

@classmethod
def get_source_schema(cls):
return get_schema_from_method_signature(cls)
return get_json_schema_from_method_signature(cls)

def get_conversion_options_schema(self):
interface_name = list(self.data_interface_objects.keys())[0]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ... import MiniscopeBehaviorInterface, MiniscopeImagingInterface
from ....nwbconverter import NWBConverter
from ....tools.nwb_helpers import make_or_load_nwbfile
from ....utils import get_schema_from_method_signature
from ....utils import get_json_schema_from_method_signature


class MiniscopeConverter(NWBConverter):
Expand All @@ -19,7 +19,7 @@ class MiniscopeConverter(NWBConverter):

@classmethod
def get_source_schema(cls):
source_schema = get_schema_from_method_signature(cls)
source_schema = get_json_schema_from_method_signature(cls)
source_schema["properties"]["folder_path"]["description"] = "The path to the main Miniscope folder."
return source_schema

Expand Down
6 changes: 3 additions & 3 deletions src/neuroconv/tools/testing/mock_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from ...datainterfaces.ophys.basesegmentationextractorinterface import (
BaseSegmentationExtractorInterface,
)
from ...utils import ArrayType, get_schema_from_method_signature
from ...utils import ArrayType, get_json_schema_from_method_signature


class MockBehaviorEventInterface(BaseTemporalAlignmentInterface):
Expand All @@ -30,7 +30,7 @@ class MockBehaviorEventInterface(BaseTemporalAlignmentInterface):

@classmethod
def get_source_schema(cls) -> dict:
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["event_times"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["event_times"])
source_schema["additionalProperties"] = True
return source_schema

Expand Down Expand Up @@ -74,7 +74,7 @@ class MockSpikeGLXNIDQInterface(SpikeGLXNIDQInterface):

@classmethod
def get_source_schema(cls) -> dict:
source_schema = get_schema_from_method_signature(method=cls.__init__, exclude=["ttl_times"])
source_schema = get_json_schema_from_method_signature(method=cls.__init__, exclude=["ttl_times"])
source_schema["additionalProperties"] = True
return source_schema

Expand Down
2 changes: 1 addition & 1 deletion src/neuroconv/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
get_base_schema,
get_metadata_schema_for_icephys,
get_schema_from_hdmf_class,
get_schema_from_method_signature,
get_json_schema_from_method_signature,
unroot_schema,
get_json_schema_from_method_signature,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def basic_method(
assert test_json_schema == expected_json_schema


def test_get_schema_from_method_signature_init():
def test_get_json_schema_from_method_signature_init():
"""Test that 'self' is automatically skipped."""

class TestClass:
Expand Down Expand Up @@ -141,7 +141,7 @@ def __init__(
assert test_json_schema == expected_json_schema


def test_get_schema_from_method_signature_class_static():
def test_get_json_schema_from_method_signature_class_static():
"""Ensuring that signature assembly prior to passing to Pydantic is not affected by bound or static methods."""

class TestClass:
Expand All @@ -165,7 +165,7 @@ def test_static_method(integer: int, string: str, boolean: bool):
assert test_json_schema == expected_json_schema


def test_get_schema_from_method_signature_class_method():
def test_get_json_schema_from_method_signature_class_method():
"""Test that 'cls' is automatically skipped."""

class TestClass:
Expand Down

0 comments on commit d59c19d

Please sign in to comment.