38
38
39
39
from shared .raw import (
40
40
LSST_REGEXP ,
41
- IMSIM_REGEXP ,
42
41
OTHER_REGEXP ,
43
42
get_raw_path ,
44
43
_LSST_CAMERA_LIST ,
51
50
get_last_group ,
52
51
increment_group ,
53
52
make_exposure_id ,
54
- make_imsim_time_headers ,
55
53
replace_header_key ,
56
54
send_next_visit ,
57
55
)
69
67
_log .setLevel (logging .INFO )
70
68
71
69
72
- def process_group (kafka_url , visit_infos , uploader , start_time ):
70
+ def process_group (kafka_url , visit_infos , uploader ):
73
71
"""Simulate the observation of a single on-sky pointing.
74
72
75
73
Parameters
@@ -83,8 +81,6 @@ def process_group(kafka_url, visit_infos, uploader, start_time):
83
81
uploader : callable [`shared.visit.FannedOutVisit`, int]
84
82
A callable that takes an exposure spec and a snap ID, and uploads the
85
83
visit's data.
86
- start_time : `float`
87
- The Unix time (TAI) of the exposure start.
88
84
"""
89
85
# Assume group/snaps is shared among all visit_infos
90
86
for info in visit_infos :
@@ -110,7 +106,7 @@ def process_group(kafka_url, visit_infos, uploader, start_time):
110
106
for info in visit_infos :
111
107
_log .info (f"Uploading group: { info .groupId } snap: { snap } filters: { info .filters } "
112
108
f"detector: { info .detector } " )
113
- uploader (info , snap , start_time )
109
+ uploader (info , snap )
114
110
_log .info (f"Uploaded group: { info .groupId } snap: { snap } filters: { info .filters } "
115
111
f"detector: { info .detector } " )
116
112
@@ -284,10 +280,7 @@ def get_samples_lsst(bucket, instrument):
284
280
for blob in blobs :
285
281
# Assume that the unobserved bucket uses the same filename scheme as
286
282
# the observed bucket.
287
- if instrument == "LSSTCam-imSim" :
288
- m = re .match (IMSIM_REGEXP , blob .key )
289
- else :
290
- m = re .match (LSST_REGEXP , blob .key )
283
+ m = re .match (LSST_REGEXP , blob .key )
291
284
if not m or m ["extension" ] == ".json" :
292
285
continue
293
286
@@ -302,10 +295,7 @@ def get_samples_lsst(bucket, instrument):
302
295
303
296
sal_index = INSTRUMENTS [instrument ].sal_index
304
297
# Use special sal_index to indicate a subset of detectors
305
- if instrument == "LSSTCam-imSim" :
306
- # For imSim data, the OBSID header has the exposure ID.
307
- sal_index = int (md ["OBSID" ])
308
- elif instrument == "LSSTCam" :
298
+ if instrument == "LSSTCam" :
309
299
_ , _ , day_obs , seq_num = md ["OBSID" ].split ("_" )
310
300
exposure_num = LsstBaseTranslator .compute_exposure_id (int (day_obs ), int (seq_num ))
311
301
sal_index = exposure_num
@@ -382,18 +372,11 @@ def upload_from_raws(kafka_url, instrument, raw_pool, src_bucket, dest_bucket, n
382
372
# Copy all the visit-blob dictionaries under each snap_id,
383
373
# replacing the (immutable) FannedOutVisit objects to point to group
384
374
# instead of true_group.
385
- # Update next_visit timestamp for LSSTCam-imSim only.
386
- now = astropy .time .Time .now ().unix_tai
387
- start_time = now + 2 * (EXPOSURE_INTERVAL + SLEW_INTERVAL )
388
375
for snap_id , old_visits in raw_pool [true_group ].items ():
389
376
snap_dict [snap_id ] = {
390
377
dataclasses .replace (
391
378
true_visit ,
392
379
groupId = group ,
393
- ** ({
394
- "startTime" : start_time ,
395
- "private_sndStamp" : now
396
- } if instrument == "LSSTCam-imSim" else {})
397
380
): blob
398
381
for true_visit , blob in old_visits .items ()}
399
382
# Gather all the FannedOutVisit objects found in snap_dict, merging
@@ -402,14 +385,11 @@ def upload_from_raws(kafka_url, instrument, raw_pool, src_bucket, dest_bucket, n
402
385
403
386
# TODO: may be cleaner to use a functor object than to depend on
404
387
# closures for the buckets and data.
405
- def upload_from_pool (visit , snap_id , start_time ):
388
+ def upload_from_pool (visit , snap_id ):
406
389
src_blob = snap_dict [snap_id ][visit ]
407
390
exposure_num , headers = \
408
391
make_exposure_id (visit .instrument , visit .groupId , snap_id )
409
- # Only LSSTCam-imSim uses the given timestamp for the exposure start.
410
- # Other instruments keep the original exposure timespan.
411
- if instrument == "LSSTCam-imSim" :
412
- headers .update (make_imsim_time_headers (EXPOSURE_INTERVAL , start_time ))
392
+ # The original exposure timespan is kept.
413
393
filename = get_raw_path (visit .instrument , visit .detector , visit .groupId , snap_id ,
414
394
exposure_num , visit .filters )
415
395
@@ -433,7 +413,7 @@ def upload_from_pool(visit, snap_id, start_time):
433
413
dest_bucket .upload_fileobj (buffer , filename )
434
414
_log .debug (f"{ filename } is uploaded to { dest_bucket } " )
435
415
436
- process_group (kafka_url , visit_infos , upload_from_pool , start_time )
416
+ process_group (kafka_url , visit_infos , upload_from_pool )
437
417
438
418
439
419
if __name__ == "__main__" :
0 commit comments