Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config/imsim-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ output:
nproc: 1 # Change this to work on multiple CCDs at once.
#nfiles: 1 # Default is all 189 CCDs. Set to 1 while testing.

camera: LsstCam
camera: LsstCamSim

exptime: $exptime

Expand Down
2 changes: 1 addition & 1 deletion data/LsstCamSim_info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ tree_rings_file_name: tree_ring_parameters_2018-04-26.txt
vignetting_file_name: LSSTCam_vignetting_data.json
telescope_format: LSST_%s.yaml
bias_levels_file: LSSTCam_bias_levels_run_13421.json
camera_name: LsstCam
camera_name: LsstCamSim
ndets: 189
2 changes: 1 addition & 1 deletion examples/flat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ output:
nproc: 1 # Change this to work on multiple CCDs at once.
nfiles: 1 # Default is all 189 CCDs. Set to 1 while testing.

camera: LsstCam
camera: LsstCamSim

exptime: 30

Expand Down
2 changes: 1 addition & 1 deletion examples/flat_with_sed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ output:
nproc: 1 # Change this to work on multiple CCDs at once.
nfiles: 1 # Default is all 189 CCDs. Set to 1 while testing.

camera: LsstCam
camera: LsstCamSim

exptime: 30

Expand Down
2 changes: 1 addition & 1 deletion imsim/bandpass.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def RubinBandpass(
if (camera is None) != (det_name is None):
raise ValueError("Must provide both camera and det_name if using one.")
match camera:
case 'LsstCam' | 'LsstCamSim' :
case 'LsstCamSim' :
camera = 'lsstCam'
case 'LsstComCamSim':
camera = 'comCamSim'
Expand Down
4 changes: 2 additions & 2 deletions imsim/batoid_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def buildWCS(self, config, base, logger):

kwargs, safe = galsim.config.GetAllParams(config, base, req=req, opt=opt)
kwargs['bandpass'] = base.get('bandpass', None)
kwargs['camera'] = kwargs.pop('camera', 'LsstCam')
kwargs['camera'] = kwargs.pop('camera', 'LsstCamSim')
if (self._camera is not None and self._camera_name != kwargs['camera']):
self._camera_name = kwargs['camera']
self._camera = get_camera(self._camera_name)
Expand All @@ -567,7 +567,7 @@ def buildWCS(self, config, base, logger):

def makeWCSFactory(
self, boresight, obstime, telescope,
camera='LsstCam',
camera='LsstCamSim',
temperature=None, pressure=None, H2O_pressure=None,
wavelength=None, bandpass=None
):
Expand Down
6 changes: 3 additions & 3 deletions imsim/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def __getattr__(self, attr):


_camera_cache = {}
def get_camera(camera='LsstCam'):
def get_camera(camera='LsstCamSim'):
"""
Return an lsst camera object.

Expand All @@ -162,7 +162,7 @@ def get_camera(camera='LsstCam'):
-------
lsst.afw.cameraGeom.Camera
"""
valid_cameras = ('LsstCam', 'LsstCamSim', 'LsstCamImSim', 'LsstComCamSim')
valid_cameras = ('LsstCamSim', 'LsstComCamSim')
if camera not in valid_cameras:
raise ValueError('Invalid camera: %s', camera)
if camera not in _camera_cache:
Expand All @@ -175,7 +175,7 @@ class Camera(dict):
Class to represent the LSST Camera as a dictionary of CCD objects,
keyed by the CCD name in the focal plane, e.g., 'R01_S00'.
"""
def __init__(self, camera_class='LsstCam', bias_levels_file=None,
def __init__(self, camera_class='LsstCamSim', bias_levels_file=None,
bias_level=1000.0):
"""
Initialize a Camera object from the lsst instrument class.
Expand Down
2 changes: 1 addition & 1 deletion imsim/ccd.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def setup(self, config, base, file_num, logger):
if 'camera' in config:
camera_name = galsim.config.ParseValue(config, 'camera', base, str)[0]
else:
camera_name = 'LsstCam'
camera_name = 'LsstCamSim'
camera = get_camera(camera_name)
if 'only_dets' in config:
only_dets = config['only_dets']
Expand Down
4 changes: 2 additions & 2 deletions imsim/lsst_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def setup(self, config, base, image_num, obj_num, ignore, logger):
ysize = params.get('ysize',size)

self.det_name = params['det_name']
self.camera_name = params.get('camera', 'LsstCam')
self.camera_name = params.get('camera', 'LsstCamSim')

# If not overridden, then get size from the camera.
camera = get_camera(self.camera_name)
Expand All @@ -88,7 +88,7 @@ def setup(self, config, base, image_num, obj_num, ignore, logger):
else:
self.boresight = params.get('boresight')

self.camera_name = params.get('camera', 'LsstCam')
self.camera_name = params.get('camera', 'LsstCamSim')

# If using a SiliconSensor and not overridden in config, determine sensor type to use.
if (
Expand Down
41 changes: 10 additions & 31 deletions imsim/readout.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def make_batoid_wcs(ra0, dec0, rottelpos, obsmjd, band, camera_name,
MJD of the observation (TAI scale).
band : str
One of `ugrizy`.
camera_name : str ['LsstCam']
camera_name : str ['LsstCamSim']
Class name of the camera to be simulated. Valid values are
'LsstCam', 'LsstCamImSim', 'LsstComCamSim'.
'LsstCamSim', 'LsstComCamSim'.
logger : logger.Logger [None]
Logger object.

Expand Down Expand Up @@ -92,7 +92,7 @@ def make_batoid_wcs(ra0, dec0, rottelpos, obsmjd, band, camera_name,


def compute_rotSkyPos(ra0, dec0, rottelpos, obsmjd, band,
camera_name='LsstCam', dxy=100, pixel_scale=0.2,
camera_name='LsstCamSim', dxy=100, pixel_scale=0.2,
logger=None):
"""
Compute the nominal rotation angle of the focal plane wrt
Expand All @@ -111,9 +111,9 @@ def compute_rotSkyPos(ra0, dec0, rottelpos, obsmjd, band,
MJD of the observation.
band : str
One of `ugrizy`.
camera_name : str ['LsstCam']
camera_name : str ['LsstCamSim']
Class name of the camera to be simulated. Valid values are
'LsstCam', 'LsstCamImSim', 'LsstComCamSim'.
'LsstCamSim', '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 @@ -142,12 +142,6 @@ def compute_rotSkyPos(ra0, dec0, rottelpos, obsmjd, band,
)
theta = 270 - rottelpos + np.rad2deg(factory.pq)

if camera_name == 'LsstCamImSim':
# For historical reasons, the rotation angle for imSim data is
# assumed by the LSST code to have a sign change and 90
# rotation. See
# https://github.com/lsst/obs_lsst/blob/main/python/lsst/obs/lsst/translators/imsim.py#L104
theta = 90 - theta
if theta < 0:
theta += 360
_rotSkyPos_cache[args] = theta
Expand Down Expand Up @@ -250,15 +244,7 @@ def get_primary_hdu(eimage, lsst_num, camera_name=None,
logger=logger
)
phdu.header['ROTANGLE'] = rotang
if camera_name == 'LsstCamImSim':
phdu.header['FILTER'] = band
phdu.header['TESTTYPE'] = 'IMSIM'
phdu.header['RAFTNAME'] = raft
phdu.header['SENSNAME'] = sensor
phdu.header['RATEL'] = ratel
phdu.header['DECTEL'] = dectel
telcode = 'MC'
elif camera_name == 'LsstComCamSim' :
if camera_name == 'LsstComCamSim' :
phdu.header['FILTER'] = ComCam_filter_map.get(band, None)
phdu.header['INSTRUME'] = 'ComCamSim'
phdu.header['RAFTBAY'] = raft
Expand All @@ -270,10 +256,7 @@ def get_primary_hdu(eimage, lsst_num, camera_name=None,
telcode = 'CC'
else:
phdu.header['FILTER'] = LSSTCam_filter_map.get(band, None)
if camera_name == 'LsstCamSim':
phdu.header['INSTRUME'] = 'LSSTCamSim'
else:
phdu.header['INSTRUME'] = 'LSSTCam'
phdu.header['INSTRUME'] = 'LSSTCamSim'
phdu.header['RAFTBAY'] = raft
phdu.header['CCDSLOT'] = sensor
phdu.header['RA'] = ratel
Expand Down Expand Up @@ -353,7 +336,7 @@ def __init__(self, eimage, logger, camera=None,
The eimage with the rendered scene, wcs, and header information.
logger : logging.Logger
Logger object
camera : str, Camera class to use, e.g., 'LsstCam', 'LsstCamImSim'.
camera : str, Camera class to use, e.g., 'LsstCamSim', 'LsstComCamSim'.
[default: use the camera from the eimage header]
readout_time: float (seconds) [default: 2.0]
dark_current: float (e-/s) [default: 0.02]
Expand Down Expand Up @@ -505,12 +488,8 @@ def prepare_hdus(self, rng):
# Build HDUs.
channels = '10 11 12 13 14 15 16 17 07 06 05 04 03 02 01 00'.split()
x_seg_offset = (1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1)
if self.camera_name == 'LsstCamImSim':
y_seg_offset = (0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2)
cd_matrix_sign = -1
else:
y_seg_offset = (2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0)
cd_matrix_sign = 1
y_seg_offset = (2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0)
cd_matrix_sign = 1
wcs = self.eimage.wcs
crpix1, crpix2 = wcs.crpix

Expand Down
2 changes: 1 addition & 1 deletion imsim/stamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def setup(self, config, base, xsize, ysize, ignore, logger):
self.rng = galsim.config.GetRNG(config, base, logger, "LSST_Silicon")
bandpass = base['bandpass']
self.image = base['current_image']
camera = get_camera(params.get('camera', 'LsstCam'))
camera = get_camera(params.get('camera', 'LsstCamSim'))
if self.vignetting:
self.det = camera[params['det_name']]
if hasattr(obj, 'flux'):
Expand Down
4 changes: 2 additions & 2 deletions imsim/telescope_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,15 +370,15 @@ def __init__(
file_name,
perturbations=(),
rotTelPos=None,
camera='LsstCam',
camera='LsstCamSim',
builder_kwargs=None,
fea_perturbations=None,
focusZ=None,
logger=None
):
# Batoid has a different name for LsstCam than DM code. So we need to switch it here.
match camera:
case 'LsstCam':
case 'LsstCamSim':
cameraName = 'LSSTCamera'
case 'LsstComCamSim':
cameraName = 'ComCam'
Expand Down
Binary file modified tests/data/eimage_00449053-1-r-R22_S11-det094.fits.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/test_batoid_wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def test_config():
'wcs': {
'type': 'Batoid',
'boresight': boresight,
'camera': 'LsstCam',
'camera': 'LsstCamSim',
'obstime': obstime,
'wavelength': wavelength,
'temperature': temperature,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_bias_levels(self):
with open(os.path.join(DATA_DIR, bias_levels_file)) as fobj:
bias_levels = json.load(fobj)

camera = imsim.Camera('LsstCam', bias_levels_file=bias_levels_file)
camera = imsim.Camera('LsstCamSim', bias_levels_file=bias_levels_file)
for det_name, ccd in camera.items():
for amp_name, amp in ccd.items():
self.assertEqual(bias_levels[det_name][amp_name],
Expand All @@ -29,7 +29,7 @@ def test_bias_levels(self):
# Check that a full path to the bias_levels_file can be used.
bias_levels_file = os.path.join(DATA_DIR,
'LSSTCam_bias_levels_run_13421.json')
camera = imsim.Camera('LsstCam', bias_levels_file=bias_levels_file)
camera = imsim.Camera('LsstCamSim', bias_levels_file=bias_levels_file)

for det_name, ccd in camera.items():
for amp_name, amp in ccd.items():
Expand All @@ -38,7 +38,7 @@ def test_bias_levels(self):

# Check that a single bias level for all amps can be set.
bias_level = 1234.
camera = imsim.Camera('LsstCam', bias_level=bias_level)
camera = imsim.Camera('LsstCamSim', bias_level=bias_level)
for det_name, ccd in camera.items():
for amp_name, amp in ccd.items():
self.assertEqual(bias_level, amp.bias_level)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_diffraction_fft.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_test_config(
}
},
"det_name": det_name,
"output": {"camera": "LsstCam"},
"output": {"camera": "LsstCamSim"},
"_icrf_to_field": wcs_factory.get_icrf_to_field(camera),
}
alt_az = {
Expand All @@ -86,7 +86,7 @@ def create_test_config(
{
**optics_args,
"boresight": boresight,
"camera": "LsstCam",
"camera": "LsstCamSim",
},
]
}
Expand Down
6 changes: 3 additions & 3 deletions tests/test_fringing.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_fringing():
# Testing a CCD with an arbitrary location on the focal plane.
ra = 54.86
dec = -35.76
wcs = make_batoid_wcs(ra, dec, rottelpos, mjd, band, 'LsstCam')
wcs = make_batoid_wcs(ra, dec, rottelpos, mjd, band, 'LsstCamSim')

config = {
'image': {
Expand Down Expand Up @@ -99,7 +99,7 @@ def test_fringing():
# Try another random location on the focal plane.
ra = 58.86
dec = -38.76
wcs = make_batoid_wcs(ra, dec, rottelpos, mjd, band, 'LsstCam')
wcs = make_batoid_wcs(ra, dec, rottelpos, mjd, band, 'LsstCamSim')

ccd_fringing_2 = CCD_Fringing(true_center=image.wcs.toWorld(image.true_center),
boresight=world_center,
Expand Down Expand Up @@ -138,4 +138,4 @@ def test_fringing_variation_level():

if __name__ == '__main__':
test_fringing()
test_fringing_variation_level()
test_fringing_variation_level()
2 changes: 1 addition & 1 deletion tests/test_header_keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def run_imsim(camera):


def test_header_keywords():
run_imsim('LsstCam')
run_imsim('LsstCamSim')
fits_dir = 'fits_header_test'
eimage_file = glob.glob(os.path.join(fits_dir, 'eimage*.fits'))[0]
with fits.open(eimage_file) as hdus:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def create_test_config(
}
if stamp_type == "LSST_Photons":
output_config = {
"camera": "LsstCam",
"camera": "LsstCamSim",
"photon_pooling_truth": {
"dir": "output",
"file_name": "test-truth.txt",
Expand All @@ -87,7 +87,7 @@ def create_test_config(
},
}
else:
output_config = {"camera": "LsstCam"}
output_config = {"camera": "LsstCamSim"}
config = {
"input": {
"telescope": {
Expand Down Expand Up @@ -146,7 +146,7 @@ def create_test_config(
{
**optics_args,
"boresight": boresight,
"camera": "LsstCam",
"camera": "LsstCamSim",
},
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_lsst_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_image_nobjects():
logger.addHandler(logging.StreamHandler(sys.stdout))
logger.setLevel(logging.CRITICAL) # silence the log messages

camera = "LsstCam"
camera = "LsstCamSim"
output_dir = f"fits_{camera}"

# Loop over values of image.nobjects that bracket the expected number
Expand Down
Loading
Loading