Skip to content

Transform.xfm is a list of lists and not a np.ndarray #719

Description

@kroq-gar78

Transform.xfm is wrongly annotated as npt.NDArray: https://github.com/gallantlab/pycortex/blob/main/cortex/xfm.py#L20

It is a list because we construct Transform directly with a JSON blob: https://github.com/gallantlab/pycortex/blob/main/cortex/database.py#L489

For example:

import cortex
print(cortex.db.S1.transforms['fullhead'].coord.xfm)

Output:

[[-0.44486981846094426, -0.0021363672818559996, -0.03721181986487324, 46.62686084588364], [0.005235315303737166, -0.44485768384714863, -0.03704886912935894, 60.165881316857195], [-0.02001550497747565, -0.020260819840215893, 0.24044994416882276, 12.698317611104553], [0.0, 0.0, 0.0, 1.0]]

Solution

Either fix the annotation to be list[list[float]] or convert it to np.ndarray during construction. I prefer the 2nd, but we need to check if that could mess up (de)serialization.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions