Open braingram opened 1 month ago
Poking a little more at this one, it looks like the issue is that roman.dq is an asdf.tags.core.ndarray.NDArrayType rather than a np.ndarray. https://github.com/spacetelescope/roman_datamodels/blob/911485a5913e61a42dc0b79c83325eadec310d3a/src/roman_datamodels/datamodels/_core.py#L301
We should probably think about alternatives to isinstance(...) checks as these kinds of issues pop up rather frequently.
In [8]: cal.to_flat_dict()['roman.dq']
Out[8]:
array([[1048576, 1048576, 1048576, ..., 1048576, 1048576, 1048576],
[ 0, 0, 0, ..., 4, 0, 0],
[1048576, 1048576, 1048576, ..., 1048576, 1048576, 1048576],
...,
[ 0, 0, 0, ..., 0, 0, 0],
[ 0, 0, 0, ..., 0, 0, 0],
[1048576, 1048576, 1048576, ..., 1048576, 1048576, 1048576]],
dtype=uint32)
In [9]: type(cal.to_flat_dict()['roman.dq'])
Out[9]: asdf.tags.core.ndarray.NDArrayType
In [10]: isinstance(cal.to_flat_dict()['roman.dq'], np.ndarray)
Out[10]: False
If I open a roman file (one of the regression test files for romancal) and use
to_flat_dict(include_arrays=False)
arrays are included in the flat dictionary.