LSSTApplications
19.0.0-10-g920eed2,19.0.0-11-g48a0200+2,19.0.0-18-gfc4e62b+13,19.0.0-2-g3b2f90d+2,19.0.0-2-gd671419+5,19.0.0-20-g5a5a17ab+11,19.0.0-21-g2644856+13,19.0.0-23-g84eeccb+1,19.0.0-24-g878c510+1,19.0.0-25-g6c8df7140,19.0.0-25-gb330496+1,19.0.0-3-g2b32d65+5,19.0.0-3-g8227491+12,19.0.0-3-g9c54d0d+12,19.0.0-3-gca68e65+8,19.0.0-3-gcfc5f51+5,19.0.0-3-ge110943+11,19.0.0-3-ge74d124,19.0.0-3-gfe04aa6+13,19.0.0-30-g9c3fd16+1,19.0.0-4-g06f5963+5,19.0.0-4-g3d16501+13,19.0.0-4-g4a9c019+5,19.0.0-4-g5a8b323,19.0.0-4-g66397f0+1,19.0.0-4-g8278b9b+1,19.0.0-4-g8557e14,19.0.0-4-g8964aba+13,19.0.0-4-ge404a01+12,19.0.0-5-g40f3a5a,19.0.0-5-g4db63b3,19.0.0-5-gfb03ce7+13,19.0.0-6-gbaebbfb+12,19.0.0-61-gec4c6e08+1,19.0.0-7-g039c0b5+11,19.0.0-7-gbea9075+4,19.0.0-7-gc567de5+13,19.0.0-71-g41c0270,19.0.0-9-g2f02add+1,19.0.0-9-g463f923+12,w.2020.22
LSSTDataManagementBasePackage
|
This project is to add fake stellar and galaxy sources to the HSC data processing. We use galsim to generate fake galaxy sources. Stellar (PSF) sources are simply taken as the measured PSF. In the current incarnation, the pipeline accepts fake sources after the calibration but before measurement when processing single CCDs. This way, the fake sources don't affect things like PSF determination. Once the sources are added, they are deblended and measured just like the rest of the sources, and included in the output catalogs. They are also measured in the coadds, if you continue with the processing beyond single frame processing.
All the fake sources are added with the appropriate amount of Poisson noise. When adding fake sources, we also add a bit plane to the image mask called FAKE
. This mask plane sets every pixel to which a fake source was added, even those for which the added flux is negligible. When adding sources, the pixel positions are saved in the calibrated exposure image header as FAKE ID x_pos y_pos
. Because of this, and because of crowding, you probably don't want to add too many (few hundred of so) sources to a single CCD. This information in the header is used by matchFakes.py to extract the measurements of the fake sources from the catalog. For source catalogs where the sky (ra/dec) position of the objects are given, saving the pixel positions isn't necessary, but we've left it for now. In this case, matchFakes.py
uses the ra/dec positions from the input catalog instead of the pixel position in the header to match input fake sources to the dected sources. This enables matchFakes.py to work on the coadd source tables as well as the visit source tables (the sources aren't directly added to the coadd so the pixel positions aren't saved in the coadd image).
This code depends on the HSC pipeline (version 3.3.3 or later), and needs to have galsim built against the pipeline python. For some of the additional scripts (makeRaDec, matchFakes) the astropy package is also necessary. If you just have a list of sources however, you don't need it. This is already setup on master at IPMU, so if you are running there, you just need to setup the following:
The first export is only to get astropy on PYTHONPATH, so adjust according to your local installation.
To run, you need to override the default configuration in the pipeline to include fake sources. We have 3 different tasks you can implement with the override config. They are:
Examples of how to use these tasks and standard configurations are given in the test/stars and test/galaxies. The command to run these for a small set of CCDs would is:
More detailed instructions on how to run these examples is found in the tests folder here. This also works with reduceFrames.py, if you want to add fake sources to an entire frame at once.
Once the fake sources have been injected at the visit (individual exposure) level, they will be processed as regular sources while making coadds, as they are in the calibrated images. However, if you want to multiband detection, you need to add the fake sources (with reasonable colors) to all the bands, unless you want to test dropouts. This can be accomplished by having one input source catalog per band, with the same source positions, but different magnitudes.
If you aren't interested in looking at the source measurement on the individual visits, you should still add the sources to the single visits, and then run the stacking, detection and measurement on the visits with fakes. runAddFakes.py
is a simple task that takes already processed data and creates a new rerun with fake sources added to the calibrated frames. You'll need to retarget the fakes
task to make it actually add fake sources. To run it:
where fakes_config
needs to at least include a line root.fakes.retarget(someFakes.someFakesTask)
. Examples of configurations for the various tasks are in the test directory.
If you want to add check that the fake source adding is working without going through all the measurements, use debugFakes, which takes a calibrated exposure from a completed rerun (rerun1) and writes the exposure with fakes added to rerun2.
Note that this will fail if rerun1 doesn't have the visit/ccd you are trying to process already in it. This code doesn't do any measurements, it simply adds the fake sources to the image, which you can then open in DS9.
or