Consider the following:
import stdatamodels.jwst.datamodels as dm
import numpy as np
data = np.ones((10,10))
model = dm.ImageModel(data=data)
model.shape # 10, 10
model.data = np.ones((5,5))
model.shape # 10, 10
model.data.shape # (5,5)
This happens because the model.shape property definition only queries the primary array shape if model._shape is None; otherwise it just returns model._shape. This should be fixed in some way that prevents these from being different.
model._shape is set either on __init__ (if the primary array was provided on initialization of the model) or else the first time model.shape is requested, e.g.
model = dm.ImageModel()
model.shape # None
model.data = np.ones((10,10))
model._shape # None
model.shape # (10,10)
model._shape # (10,10)
Relates to #505
Consider the following:
This happens because the
model.shapeproperty definition only queries the primary array shape ifmodel._shapeisNone; otherwise it just returnsmodel._shape. This should be fixed in some way that prevents these from being different.model._shapeis set either on__init__(if the primary array was provided on initialization of the model) or else the first timemodel.shapeis requested, e.g.Relates to #505