Skip to content

Commit

Permalink
Merge pull request #448 from LSSTDESC/u/jchiang/add_LsstComCamSim
Browse files Browse the repository at this point in the history
add LsstComCamSim as a camera option
  • Loading branch information
jchiang87 authored Feb 17, 2024
2 parents 366a252 + 92b6078 commit 0e1f696
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 11 deletions.
207 changes: 207 additions & 0 deletions data/tree_ring_data/LsstComCamSim_tree_rings_2024-02-03.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
Rx Ry Sx Sy Cx Cy A B
2 2 0 0 3031.8 -2991.2 0.002 4.66e-18
CosFreq CosPhase SinFreq SinPhase
22.2 5.9 76.9 3.4
57.2 2.2 86.4 2.7
74.1 4.1 72.6 1.9
56.2 6.0 55.2 5.8
59.1 3.1 50.1 2.1
58.7 1.7 61.3 2.9
62.1 2.1 70.5 2.8
69.3 2.0 81.6 5.8
57.2 4.5 52.3 0.6
57.2 6.1 70.2 5.6
62.7 2.9 56.3 4.8
61.9 0.3 58.0 5.4
61.8 4.7 64.0 4.1
62.4 1.1 52.6 6.0
59.5 0.8 60.5 4.7
30.1 4.4 40.6 2.8
32.5 2.0 43.8 3.1
31.5 2.9 44.5 1.8
38.4 1.4 28.3 1.6
37.3 5.6 33.1 2.2
Rx Ry Sx Sy Cx Cy A B
2 2 0 1 2918.4 -2907.2 0.002 4.29e-18
CosFreq CosPhase SinFreq SinPhase
54.3 0.1 55.4 5.2
45.0 2.3 55.5 2.7
70.5 0.9 60.2 4.6
46.9 2.5 72.8 1.9
75.9 5.6 53.4 3.4
53.7 4.0 74.1 5.9
59.6 4.4 66.7 5.4
62.4 2.5 74.5 0.4
64.6 0.5 46.9 4.2
57.0 0.5 75.0 3.7
51.0 1.3 44.5 2.0
54.8 1.1 42.2 2.1
80.2 3.6 58.0 3.7
65.6 5.1 64.3 3.9
68.1 4.4 50.9 0.1
40.9 3.9 40.9 5.8
25.0 1.4 25.9 1.1
38.6 2.4 30.3 6.3
47.6 5.3 36.9 1.0
50.1 1.4 31.2 5.1
Rx Ry Sx Sy Cx Cy A B
2 2 0 2 3067.1 3074.2 0.002 4.01e-18
CosFreq CosPhase SinFreq SinPhase
60.9 4.5 50.0 1.5
74.7 3.7 30.7 2.5
76.9 4.5 47.7 2.6
47.9 2.7 59.9 5.7
65.6 5.6 58.5 3.1
52.9 3.7 70.5 4.1
52.7 4.9 62.0 1.7
44.8 2.0 57.3 1.4
41.9 3.4 57.5 0.9
70.2 3.6 88.9 3.8
65.0 3.8 52.8 3.8
65.8 5.6 58.1 2.0
47.8 1.8 68.3 5.2
43.8 2.2 69.0 5.4
73.4 1.5 62.8 4.5
24.3 3.6 26.4 2.1
35.7 2.3 49.0 4.1
21.4 3.8 40.6 1.6
36.4 4.6 50.8 1.6
43.7 0.2 12.3 4.8
Rx Ry Sx Sy Cx Cy A B
2 2 1 0 -2914.5 -2960.2 0.002 4.28e-18
CosFreq CosPhase SinFreq SinPhase
62.5 0.0 62.4 2.9
49.9 2.9 65.7 5.9
62.6 2.9 68.8 2.0
72.8 0.6 66.1 4.9
44.2 0.9 60.7 6.1
55.3 4.7 76.2 2.1
51.3 4.8 53.6 5.6
57.9 5.3 62.0 5.4
46.5 4.9 57.3 3.1
54.5 1.3 46.7 3.4
56.8 0.8 53.3 3.3
43.6 0.5 49.0 2.2
62.7 1.2 60.3 1.3
55.0 2.6 57.8 3.5
57.6 4.7 62.2 1.6
39.1 1.1 8.4 3.6
47.5 4.6 11.5 4.7
17.0 2.3 25.4 1.1
23.7 4.6 29.9 2.2
32.9 2.8 35.9 6.0
Rx Ry Sx Sy Cx Cy A B
2 2 1 1 -3042.6 -3075.4 0.002 4.74e-18
CosFreq CosPhase SinFreq SinPhase
60.5 2.3 63.3 0.9
57.9 3.5 55.2 3.8
56.8 0.4 62.0 3.2
56.4 5.8 58.8 3.8
39.2 2.7 59.5 4.4
46.8 5.8 61.4 5.5
49.3 0.8 43.2 2.3
51.6 5.3 73.3 1.3
70.4 4.6 58.4 0.9
64.5 3.6 71.1 0.7
66.2 2.0 58.0 2.1
63.3 1.7 62.0 4.8
54.1 4.6 65.8 2.2
76.7 1.7 54.4 5.1
59.5 2.0 54.1 1.1
27.4 1.6 29.5 1.3
33.6 2.3 35.3 3.6
29.9 5.5 53.0 1.9
15.0 1.3 42.6 1.2
51.1 2.5 -0.5 2.9
Rx Ry Sx Sy Cx Cy A B
2 2 1 2 -3066.3 2911.4 0.002 4.00e-18
CosFreq CosPhase SinFreq SinPhase
64.0 4.6 58.8 5.2
50.3 3.7 54.2 2.0
75.3 2.4 50.8 0.1
49.3 5.7 59.0 3.1
58.6 5.9 53.9 4.2
54.1 1.8 51.5 4.7
56.3 2.0 75.0 3.6
69.6 0.4 63.1 4.6
61.0 0.3 60.3 0.6
28.4 1.7 75.2 3.7
62.2 1.9 77.2 5.5
67.1 5.0 66.5 1.3
60.8 1.0 81.1 1.0
57.2 6.0 56.6 0.4
84.3 0.7 65.3 2.9
39.4 0.5 31.6 1.0
49.3 0.5 47.4 0.9
42.0 3.4 36.4 1.4
32.8 4.5 10.0 1.2
53.5 2.5 23.5 4.4
Rx Ry Sx Sy Cx Cy A B
2 2 2 0 -2984.8 -3091.2 0.002 4.37e-18
CosFreq CosPhase SinFreq SinPhase
49.8 4.3 52.0 2.4
59.0 4.9 61.4 3.4
50.6 2.8 89.2 5.1
64.0 5.4 61.3 2.6
48.9 5.2 50.8 0.9
58.7 0.4 77.9 0.4
48.4 3.4 59.8 1.2
63.5 3.8 49.3 6.1
58.0 4.7 59.8 5.4
60.3 0.3 55.5 5.1
59.8 0.5 57.3 1.1
49.3 0.7 65.2 2.3
42.1 3.8 67.9 5.6
65.9 3.8 51.8 2.2
63.1 0.3 48.3 1.7
39.0 5.1 23.4 0.9
39.8 3.7 51.7 1.5
11.1 1.4 19.5 5.8
31.8 5.4 35.2 1.5
28.8 3.1 38.9 3.4
Rx Ry Sx Sy Cx Cy A B
2 2 2 1 2925.4 2986.7 0.002 4.69e-18
CosFreq CosPhase SinFreq SinPhase
65.0 4.5 44.2 0.4
65.3 1.6 67.6 0.6
75.1 1.7 80.9 5.1
76.0 3.7 55.9 2.3
60.0 6.0 59.1 0.1
57.6 0.3 64.2 3.7
61.2 0.2 53.7 2.1
69.9 2.8 55.7 0.6
49.0 2.6 58.3 5.7
74.8 2.0 65.0 6.0
31.5 5.7 55.6 1.6
58.9 5.4 61.9 0.1
54.4 1.0 53.6 2.0
64.2 3.1 67.0 1.5
58.2 3.8 56.2 4.3
31.2 1.4 25.1 3.8
40.7 5.6 28.8 3.0
32.1 5.2 31.7 5.6
15.4 1.8 36.9 0.8
32.5 0.2 18.5 2.8
Rx Ry Sx Sy Cx Cy A B
2 2 2 2 2958.2 -3066.9 0.002 4.43e-18
CosFreq CosPhase SinFreq SinPhase
66.8 2.0 73.6 3.5
50.8 5.3 56.9 2.7
60.8 4.4 66.4 3.9
58.1 5.9 63.8 0.6
70.0 0.6 53.9 2.0
48.4 2.8 69.6 2.0
55.4 3.3 72.3 5.5
61.8 5.2 61.3 0.5
49.5 1.9 62.9 0.4
56.4 1.7 38.6 0.6
66.4 0.1 58.8 5.5
63.5 1.4 55.0 5.5
64.1 2.5 73.2 5.6
55.3 4.8 48.0 0.8
72.8 5.1 60.7 1.3
26.0 2.7 60.2 1.5
42.6 6.1 48.9 5.6
26.3 0.3 44.3 4.9
15.0 1.8 16.8 3.4
35.4 5.4 26.7 0.9
4 changes: 2 additions & 2 deletions imsim/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ def get_camera(camera='LsstCam'):
----------
camera : str
The class name of the LSST camera object. Valid names
are 'LsstCam', 'LsstComCam', 'LsstCamImSim'. [default: 'LsstCam']
are 'LsstCam', 'LsstCamImSim', 'LsstComCamSim'. [default: 'LsstCam']
Returns
-------
lsst.afw.cameraGeom.Camera
"""
valid_cameras = ('LsstCam', 'LsstComCam', 'LsstCamImSim')
valid_cameras = ('LsstCam', 'LsstCamImSim', 'LsstComCamSim')
if camera not in valid_cameras:
raise ValueError('Invalid camera: %s', camera)
if camera not in _camera_cache:
Expand Down
3 changes: 1 addition & 2 deletions imsim/ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,8 @@ def parse(item, type, default):
dayobs = astropy.time.Time(mjd_obs, format='mjd').strftime('%Y%m%d')
image.header['DAYOBS'] = dayobs
image.header['SEQNUM'] = seqnum
image.header['CONTRLLR'] = 'P', 'simulated data'
image.header['CONTRLLR'] = 'S', 'simulated data'
image.header['RUNNUM'] = parse('observationId', int, -999)
image.header['OBSID'] = f"IM_P_{dayobs}_{seqnum:06d}"
image.header['IMGTYPE'] = parse('image_type', str, 'SKYEXP')
image.header['REASON'] = parse('reason', str, 'survey')
image.header['RATEL'] = ratel
Expand Down
16 changes: 11 additions & 5 deletions imsim/readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def make_batoid_wcs(ra0, dec0, rottelpos, obsmjd, band, camera_name,
One of `ugrizy`.
camera_name : str ['LsstCam']
Class name of the camera to be simulated. Valid values are
'LsstCam', 'LsstComCam', 'LsstCamImSim'.
'LsstCam', 'LsstCamImSim', 'LsstComCamSim'.
logger : logger.Logger [None]
Logger object.
Expand Down Expand Up @@ -112,7 +112,7 @@ def compute_rotSkyPos(ra0, dec0, rottelpos, obsmjd, band,
One of `ugrizy`.
camera_name : str ['LsstCam']
Class name of the camera to be simulated. Valid values are
'LsstCam', 'LsstComCam', 'LsstCamImSim'.
'LsstCam', 'LsstCamImSim', 'LsstComCamSim'.
dxy : float [100]
Size (in pixels) of legs of the triangle to use for computing the
angle between North and the +y direction in the focal plane.
Expand Down Expand Up @@ -228,7 +228,6 @@ def get_primary_hdu(eimage, lsst_num, camera_name=None,
"""
phdu = fits.PrimaryHDU()
phdu.header['RUNNUM'] = eimage.header['RUNNUM']
phdu.header['OBSID'] = eimage.header['OBSID']
phdu.header['MJD'] = eimage.header['MJD']
date = Time(eimage.header['MJD'], format='mjd')
phdu.header['DATE'] = date.isot
Expand Down Expand Up @@ -268,16 +267,18 @@ def get_primary_hdu(eimage, lsst_num, camera_name=None,
phdu.header['SENSNAME'] = sensor
phdu.header['RATEL'] = ratel
phdu.header['DECTEL'] = dectel
elif camera_name == 'LsstComCam':
telcode = 'MC'
elif camera_name == 'LsstComCamSim' :
phdu.header['FILTER'] = ComCam_filter_map.get(band, None)
phdu.header['TELESCOP'] = SIMONYI_TELESCOPE
phdu.header['INSTRUME'] = 'ComCam'
phdu.header['INSTRUME'] = 'ComCamSim'
phdu.header['RAFTBAY'] = raft
phdu.header['CCDSLOT'] = sensor
phdu.header['RA'] = ratel
phdu.header['DEC'] = dectel
phdu.header['ROTCOORD'] = 'sky'
phdu.header['ROTPA'] = rotang
telcode = 'CC'
else:
phdu.header['FILTER'] = LSSTCam_filter_map.get(band, None)
phdu.header['INSTRUME'] = 'LSSTCam'
Expand All @@ -286,6 +287,11 @@ def get_primary_hdu(eimage, lsst_num, camera_name=None,
phdu.header['RA'] = ratel
phdu.header['DEC'] = dectel
phdu.header['ROTCOORD'] = 'sky'
telcode = 'MC'
dayobs = eimage.header['DAYOBS']
seqnum = eimage.header['SEQNUM']
contrllr = eimage.header['CONTRLLR']
phdu.header['OBSID'] = f"{telcode}_{contrllr}_{dayobs}_{seqnum:06d}"
phdu.header['MJD-OBS'] = mjd_obs
phdu.header['HASTART'] = eimage.header['HASTART']
phdu.header['HAEND'] = eimage.header['HAEND']
Expand Down
2 changes: 1 addition & 1 deletion imsim/telescope_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def __init__(
match camera:
case 'LsstCam':
cameraName = 'LSSTCamera'
case 'LsstComCam':
case 'LsstComCamSim':
cameraName = 'ComCam'
case _:
cameraName = camera
Expand Down
2 changes: 1 addition & 1 deletion tests/data/eimage_00449053-1-r-R22_S11-det094.fits

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions tests/test_raw_file_writing.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def test_raw_file_writing(self):
self.assertAlmostEqual(hdr['RA'], eimage.header['RATEL'])
self.assertAlmostEqual(hdr['DEC'], eimage.header['DECTEL'])

self.assertTrue(hdr["OBSID"].startswith('MC_S'))

self.assertEqual(hdr['CHIPID'], det_name)

# Ensure the following keywords are set.
Expand Down

0 comments on commit 0e1f696

Please sign in to comment.