Skip to content

Commit

Permalink
Use astropy.time instead of datetime in upload.py LATISS.
Browse files Browse the repository at this point in the history
The private_sndStamp field is populated by converting an ISO 8601
string to a Unix epoch. To avoid any complications in the future, we
should do the conversion in a TAI-aware way.
  • Loading branch information
kfindeisen committed Jan 26, 2024
1 parent 76ae49c commit 584c381
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python/tester/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.

import dataclasses
import datetime
import itertools
import json
import logging
Expand All @@ -30,6 +29,7 @@
import tempfile
import time

import astropy.time
import boto3
from botocore.handlers import validate_bucket_name

Expand Down Expand Up @@ -290,7 +290,7 @@ def get_samples_lsst(bucket, instrument):
dome=FannedOutVisit.Dome.OPEN,
duration=float(EXPOSURE_INTERVAL+SLEW_INTERVAL),
totalCheckpoints=1,
private_sndStamp=datetime.datetime.fromisoformat(md["DATE-BEG"]).timestamp(),
private_sndStamp=astropy.time.Time(md["DATE-BEG"], format="isot", scale="tai").unix_tai,
)
_log.debug(f"File {blob.key} parsed as visit {visit} and registered as group {md['GROUPID']}.")
result[md["GROUPID"]] = {0: {visit: blob}}
Expand Down

0 comments on commit 584c381

Please sign in to comment.