Skip to content

x_shifts_els and y_shifts_els are swapped #1579

Description

@ethanbb

For some reason, the code that calculates nonrigid shifts labels the dimensions, in order, as (X, Y, [Z]), even though the movies that are input to motion correction are ordered (Y, X, [Z]). As a result, x_shifts_els actually contains the Y shifts and vice versa. This has come up before, and I even added some comments in the code acknowledging it, but I just spent another couple of days totally confused about this since I forgot myself. think it's really worth changing something here - these are public-facing attributes that are extremely misleading.

Since there's a real backwards compatibility concern with just swapping the two attributes, I would propose:

  • Add a new attribute shifts_els or shifts_nonrigid that contains all the nonrigid shifts in (Y, X, Z) order, stacked along dimension 1 to have dimensionality (frames, dims, patches) (similar to shifts_rig, with a 3rd dimension added for patches)
  • In the next major release, convert x_shifts_els and y_shifts_els to properties that raise an error when they are accessed instructing the user how to adapt their code to use the new attribute instead.

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