You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently setting a DataModel attribute to None (which is a common pattern for freeing up memory) results in creation of a default value for the attribute:
For large arrays (which are likely candidates for removal to free up memory) this results in creation of a large new array with default values.
>>>importstdatamodels.jwst.datamodelsasdm>>>m=dm.ImageModel((1000, 1000))
>>>d0=m._instance['data'] # avoid the getattr for data>>>d0.shape
(1000, 1000)
>>>m.data=None>>>d0ism._instance['data']
False>>>m._instance['data'].shape
(1000, 1000)
It may be helpful to use a singleton like MAKE_DEFAULT to signify that a default should be made.
>>>importstdatamodels>>>importstdatamodels.jwst.datamodelsasdm>>>m=dm.ImageModel((1000, 1000))
>>>m.data=stdatamodels.MAKE_DEFAULT# to trigger a new default for data
This could help to make it more explicit when a default is requested. However it would require changes to code like the following:
Currently setting a
DataModel
attribute toNone
(which is a common pattern for freeing up memory) results in creation of a default value for the attribute:stdatamodels/src/stdatamodels/properties.py
Lines 324 to 330 in ee4756f
For large arrays (which are likely candidates for removal to free up memory) this results in creation of a large new array with default values.
It may be helpful to use a singleton like
MAKE_DEFAULT
to signify that a default should be made.This could help to make it more explicit when a default is requested. However it would require changes to code like the following:
stdatamodels/src/stdatamodels/jwst/datamodels/slit.py
Lines 65 to 68 in ee4756f
The text was updated successfully, but these errors were encountered: