astro-metadata-translator 29.0.1__tar.gz → 29.2025.1700__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {astro_metadata_translator-29.0.1/python/astro_metadata_translator.egg-info → astro_metadata_translator-29.2025.1700}/PKG-INFO +1 -1
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/observationInfo.py +2 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/properties.py +15 -1
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translator.py +28 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/decam.py +1 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/helpers.py +26 -8
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/megaprime.py +1 -0
- astro_metadata_translator-29.2025.1700/python/astro_metadata_translator/version.py +2 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700/python/astro_metadata_translator.egg-info}/PKG-INFO +1 -1
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/SOURCES.txt +2 -1
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_cfht.py +2 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_decam.py +5 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_sdss.py +1 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_subaru.py +3 -0
- astro_metadata_translator-29.2025.1700/tests/test_translator_helpers.py +99 -0
- astro_metadata_translator-29.0.1/python/astro_metadata_translator/version.py +0 -2
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/CHANGES.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/LICENSE +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/MANIFEST.in +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/pyproject.toml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/__init__.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/bin/__init__.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/bin/translate.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/bin/writeindex.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/bin/writesidecar.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/cli/__init__.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/cli/astrometadata.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/CFHT/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/DECam/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00042600.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00120200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00120400.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00120600.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00120800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00121000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00121200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00121400.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00121600.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00121800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00122000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00122800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00123000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00123200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00123800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00124000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00124200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00124400.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00124600.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00124800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00186800.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00187000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00187200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00187400.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00187600.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00188000.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/HSC-HSCA00188200.yaml +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/HSC/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/SDSS/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/corrections/SuprimeCam/README.md +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/file_helpers.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/headers.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/indexing.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/observationGroup.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/py.typed +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/serialize/__init__.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/serialize/fits.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/tests.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/__init__.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/fits.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/hsc.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/sdss.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/subaru.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator/translators/suprimecam.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/dependency_links.txt +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/entry_points.txt +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/requires.txt +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/top_level.txt +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/python/astro_metadata_translator.egg-info/zip-safe +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/setup.cfg +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_basics.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_cli.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_extensions.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_groups.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_headers.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_indexing.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_shadowing.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_translate_header.py +0 -0
- {astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_translation.py +0 -0
|
@@ -115,6 +115,7 @@ class ObservationInfo:
|
|
|
115
115
|
datetime_end: astropy.time.Time
|
|
116
116
|
exposure_group: str
|
|
117
117
|
exposure_time: astropy.units.Quantity
|
|
118
|
+
exposure_time_requested: astropy.units.Quantity
|
|
118
119
|
dark_time: astropy.units.Quantity
|
|
119
120
|
boresight_airmass: float
|
|
120
121
|
boresight_rotation_angle: astropy.units.Quantity
|
|
@@ -131,6 +132,7 @@ class ObservationInfo:
|
|
|
131
132
|
relative_humidity: float
|
|
132
133
|
tracking_radec: astropy.coordinates.SkyCoord
|
|
133
134
|
altaz_begin: astropy.coordinates.AltAz
|
|
135
|
+
altaz_end: astropy.coordinates.AltAz | None
|
|
134
136
|
science_program: str
|
|
135
137
|
observation_counter: int
|
|
136
138
|
observation_reason: str
|
|
@@ -460,7 +460,14 @@ may not be.""",
|
|
|
460
460
|
simple_to_datetime,
|
|
461
461
|
),
|
|
462
462
|
"exposure_time": PropertyDefinition(
|
|
463
|
-
"
|
|
463
|
+
"Actual duration of the exposure (seconds).",
|
|
464
|
+
"astropy.units.Quantity",
|
|
465
|
+
astropy.units.Quantity,
|
|
466
|
+
exptime_to_simple,
|
|
467
|
+
simple_to_exptime,
|
|
468
|
+
),
|
|
469
|
+
"exposure_time_requested": PropertyDefinition(
|
|
470
|
+
"Requested duration of the exposure (seconds).",
|
|
464
471
|
"astropy.units.Quantity",
|
|
465
472
|
astropy.units.Quantity,
|
|
466
473
|
exptime_to_simple,
|
|
@@ -550,6 +557,13 @@ may not be.""",
|
|
|
550
557
|
altaz_to_simple,
|
|
551
558
|
simple_to_altaz,
|
|
552
559
|
),
|
|
560
|
+
"altaz_end": PropertyDefinition(
|
|
561
|
+
"Telescope boresight azimuth and elevation at end of observation.",
|
|
562
|
+
"astropy.coordinates.AltAz",
|
|
563
|
+
astropy.coordinates.AltAz,
|
|
564
|
+
altaz_to_simple,
|
|
565
|
+
simple_to_altaz,
|
|
566
|
+
),
|
|
553
567
|
"science_program": PropertyDefinition("Observing program (survey or proposal) identifier.", "str", str),
|
|
554
568
|
"observation_type": PropertyDefinition(
|
|
555
569
|
"Type of observation (currently: science, dark, flat, bias, focus).",
|
|
@@ -1042,6 +1042,34 @@ class MetadataTranslator:
|
|
|
1042
1042
|
return "science"
|
|
1043
1043
|
return "unknown"
|
|
1044
1044
|
|
|
1045
|
+
@cache_translation
|
|
1046
|
+
def to_exposure_time_requested(self) -> astropy.units.Quantity:
|
|
1047
|
+
"""Return the requested exposure time in seconds.
|
|
1048
|
+
|
|
1049
|
+
Base class implementations returns the same value as ``exposure_time``.
|
|
1050
|
+
This information may not be available for all instruments.
|
|
1051
|
+
|
|
1052
|
+
Returns
|
|
1053
|
+
-------
|
|
1054
|
+
exptime : `astropy.units.Quantity`
|
|
1055
|
+
The recorded exposure time in seconds.
|
|
1056
|
+
"""
|
|
1057
|
+
return self.to_exposure_time()
|
|
1058
|
+
|
|
1059
|
+
@cache_translation
|
|
1060
|
+
def to_altaz_end(self) -> astropy.coordinates.AltAz | None:
|
|
1061
|
+
"""Return the AltAz for the end of the observation.
|
|
1062
|
+
|
|
1063
|
+
Base class implementation returns `None`. Subclasses should override
|
|
1064
|
+
if the value is known.
|
|
1065
|
+
|
|
1066
|
+
Returns
|
|
1067
|
+
-------
|
|
1068
|
+
altaz : `astropy.coordinates.AltAz` or `None`
|
|
1069
|
+
The AltAz for the end of the observation.
|
|
1070
|
+
"""
|
|
1071
|
+
return None
|
|
1072
|
+
|
|
1045
1073
|
@classmethod
|
|
1046
1074
|
def observing_date_to_offset(cls, observing_date: astropy.time.Time) -> astropy.time.TimeDelta | None:
|
|
1047
1075
|
"""Calculate the observing day offset to apply for a given observation.
|
|
@@ -61,6 +61,7 @@ class DecamTranslator(FitsTranslator):
|
|
|
61
61
|
|
|
62
62
|
_trivial_map: dict[str, str | list[str] | tuple[Any, ...]] = {
|
|
63
63
|
"exposure_time": ("EXPTIME", {"unit": u.s}),
|
|
64
|
+
"exposure_time_requested": ("EXPREQ", {"unit": u.s}),
|
|
64
65
|
"dark_time": ("DARKTIME", {"unit": u.s}),
|
|
65
66
|
"boresight_airmass": ("AIRMASS", {"checker": is_non_science}),
|
|
66
67
|
"observation_id": "OBSID",
|
|
@@ -149,12 +149,16 @@ def altaz_from_degree_headers(
|
|
|
149
149
|
altazpairs: tuple[tuple[str, str], ...],
|
|
150
150
|
obstime: astropy.time.Time,
|
|
151
151
|
is_zd: set[str] | None = None,
|
|
152
|
+
max_alt: float = 90.0,
|
|
153
|
+
min_alt: float = 0.0,
|
|
152
154
|
) -> AltAz:
|
|
153
155
|
"""Calculate the altitude/azimuth coordinates from lists of headers.
|
|
154
156
|
|
|
155
|
-
If the altitude is found but is greater than
|
|
156
|
-
fixed at
|
|
157
|
-
If the altitude
|
|
157
|
+
If the altitude is found but is greater than the maximum allowed value,
|
|
158
|
+
it will be returned fixed at that maximum value.
|
|
159
|
+
If the altitude is found but is less than the minimum allowed value, it
|
|
160
|
+
will be returned clipped to that minimum value.
|
|
161
|
+
If the azimuth is less than -360.0 and this is not a science
|
|
158
162
|
observation, `None` will be returned.
|
|
159
163
|
|
|
160
164
|
Parameters
|
|
@@ -167,6 +171,15 @@ def altaz_from_degree_headers(
|
|
|
167
171
|
is_zd : `set`, optional
|
|
168
172
|
Contains keywords that correspond to zenith distances rather than
|
|
169
173
|
altitude.
|
|
174
|
+
max_alt : `float`, optional
|
|
175
|
+
Maximum allowed altitude in degrees. Will be clamped to this value if
|
|
176
|
+
out of range. This value will be forced to +90 if it exceeds +90
|
|
177
|
+
since `astropy.coordinates.AltAz` does not allow a value larger than
|
|
178
|
+
this even if that is caused by a telescope that can lean back at
|
|
179
|
+
Zenith.
|
|
180
|
+
min_alt : `float`, optional
|
|
181
|
+
Minimum allowed altitude in degrees. Will be clamped to this value if
|
|
182
|
+
out of range.
|
|
170
183
|
|
|
171
184
|
Returns
|
|
172
185
|
-------
|
|
@@ -181,6 +194,8 @@ def altaz_from_degree_headers(
|
|
|
181
194
|
No AltAz keywords were found and this observation is a science
|
|
182
195
|
observation.
|
|
183
196
|
"""
|
|
197
|
+
if max_alt > 90.0:
|
|
198
|
+
max_alt = 90.0
|
|
184
199
|
for alt_key, az_key in altazpairs:
|
|
185
200
|
if self.are_keys_ok([az_key, alt_key]):
|
|
186
201
|
az = self._header[az_key]
|
|
@@ -190,13 +205,16 @@ def altaz_from_degree_headers(
|
|
|
190
205
|
if is_zd and alt_key in is_zd:
|
|
191
206
|
alt = altitude_from_zenith_distance(alt * u.deg).value
|
|
192
207
|
|
|
193
|
-
if az < -360.0 or alt <
|
|
208
|
+
if az < -360.0 or alt < -90.0:
|
|
194
209
|
# Break out of loop since we have found values but
|
|
195
|
-
# they are
|
|
210
|
+
# they are not believable
|
|
196
211
|
break
|
|
197
|
-
if alt >
|
|
198
|
-
log.
|
|
199
|
-
alt =
|
|
212
|
+
if alt > max_alt:
|
|
213
|
+
log.info("%s: Clipping altitude (%f) at %f degrees", self._log_prefix, alt, max_alt)
|
|
214
|
+
alt = max_alt
|
|
215
|
+
elif alt < min_alt:
|
|
216
|
+
log.info("%s: Clipping altitude (%f) at %f degrees", self._log_prefix, alt, min_alt)
|
|
217
|
+
alt = min_alt
|
|
200
218
|
|
|
201
219
|
altaz = AltAz(az * u.deg, alt * u.deg, obstime=obstime, location=self.to_location())
|
|
202
220
|
self._used_these_cards(az_key, alt_key)
|
|
@@ -64,6 +64,7 @@ class MegaPrimeTranslator(FitsTranslator):
|
|
|
64
64
|
"physical_filter": "FILTER",
|
|
65
65
|
"dark_time": ("DARKTIME", {"unit": u.s}),
|
|
66
66
|
"exposure_time": ("EXPTIME", {"unit": u.s}),
|
|
67
|
+
"exposure_time_requested": ("EXPREQ", {"unit": u.s}),
|
|
67
68
|
"observation_id": "OBSID",
|
|
68
69
|
"object": "OBJECT",
|
|
69
70
|
"science_program": "RUNID",
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_cfht.py
RENAMED
|
@@ -44,6 +44,7 @@ class MegaPrimeTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
44
44
|
exposure_id=1038843,
|
|
45
45
|
exposure_group="1038843",
|
|
46
46
|
exposure_time=615.037 * u.s,
|
|
47
|
+
exposure_time_requested=615.0 * u.s,
|
|
47
48
|
focus_z=0.0 * u.mm, # default value
|
|
48
49
|
group_counter_end=1038843,
|
|
49
50
|
group_counter_start=1038843,
|
|
@@ -79,6 +80,7 @@ class MegaPrimeTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
79
80
|
exposure_id=849375,
|
|
80
81
|
exposure_group="849375",
|
|
81
82
|
exposure_time=300.202 * u.s,
|
|
83
|
+
exposure_time_requested=300.0 * u.s,
|
|
82
84
|
focus_z=0.0 * u.mm, # default value
|
|
83
85
|
group_counter_end=849375,
|
|
84
86
|
group_counter_start=849375,
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_decam.py
RENAMED
|
@@ -43,6 +43,7 @@ class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
43
43
|
exposure_id=229388,
|
|
44
44
|
exposure_group="229388",
|
|
45
45
|
exposure_time=200.0 * u.s,
|
|
46
|
+
exposure_time_requested=200.0 * u.s,
|
|
46
47
|
focus_z=2497.32 * u.um,
|
|
47
48
|
group_counter_end=229388,
|
|
48
49
|
group_counter_start=229388,
|
|
@@ -79,6 +80,7 @@ class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
79
80
|
exposure_id=160496,
|
|
80
81
|
exposure_group="160496",
|
|
81
82
|
exposure_time=0.0 * u.s,
|
|
83
|
+
exposure_time_requested=0.0 * u.s,
|
|
82
84
|
focus_z=0.0 * u.um,
|
|
83
85
|
group_counter_end=160496,
|
|
84
86
|
group_counter_start=160496,
|
|
@@ -116,6 +118,7 @@ class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
116
118
|
exposure_id=412037,
|
|
117
119
|
exposure_group="412037",
|
|
118
120
|
exposure_time=86.0 * u.s,
|
|
121
|
+
exposure_time_requested=86.0 * u.s,
|
|
119
122
|
focus_z=2828.00 * u.um,
|
|
120
123
|
group_counter_end=412037,
|
|
121
124
|
group_counter_start=412037,
|
|
@@ -152,6 +155,7 @@ class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
152
155
|
exposure_id=845291,
|
|
153
156
|
exposure_group="845291",
|
|
154
157
|
exposure_time=120.0 * u.s,
|
|
158
|
+
exposure_time_requested=120.0 * u.s,
|
|
155
159
|
focus_z=2174.28 * u.um,
|
|
156
160
|
group_counter_end=845291,
|
|
157
161
|
group_counter_start=845291,
|
|
@@ -189,6 +193,7 @@ class DecamTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
189
193
|
exposure_id=177764,
|
|
190
194
|
exposure_group="177764",
|
|
191
195
|
exposure_time=30.0 * u.s,
|
|
196
|
+
exposure_time_requested=30.0 * u.s,
|
|
192
197
|
focus_z=2387.06 * u.um,
|
|
193
198
|
group_counter_end=177764,
|
|
194
199
|
group_counter_start=177764,
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_sdss.py
RENAMED
|
@@ -42,6 +42,7 @@ class SdssTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
42
42
|
exposure_id=6377,
|
|
43
43
|
exposure_group="6377",
|
|
44
44
|
exposure_time=53.907456 * u.s,
|
|
45
|
+
exposure_time_requested=53.907456 * u.s,
|
|
45
46
|
group_counter_end=0,
|
|
46
47
|
group_counter_start=0,
|
|
47
48
|
has_simulated_content=False,
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_subaru.py
RENAMED
|
@@ -43,6 +43,7 @@ class HscTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
43
43
|
exposure_id=904024,
|
|
44
44
|
exposure_group="904024",
|
|
45
45
|
exposure_time=30.0 * u.s,
|
|
46
|
+
exposure_time_requested=30.0 * u.s,
|
|
46
47
|
focus_z=3.7 * u.mm,
|
|
47
48
|
group_counter_end=904024,
|
|
48
49
|
group_counter_start=904024,
|
|
@@ -77,6 +78,7 @@ class HscTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
77
78
|
exposure_id=40900,
|
|
78
79
|
exposure_group="40900",
|
|
79
80
|
exposure_time=150.0 * u.s,
|
|
81
|
+
exposure_time_requested=150.0 * u.s,
|
|
80
82
|
focus_z=3.83 * u.mm,
|
|
81
83
|
group_counter_end=40900,
|
|
82
84
|
group_counter_start=40900,
|
|
@@ -119,6 +121,7 @@ class HscTestCase(unittest.TestCase, MetadataAssertHelper):
|
|
|
119
121
|
exposure_id=53577,
|
|
120
122
|
exposure_group="53577",
|
|
121
123
|
exposure_time=200.0 * u.s,
|
|
124
|
+
exposure_time_requested=200.0 * u.s,
|
|
122
125
|
group_counter_end=53577,
|
|
123
126
|
group_counter_start=53577,
|
|
124
127
|
has_simulated_content=False,
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# This file is part of astro_metadata_translator.
|
|
2
|
+
#
|
|
3
|
+
# Developed for the LSST Data Management System.
|
|
4
|
+
# This product includes software developed by the LSST Project
|
|
5
|
+
# (http://www.lsst.org).
|
|
6
|
+
# See the LICENSE file at the top-level directory of this distribution
|
|
7
|
+
# for details of code ownership.
|
|
8
|
+
#
|
|
9
|
+
# Use of this source code is governed by a 3-clause BSD-style
|
|
10
|
+
# license that can be found in the LICENSE file.
|
|
11
|
+
|
|
12
|
+
import unittest
|
|
13
|
+
|
|
14
|
+
from astropy.coordinates import EarthLocation
|
|
15
|
+
from astropy.time import Time
|
|
16
|
+
|
|
17
|
+
from astro_metadata_translator import StubTranslator
|
|
18
|
+
from astro_metadata_translator.translators.helpers import altaz_from_degree_headers
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class HelperTranslator(StubTranslator):
|
|
22
|
+
"""Base class for testing shadowing."""
|
|
23
|
+
|
|
24
|
+
def to_instrument(self):
|
|
25
|
+
return "BaseInstrument"
|
|
26
|
+
|
|
27
|
+
def to_observation_type(self):
|
|
28
|
+
return "flat"
|
|
29
|
+
|
|
30
|
+
def to_observation_id(self):
|
|
31
|
+
return "OBSID"
|
|
32
|
+
|
|
33
|
+
def to_location(self):
|
|
34
|
+
return EarthLocation.from_geodetic(0.0, 0.0)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ScienceTranslator(HelperTranslator):
|
|
38
|
+
"""Translator corresponding to science observation."""
|
|
39
|
+
|
|
40
|
+
def to_observation_type(self):
|
|
41
|
+
return "science"
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class HelperTestCase(unittest.TestCase):
|
|
45
|
+
"""Test translator helpers."""
|
|
46
|
+
|
|
47
|
+
def assert_azel(self, azel, az, alt):
|
|
48
|
+
self.assertAlmostEqual(float(azel.az.to_value("deg")), az)
|
|
49
|
+
self.assertAlmostEqual(float(azel.alt.to_value("deg")), alt)
|
|
50
|
+
|
|
51
|
+
def test_altaz(self):
|
|
52
|
+
"""Test altaz extraction."""
|
|
53
|
+
translator = HelperTranslator({})
|
|
54
|
+
now = Time.now()
|
|
55
|
+
|
|
56
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now)
|
|
57
|
+
self.assertIsNone(value)
|
|
58
|
+
|
|
59
|
+
translator._header["AZSTART"] = -400.0
|
|
60
|
+
translator._header["ELSTART"] = 45.0
|
|
61
|
+
|
|
62
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now)
|
|
63
|
+
self.assertIsNone(value)
|
|
64
|
+
|
|
65
|
+
for alt, az in ((80.0, 300.0), (-1.0, 200.0)):
|
|
66
|
+
translator._header["AZSTART"] = az
|
|
67
|
+
translator._header["ELSTART"] = alt
|
|
68
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now, min_alt=-5.0)
|
|
69
|
+
self.assert_azel(value, az, alt)
|
|
70
|
+
|
|
71
|
+
translator._header["AZSTART"] = 22.0
|
|
72
|
+
translator._header["ELSTART"] = 34.0
|
|
73
|
+
value = altaz_from_degree_headers(translator, [("AZ1", "EL1"), ("ELSTART", "AZSTART")], now)
|
|
74
|
+
self.assert_azel(value, 22.0, 34.0)
|
|
75
|
+
|
|
76
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now, is_zd={"ELSTART"})
|
|
77
|
+
self.assert_azel(value, 22.0, 56.0)
|
|
78
|
+
|
|
79
|
+
translator._header["ELSTART"] = -1.0
|
|
80
|
+
with self.assertLogs():
|
|
81
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now, min_alt=-0.5)
|
|
82
|
+
self.assert_azel(value, 22.0, -0.5)
|
|
83
|
+
|
|
84
|
+
translator._header["ELSTART"] = 90.2
|
|
85
|
+
with self.assertLogs():
|
|
86
|
+
value = altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now, max_alt=95.0)
|
|
87
|
+
self.assert_azel(value, 22.0, 90.0)
|
|
88
|
+
|
|
89
|
+
def test_science_altaz(self):
|
|
90
|
+
"""Test science altaz."""
|
|
91
|
+
translator = ScienceTranslator({})
|
|
92
|
+
now = Time.now()
|
|
93
|
+
|
|
94
|
+
with self.assertRaises(KeyError):
|
|
95
|
+
altaz_from_degree_headers(translator, [("ELSTART", "AZSTART")], now)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
if __name__ == "__main__":
|
|
99
|
+
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_basics.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_cli.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_extensions.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_groups.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_headers.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_indexing.py
RENAMED
|
File without changes
|
{astro_metadata_translator-29.0.1 → astro_metadata_translator-29.2025.1700}/tests/test_shadowing.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|