Skip to content

Commit

Permalink
Add # syntax for GROUPID and check a date style one for future
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Jan 27, 2020
1 parent 2bd4d75 commit 9254cc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions python/lsst/obs/lsst/translators/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
TZERO_DATETIME = TZERO.to_datetime()

# Regex to use for parsing a GROUPID string
GROUP_RE = re.compile(r"^(\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d)\.(\d\d\d)(?:\+(\d+))?$")
GROUP_RE = re.compile(r"^(\d\d\d\d\-\d\d\-\d\dT\d\d:\d\d:\d\d)\.(\d\d\d)(?:[\+#](\d+))?$")

# LSST Default location in the absence of headers
LSST_LOCATION = EarthLocation.from_geodetic(-70.749417, -30.244639, 2663.0)
Expand Down Expand Up @@ -562,8 +562,8 @@ def to_visit_id(self):
tdelta = iso - TZERO_DATETIME
epoch = int(tdelta.total_seconds())

# Form the integer from EPOCH + 3 DIGIT FRAC + N
visit_id = int(f"{epoch}{fraction}{n:03d}")
# Form the integer from EPOCH + 3 DIGIT FRAC + 0-pad N
visit_id = int(f"{epoch}{fraction}{n:04d}")
else:
# Non-standard string so convert to numbers
# using a hash function. Use the first N hex digits
Expand Down
2 changes: 1 addition & 1 deletion tests/headers/latiss-future.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DATE-END: '2020-03-29T16:57:37.055'
MJD: 58937.7067137073
MJD-OBS: 58937.7066788773
OBSID: AT_X_20200329_000022
GROUPID: 'AGROUPID'
GROUPID: '2020-03-29T16:55:00.012#24'
OBSTYPE: 'bias'
BUNIT: adu
TELESCOP: LSST AuxTelescope
Expand Down
4 changes: 2 additions & 2 deletions tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_latiss_translator(self):
detector_num=0,
detector_serial="ITL-3800C-068",
exposure_id=2020032900022,
exposure_group="AGROUPID",
exposure_group="2020-03-29T16:55:00.012#24",
exposure_time=0.0*u.s,
object="UNKNOWN",
observation_id="AT_X_20200329_000022",
Expand All @@ -260,7 +260,7 @@ def test_latiss_translator(self):
relative_humidity=None,
science_program="unknown",
temperature=None,
visit_id=929185300867117708,
visit_id=1654305000120024,
)),
("latiss-AT_O_20191031_000004.yaml",
dict(telescope="LSSTAuxTel",
Expand Down

0 comments on commit 9254cc4

Please sign in to comment.