Skip to content

Pose estimation device linkage fails for ndx_franklab_novela.CameraDevice #48

@pauladkisson

Description

@pauladkisson

After writing, the PoseEstimation.devices field shows up as None when linked to a CameraDevice from ndx_franklab_novela. See minimal example below.

from pynwb.testing.mock.file import mock_NWBFile
from pynwb import NWBHDF5IO
from ndx_pose import PoseEstimation
from ndx_franklab_novela import CameraDevice

def main():
    nwbfile = mock_NWBFile()
    camera_device = CameraDevice(
        name="Device",
        meters_per_pixel=1.0,
        model="model",
        lens="lens",
        camera_name="camera_name",
    )
    nwbfile.add_device(camera_device)
    device = nwbfile.devices["Device"]

    pose_estimation = PoseEstimation(
        name="PoseEstimation",
        devices=[device],
    )
    nwbfile.create_processing_module(
        name="behavior",
        description="behavior",
    )
    nwbfile.processing["behavior"].add(pose_estimation)

    print(nwbfile.processing["behavior"].data_interfaces["PoseEstimation"].devices)
    # [Device abc.CameraDevice at 0x4685396304
    # Fields:
    #     camera_name: camera_name
    #     lens: lens
    #     meters_per_pixel: 1.0
    #     model: model
    # ]

    with NWBHDF5IO("test.nwb", "w") as io:
        io.write(nwbfile)
    
    with NWBHDF5IO("test.nwb", "r") as io:
        nwbfile = io.read()
        print(nwbfile.processing["behavior"].data_interfaces["PoseEstimation"].devices) # None




if __name__ == "__main__":
    main()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions