diff --git a/proseco/catalog.py b/proseco/catalog.py index 9ca75b57..ea7c7348 100644 --- a/proseco/catalog.py +++ b/proseco/catalog.py @@ -124,7 +124,10 @@ def _get_aca_catalog(**kwargs): # Get stars (typically from AGASC) and do not filter for stars near # the ACA FOV. This leaves the full radial selection available for # later roll optimization. Use aca.stars or aca.acqs.stars from here. + # Set the agasc_file MetaAttribute if it is available in the stars table meta. aca.set_stars(filter_near_fov=False) + if "agasc_file" in aca.stars.meta: + aca.agasc_file = aca.stars.meta["agasc_file"] aca.log("Starting get_acq_catalog") aca.acqs = get_acq_catalog(stars=aca.stars, **kwargs) @@ -302,6 +305,7 @@ class ACATable(ACACatalogTable): optimize = MetaAttribute(default=True) call_args = MetaAttribute(default={}) version = MetaAttribute() + agasc_file = MetaAttribute(is_kwarg=False) # For validation with get_aca_catalog(obsid), store the starcheck # catalog in the ACATable meta. diff --git a/proseco/core.py b/proseco/core.py index d15d1d2f..167ffb72 100644 --- a/proseco/core.py +++ b/proseco/core.py @@ -1305,6 +1305,8 @@ def empty(cls, att=(0, 0, 0)): :returns: StarsTable of stars (empty) """ stars = cls.from_agasc(att, radius=-1) + # Remove "agasc_file" meta key since it does not apply for a synthetic table. + del stars.meta["agasc_file"] stars.att = att return stars diff --git a/proseco/tests/test_catalog.py b/proseco/tests/test_catalog.py index da94e5da..ffeb5580 100644 --- a/proseco/tests/test_catalog.py +++ b/proseco/tests/test_catalog.py @@ -129,6 +129,7 @@ def test_get_aca_catalog_20603(proseco_agasc_1p7): aca.fids.plot() assert aca.dark_date == "2018:100" + assert Path(aca.agasc_file).name == "proseco_agasc_1p7.h5" @pytest.mark.skipif(not HAS_SC_ARCHIVE, reason="Test requires starcheck archive") @@ -274,6 +275,9 @@ def test_pickle(): stars.add_fake_constellation(mag=10.0, n_stars=5) aca = get_aca_catalog(stars=stars, dark=DARK40, raise_exc=True, **STD_INFO) + # Fake stars do not have an agasc_file attribute + assert "agasc_file" not in aca.stars.meta + aca2 = pickle.loads(pickle.dumps(aca)) assert repr(aca) == repr(aca2)