Skip to content
Draft
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
17 changes: 16 additions & 1 deletion imsim/instcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def _load(self, logger=None):
'point' : 13,
'sersic2d' : 17,
'knots' : 17,
'streak' : 16
}
default_dust_index = 15 # For fits files

Expand Down Expand Up @@ -264,7 +265,10 @@ def _load(self, logger=None):
sed = ((tokens[5], float(tokens[6])))
# gamma1,gamma2,kappa
lens = (float(tokens[7]), g2_sign*float(tokens[8]), float(tokens[9]))
# what are 10,11?
# Columns 10 and 11 are delta_ra, delta_dec, which
# are additional offsets in RA, Dec, optionally
# used by phosim. imSim does not use these
# columns.
dust_index = dust_index_dict.get(tokens[12].lower(), default_dust_index)
objinfo = tokens[12:dust_index]
dust = tokens[dust_index:]
Expand Down Expand Up @@ -480,6 +484,17 @@ def getObj(self, index, gsparams=None, rng=None, exptime=30, logger=None):
if params[0].lower() == 'point':
obj = galsim.DeltaFunction(gsparams=gsparams)

elif params[0].lower() == 'streak':
# Note that satellite streaks are not sources at infinity
# and so would be out-of-focus compared to stars or
# galaxies and would therefore have a different PSF. This
# implementation does not account for that difference.
length = float(params[1])
width = float(params[2])
obj = galsim.Box(length, width, gsparams=gsparams)
position_angle = galsim.Angle(float(params[3]), galsim.degrees)
obj = obj.rotate(position_angle)

elif params[0].lower() == 'sersic2d':
a = float(params[1])
b = float(params[2])
Expand Down
22 changes: 22 additions & 0 deletions tests/data/satellite_streak.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
rightascension 53.00913847303155535
declination -27.43894880881512321
mjd 59580.13974597222113516
altitude 66.34657337061349835
azimuth 270.27655488919378968
filter 2
rotskypos 256.75075318193080420
dist2moon 124.2838277
moonalt -36.1323801
moondec -23.4960252
moonphase 3.8193650
moonra 256.4036553
nsnap 2
seqnum 0
obshistid 230
rottelpos 0.0000000
seed 230
seeing 0.8662850
sunalt -32.7358290
vistime 33.0000000
# object id ra dec magnorm SED_file redshift gamma1 gamma2 kappa delta_ra delta_dec source_type length(arcsec) width(arcsec) position_angle(degrees)
object 0 53.00913847303155535 -27.43894880881512321 16.0 starSED/phoSimMLT/lte034-4.5-1.0a+0.4.BT-Settl.spec.gz 0 0 0 0 0 0 streak 600 1e-6 0 none none
13 changes: 13 additions & 0 deletions tests/test_instcat_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,19 @@ def test_radec_clarification(self):
]
)

def test_satellite_streaks(self):
"""Test satellite streak modeling."""
cat_file = os.path.join(self.data_dir, "satellite_streak.txt")
sed_dir = os.path.join(self.data_dir, 'test_sed_library')
det_name = "R22_S11"
wcs = self.make_wcs(instcat_file=cat_file,
sensors=[det_name])[det_name]
cat = imsim.InstCatalog(cat_file, wcs, sed_dir=sed_dir)
self.assertEqual(cat.getNObjects(), 1)
self.assertTrue((cat.objinfo == np.array(['streak', '600', '1e-6', '0'])).all())
obj = cat.getObj(0)
self.assertTrue(isinstance(obj.original.original, galsim.Box))


if __name__ == '__main__':
unittest.main()