161 def run(self, mask, seed, catalog=None):
162 """Generate a list of Footprints of sky sources/objects.
163
164 Sky objects don't overlap with other objects. This is determined
165 through the provided `mask` (in which objects are typically flagged
166 as `DETECTED`).
167
168 Sky objects are positioned using a quasi-random Halton sequence
169 number generator. This is a deterministic sequence that mimics a random
170 trial and error approach whilst acting to minimize clustering of points
171 for a given field of view. Up to `nTrialSources` points are generated,
172 returning the first `nSources` that do not overlap with the mask.
173
174 Parameters
175 ----------
176 mask : `lsst.afw.image.Mask`
177 Input mask plane, which identifies pixels to avoid for the sky
178 objects.
179 seed : `int`
180 Random number generator seed.
181 catalog : `lsst.afw.table.SourceCatalog`, optional
182 Catalog to add detected footprints to; modified in-place if any
183 sky source/object footprints are created.
184
185 Returns
186 -------
187 skyFootprints : `list` of `lsst.afw.detection.Footprint`
188 Footprints of sky objects. Each will have a peak at the center
189 of the sky object.
190 """
191 skyFootprints = generateSkyObjects(mask, seed, self.config)
192 self.log.info("Added %d of %d requested sky sources (%.0f%%)", len(skyFootprints),
193 self.config.nSources, 100*len(skyFootprints)/self.config.nSources)
194
195 if skyFootprints and self.skySourceKey is not None and catalog is not None:
196 for footprint in skyFootprints:
197 record = catalog.addNew()
198 record.setFootprint(footprint)
199 record.set(self.skySourceKey, True)
200
201 return skyFootprints