diff --git a/changelog/153.feature.rst b/changelog/153.feature.rst new file mode 100644 index 0000000..5527042 --- /dev/null +++ b/changelog/153.feature.rst @@ -0,0 +1 @@ +Update `Fido` client for change in aspect/ephemeris file name and path. diff --git a/setup.cfg b/setup.cfg index 6e15ed8..0902f62 100644 --- a/setup.cfg +++ b/setup.cfg @@ -96,7 +96,8 @@ ignore-words-list = process, livetime, technik, - thirdparty + thirdparty, + commutated [coverage:run] omit = diff --git a/stixpy/coordinates/tests/test_transforms.py b/stixpy/coordinates/tests/test_transforms.py index 6dee9e7..97e2cb8 100644 --- a/stixpy/coordinates/tests/test_transforms.py +++ b/stixpy/coordinates/tests/test_transforms.py @@ -9,7 +9,7 @@ from sunpy.coordinates import HeliographicStonyhurst, Helioprojective from stixpy.coordinates.frames import STIXImaging -from stixpy.coordinates.transforms import _get_aux_data, get_hpc_info +from stixpy.coordinates.transforms import _get_ephemeris_data, get_hpc_info @pytest.mark.skip(reason="Test data maybe incorrect") @@ -85,15 +85,15 @@ def test_stx_to_hpc_obstime_end(): @pytest.mark.remote_data def test_get_aux_data(): with pytest.raises(ValueError, match="No STIX pointing data found for time range"): - _get_aux_data(Time("2015-06-06")) # Before the mission started + _get_ephemeris_data(Time("2015-06-06")) # Before the mission started - aux_data = _get_aux_data(Time("2022-08-28T16:02:00")) + aux_data = _get_ephemeris_data(Time("2022-08-28T16:02:00")) assert len(aux_data) == 1341 - aux_data = _get_aux_data(Time("2022-08-28T16:02:00"), end_time=Time("2022-08-28T16:04:00")) + aux_data = _get_ephemeris_data(Time("2022-08-28T16:02:00"), end_time=Time("2022-08-28T16:04:00")) assert len(aux_data) == 1341 - aux_data = _get_aux_data(Time("2022-08-28T23:58:00"), end_time=Time("2022-08-29T00:02:00")) + aux_data = _get_ephemeris_data(Time("2022-08-28T23:58:00"), end_time=Time("2022-08-29T00:02:00")) assert len(aux_data) == 2691 diff --git a/stixpy/coordinates/transforms.py b/stixpy/coordinates/transforms.py index dc81abc..0aa7d07 100644 --- a/stixpy/coordinates/transforms.py +++ b/stixpy/coordinates/transforms.py @@ -68,7 +68,7 @@ def get_hpc_info(times, end_time=None): ------- """ - aux = _get_aux_data(times.min(), end_time or times.max()) + aux = _get_ephemeris_data(times.min(), end_time or times.max()) indices = np.argwhere((aux["time"] >= times.min()) & (aux["time"] <= times.max())) if end_time is not None: @@ -155,7 +155,7 @@ def get_hpc_info(times, end_time=None): @lru_cache -def _get_aux_data(start_time, end_time=None): +def _get_ephemeris_data(start_time, end_time=None): r""" Search, download and read L2 pointing data. @@ -175,9 +175,9 @@ def _get_aux_data(start_time, end_time=None): query = Fido.search( a.Time(start_time, end_time), a.Instrument.stix, - a.Level.l2, - a.stix.DataType.aux, - a.stix.DataProduct.aux_ephemeris, + a.Level.anc, + a.stix.DataType.asp, + a.stix.DataProduct.asp_ephemeris, ) if len(query["stix"]) == 0: raise ValueError(f"No STIX pointing data found for time range {start_time} to {end_time}.") diff --git a/stixpy/net/attrs.py b/stixpy/net/attrs.py index c57e23b..706498b 100644 --- a/stixpy/net/attrs.py +++ b/stixpy/net/attrs.py @@ -2,40 +2,14 @@ __all__ = ["DataType", "DataProduct"] -DATA_TYPES = ["QL", "SCI", "HK", "CAL"] -DATA_PRODUCTS = [ - "ql_lightcurve", - "ql_background", - "ql_variance", - "ql_spectra", - "ql_calibration_spectrum", - "ql_flareflag", - "sci_xray_l0", - "sci_xray_l1", - "sci_xray_l2", - "sci_xray_l3", - "sci_spectrogram", - "sci_visibility", -] - class DataType(SimpleAttr): """ Data type Quicklook (QL), science (SCI), or housekeeping (HK) """ - # def __init__(self, value): - # if str(value).casefold not in [t.casefold for t in DATA_TYPES]: - # raise ValueError(f'Data type must be one of {DATA_TYPES} not {value}') - # super().__init__(value) - class DataProduct(SimpleAttr): """ Data product """ - - # def __init__(self, value): - # if str(value).casefold not in [t.casefold for t in DATA_PRODUCTS]: - # raise ValueError(f'Data product must be one of {DATA_PRODUCTS} not {value}') - # super().__init__(value) diff --git a/stixpy/net/client.py b/stixpy/net/client.py index 842232c..3bee0dc 100644 --- a/stixpy/net/client.py +++ b/stixpy/net/client.py @@ -35,7 +35,7 @@ class STIXClient(GenericClient): """ - baseurl = r"https://pub099.cs.technik.fhnw.ch/data/fits/" r"{level}/{year:4d}/{month:02d}/{day:02d}/{datatype}/" + baseurl = r"https://pub099.cs.technik.fhnw.ch/data/fits/{level}/{year:4d}/{month:02d}/{day:02d}/{datatype}/" ql_filename = r"solo_{level}_stix-{product}_\d{{8}}_V\d{{2}}\D?.fits" sci_filename = r"solo_{level}_stix-{product}_" r"\d{{8}}T\d{{6}}-\d{{8}}T\d{{6}}_V\d{{2}}\D?_.*.fits" @@ -85,7 +85,7 @@ def search(self, *args, **kwargs): elif datatype.lower() == "cal" and product.startswith("cal"): url = self.baseurl + self.ql_filename pattern = self.base_pattern + self.ql_pattern - elif datatype.lower() == "aux" and product.startswith("aux"): + elif datatype.lower() == "asp" and product.startswith("asp"): url = self.baseurl + self.ql_filename pattern = self.base_pattern + self.ql_pattern @@ -104,7 +104,7 @@ def search(self, *args, **kwargs): rowdict = self.post_search_hook(i, matchdict) file_tr = rowdict.pop("tr", None) if file_tr is not None: - # 4 cases file time full in, fully our start in or end in + # 4 cases file time full in, fully our start in or ends in if file_tr.start >= tr.start and file_tr.end <= tr.end: metalist.append(rowdict) elif tr.start <= file_tr.start and tr.end >= file_tr.end: @@ -150,15 +150,16 @@ def register_values(cls): adict = { attrs.Instrument: [("STIX", "Spectrometer/Telescope for Imaging X-rays")], attrs.Level: [ - ("L0", "STIX: Decommutated, uncompressed, uncalibrated data."), + ("L0", "STIX: commutated, uncompressed, uncalibrated data."), ("L1", "STIX: Engineering and UTC time conversion ."), ("L2", "STIX: Calibrated data."), + ("ANC", "STIX: Ancillary data."), ], attrs.stix.DataType: [ ("QL", "Quick Look"), ("SCI", "Science Data"), ("CAL", "Calibration"), - ("AUX", "Auxiliary"), + ("ASP", "Aspect"), ("HK", "House Keeping"), ], attrs.stix.DataProduct: [ @@ -176,7 +177,7 @@ def register_values(cls): ("sci_xray_scpd", "Summed Compressed Pixel Data"), ("sci_xray_vis", "Visibilities"), ("sci_xray_spec", "Spectrogram"), - ("aux_ephemeris", "Auxiliary ephemeris data"), + ("asp-ephemeris", "Aspect Solution and Ephemeris data"), ], } return adict