Skip to content

Rotation3DToGWAConverter raises an error on length-one angle lists #604

@emolter

Description

@emolter

Minimum example:

import stdatamodels.jwst.datamodels as dm
from stdatamodels.jwst.transforms import Rotation3DToGWA
wcs = Rotation3DToGWA(angles=[45,], axes_order="y")
model = dm.ImageModel((10,10))
model.meta.wcs = wcs

raises a long traceback, with the relevant portion being

    node = {"angles": list(model.angles.value)}
                      ~~~~^^^^^^^^^^^^^^^^^^^^
TypeError: 'numpy.float64' object is not iterable

I'd expect this to work without any issues; using this class to do a single rotation should not be a problem, and indeed until the conversion is attempted this works fine.

By contrast doing

import stdatamodels.jwst.datamodels as dm
from stdatamodels.jwst.transforms import Rotation3DToGWA
wcs = Rotation3DToGWA(angles=[45,0], axes_order="yy")
model = dm.ImageModel((10,10))
model.meta.wcs = wcs

works fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions