diff --git a/spec/ndx-anatomical-localization.extensions.yaml b/spec/ndx-anatomical-localization.extensions.yaml index ee4f0cf..283ce84 100644 --- a/spec/ndx-anatomical-localization.extensions.yaml +++ b/spec/ndx-anatomical-localization.extensions.yaml @@ -59,7 +59,7 @@ groups: neurodata_type_inc: VectorData doc: "The z coordinate" quantity: 1 - - name: target_object + - name: localized_entity neurodata_type_inc: DynamicTableRegion doc: "The object to which the coordinates refer (e.g. electrode)" quantity: 1 diff --git a/src/pynwb/ndx_anatomical_localization/ndx_anatomical_localization.py b/src/pynwb/ndx_anatomical_localization/ndx_anatomical_localization.py index 539fca9..1ec9f79 100644 --- a/src/pynwb/ndx_anatomical_localization/ndx_anatomical_localization.py +++ b/src/pynwb/ndx_anatomical_localization/ndx_anatomical_localization.py @@ -1,7 +1,7 @@ from hdmf.common import DynamicTable -from hdmf.utils import docval, get_docval, AllowPositional -from pynwb import get_class, register_class +from hdmf.utils import get_docval, AllowPositional +from pynwb import get_class, register_class, docval, register_map TempSpace = get_class("Space", "ndx-anatomical-localization") TempAnatomicalCoordinatesTable = get_class("AnatomicalCoordinatesTable", "ndx-anatomical-localization") @@ -56,20 +56,20 @@ class AnatomicalCoordinatesTable(TempAnatomicalCoordinatesTable): {"name": "space", "type": Space, "doc": "space of the table"}, {"name": "method", "type": str, "doc": "method of the table"}, {"name": "target", "type": DynamicTable, - "doc": 'target table. ignored if a "target_object" column is provided in "columns"', "default": None}, + "doc": 'target table. ignored if a "localized_entity" column is provided in "columns"', "default": None}, *get_docval(DynamicTable.__init__), allow_positional=AllowPositional.ERROR, ) def __init__(self, **kwargs): columns = kwargs.get("columns") target = kwargs.pop("target") - if not columns or "target_object" not in [c.name for c in columns]: - # set the target table of the "target_object" column only if the "target_object" column is not in "columns" + if not columns or "localized_entity" not in [c.name for c in columns]: + # set the target table of the "localized_entity" column only if the "localized_entity" column is not in "columns" if target is None: raise ValueError( '"target" (the target table that contains the objects that have these coordinates) ' 'must be provided in AnatomicalCoordinatesTable.__init__ ' - 'if the "target_object" column is not in "columns".') - kwargs["target_tables"] = {"target_object": target} + 'if the "localized_entity" column is not in "columns".') + kwargs["target_tables"] = {"localized_entity": target} super().__init__(**kwargs) diff --git a/src/pynwb/tests/test_anatomical_coordinates.py b/src/pynwb/tests/test_anatomical_coordinates.py index d707b95..db0b15c 100644 --- a/src/pynwb/tests/test_anatomical_coordinates.py +++ b/src/pynwb/tests/test_anatomical_coordinates.py @@ -27,7 +27,7 @@ def test_create_anatomical_coordinates_table(): method="method", space=space, ) - [table.add_row(x=1.0, y=2.0, z=3.0, brain_region="CA1", target_object=x) for x in range(5)] + [table.add_row(x=1.0, y=2.0, z=3.0, brain_region="CA1", localized_entity=x) for x in range(5)] localization.add_anatomical_coordinates_tables([table]) @@ -43,10 +43,10 @@ def test_create_anatomical_coordinates_table(): assert read_coordinates_table.method == "method" assert read_coordinates_table.description == "Anatomical coordinates table" - assert read_coordinates_table.target_object.table is read_electrodes_table + assert read_coordinates_table.localized_entity.table is read_electrodes_table assert read_coordinates_table.space.fields == Space.get_predefined_space("CCFv3").fields npt.assert_array_equal(read_coordinates_table["x"].data[:], np.array([1.0, 1.0, 1.0, 1.0, 1.0])) npt.assert_array_equal(read_coordinates_table["y"].data[:], np.array([2.0, 2.0, 2.0, 2.0, 2.0])) npt.assert_array_equal(read_coordinates_table["z"].data[:], np.array([3.0, 3.0, 3.0, 3.0, 3.0])) npt.assert_array_equal(read_coordinates_table["brain_region"].data[:], np.array(["CA1", "CA1", "CA1", "CA1", "CA1"])) - npt.assert_array_equal(read_coordinates_table["target_object"].data[:], np.array([0, 1, 2, 3, 4])) + npt.assert_array_equal(read_coordinates_table["localized_entity"].data[:], np.array([0, 1, 2, 3, 4]))