def make_instance_catalog(self, obsHistID, band, boundLength, outfile=None):
"""
Method to create instance catalogs.
Parameters
----------
obsHistID : int
obsHistID for the desired visit from the opsim db file.
band : str
Desired LSST filter to use, ugrizy.
boundLength : float
Radius in degrees of sky cone in which to produce objects.
outfile : str, optional
File name of the instance catalog to be produced. If None,
a default name will be generated, e.g.,
phosim_input_0000230_r_0.3deg.txt.
"""
if outfile is None:
outfile = 'phosim_input_%07i_%s_%.1fdeg.txt' % (obsHistID, band,
boundLength)
obs_md = self.gen.getObservationMetaData(obsHistID=obsHistID,
boundLength=boundLength)[0]
do_header = True
for objid in self.star_objs:
self.logger.info("processing %s", objid)
db_obj = CatalogDBObject.from_objid(objid, **self.db_config)
phosim_object = PhoSimCatalogPoint(db_obj, obs_metadata=obs_md)
if do_header:
with open(outfile, 'w') as file_obj:
phosim_object.write_header(file_obj)
do_header = False
phosim_object.write_catalog(outfile, write_mode='a',
write_header=False,
chunk_size=20000)
for objid in self.gal_objs:
self.logger.info("processing %s", objid)
db_obj = CatalogDBObject.from_objid(objid, **self.db_config)
phosim_object = PhoSimCatalogSersic2D(db_obj, obs_metadata=obs_md)
phosim_object.write_catalog(outfile, write_mode='a',
write_header=False,
chunk_size=20000)
评论列表
文章目录