Skip to content

Commit

Permalink
Merge branch 'main' into RCAL-824_SepTVACFPS
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulHuwe authored May 7, 2024
2 parents aefe5b2 + 322f74e commit fd4ff71
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

- Separated TVAC and FPS into their own makers to freeze from from main development. [#347]

- Replaced the previous test for ``schema_info`` with something more robust. [#344]

- Add conversion of dict to string during Qtable construction [#348]


0.19.1 (2024-04-04)
===================

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ dependencies = [
"numpy >=1.22",
"astropy >=5.3.0",
# "rad @ git+https://github.com/spacetelescope/rad.git",
# "rad >= 0.19.2",
"rad @ git+https://github.com/PaulHuwe/rad.git@RAD-165_SepTVACFPS",
# "rad >= 0.19.3",
"asdf-standard >=1.0.3",
]
dynamic = [
Expand Down
12 changes: 7 additions & 5 deletions src/roman_datamodels/datamodels/_datamodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def append_individual_image_meta(self, meta):

subtable_cols.append(subkey)

if isinstance(subvalue, list):
if isinstance(subvalue, (list, dict)):
subtable_vals.append([str(subvalue)])
else:
subtable_vals.append([subvalue])
Expand All @@ -105,11 +105,13 @@ def append_individual_image_meta(self, meta):
else:
# Append to existing table
self.meta.individual_image_meta[key].add_row(subtable_vals)
# Skip non-schema metas
elif isinstance(value, dict):
continue
# Skip ndarrays
elif isinstance(value.strip(), asdf.tags.core.ndarray.NDArrayType):
continue
else:
# Skip ndarrays
if isinstance(value.strip(), asdf.tags.core.ndarray.NDArrayType):
continue

# Store Basic keyword
basic_cols.append(key)

Expand Down
22 changes: 19 additions & 3 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

EXPECTED_COMMON_REFERENCE = {"$ref": "ref_common-1.0.0"}

# Nodes for metadata schema that do not contain any archive_catalog keywords
NODES_LACKING_ARCHIVE_CATALOG = [stnode.OutlierDetection, stnode.MosaicAssociations, stnode.IndividualImageMeta, stnode.Resample]


def datamodel_names():
names = []
Expand Down Expand Up @@ -797,7 +800,7 @@ def test_datamodel_info_search(capsys):
assert result.node == "F158"


def test_datamodel_schema_info():
def test_datamodel_schema_info_values():
wfi_science_raw = utils.mk_level1_science_raw(shape=(2, 8, 8))
af = asdf.AsdfFile()
af.tree = {"roman": wfi_science_raw}
Expand Down Expand Up @@ -829,8 +832,21 @@ def test_datamodel_schema_info():
)
},
}
for keyword in dm.meta.keys():
assert keyword in info["roman"]["meta"]


@pytest.mark.parametrize("name", datamodel_names())
def test_datamodel_schema_info_existence(name):
# Loop over datamodels that have archive_catalog entries
if not name.endswith("RefModel") and name != "AssociationsModel":
method = getattr(datamodels, name)
model = utils.mk_datamodel(method)
info = model.schema_info("archive_catalog")
for keyword in model.meta.keys():
# Only DNodes or LNodes need to be canvassed
if isinstance(model.meta[keyword], (stnode.DNode, stnode.LNode)):
# Ignore metadata schemas that lack archive_catalog entries
if type(model.meta[keyword]) not in NODES_LACKING_ARCHIVE_CATALOG:
assert keyword in info["roman"]["meta"]


def test_crds_parameters(tmp_path):
Expand Down

0 comments on commit fd4ff71

Please sign in to comment.