[PIPE2D-355] Model the 2D PSF using PSFEx Created: 13/Feb/19 Updated: 05/Jan/21 Resolved: 27/Mar/20 |
|
| Status: | Won't Fix |
| Project: | DRP 2-D Pipeline |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Normal |
| Reporter: | hassan | Assignee: | Kiyoto Yabe |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Story Points: | 5 | ||||||||
| Epic Link: | 2D PSF modelling | ||||||||
| Sprint: | 2DDRP-2019 C, 2DDRP-2019 D, 2DDRP-2019 E, 2DDRP-2019 F, 2DDRP-2019 G, 2DDRP-2019 H, 2DDRP-2019 I, 2DDRP-2019 J, 2DDRP-2019 K, 2DDRP-2020 A, 2DDRP-2021 A | ||||||||
| Description |
|
Using the external tool PSFEx, model the 2D PSF. This can subsequently be used by Success criteria will be provided in due course. |
| Comments |
| Comment by hassan [ 22/Mar/19 ] |
|
Example PSFs from LAM data should be accessible in order to address this ticket. |
| Comment by ncaplar [ 22/Mar/19 ] |
|
The example PSFs have been created in |
| Comment by hassan [ 22/Mar/19 ] |
|
Clarification of my earlier comment: Keigo Nakamura needs access to the example PSFs that have been created from LAM data as part of |
| Comment by rhl [ 22/Mar/19 ] |
|
I don't understand this. The LSST stack that the PFS pipeline is based on has support for `PSFex` built in; you can start with an arc image and run the PSF modelling code. When we come to see if piff works better we will have to think about interfaces – LSST is planning to integrate piff at some point, and we can either wait for this work or contribute it; it may be reasonable to test piff on arc data before doing the integration work. |
| Comment by hassan [ 23/Mar/19 ] |
|
Key LSST task to be used that makes use of PSFex is CharacterizeImageTask: https://pipelines.lsst.io/modules/lsst.pipe.tasks/tasks/lsst.pipe.tasks.characterizeImage.CharacterizeImageTask.html#lsst-task-lsst-pipe-tasks-characterizeimage-characterizeimagetask Documentation providing examples are missing. An LSST ticket has been raised to address this: However a useful starting point for using the CharacterizeImageTask is available here: https://github.com/RobertLuptonTheGood/notebooks/blob/master/Demos/Image%20Processing.ipynb |
| Comment by Keigo Nakamura [ 08/Jul/19 ] |
|
I attached the output image of PSFEX. I tried simulated image of ARC in integration test (visit =31). |
| Comment by Kiyoto Yabe [ 28/Nov/19 ] |
|
The very initial results: Modeled PSF with PSFEx at each position of the detector and spots used for the calculation (small circle; redder color means brighter). Ne arc PostISRCCD image (visit=17244) is used. `config.repair.doCosmicRay = False` I'm not sure why very bright lines in the lower area of the image are not used by PSFEx, but this may be able to be controlled by tuning parameters. Current set of parameter is like this: lsst.meas.extensions.psfex.psfexPsfDeterminer.PsfexPsfDeterminerConfig(kernelSize=41.0, kernelSizeMin=31, kernelSizeMax=51, PsfexPsfDeterminerConfignEigenComponents=4, spatialOrder=2, sizeCellX=256, sizeCellY=256, _PsfexPsfDeterminerConfignStarPerCell=3, samplingSize=1.0, badMaskBits=['INTRP', 'SAT'], psfexBasis='PIXEL_AUTO', _PsfexPsfDeterminerConfigborderWidth=0, _PsfexPsfDeterminerConfignStarPerCellSpatialFit=5, _PsfexPsfDeterminerConfigconstantWeight=True, _PsfexPsfDeterminerConfig_nIterForPsf=3, tolerance=0.01, lam=0.05, reducedChi2ForPsfCandidates=2.0, spatialReject=3.0, recentroid=False) lsst.meas.algorithms.objectSizeStarSelector.ObjectSizeStarSelectorConfig(doFluxLimit=False, fluxMin=12500.0, fluxMax=0.0, doSignalToNoiseLimit=True, signalToNoiseMin=20.0, signalToNoiseMax=0.0, widthMin=0.0, widthMax=20.0, sourceFluxField='base_GaussianFlux_instFlux', widthStdAllowed=0.5, nSigmaClip=3.0, badFlags=['base_PixelFlags_flag_edge', 'base_PixelFlags_flag_interpolatedCenter', 'base_PixelFlags_flag_saturatedCenter', 'base_PixelFlags_flag_crCenter', 'base_PixelFlags_flag_bad', 'base_PixelFlags_flag_interpolated']) This is a 1D profile of each image along X direction in each location (+/-15 pix stack in Y direction). This is a 1D profile of each image along Y direction in each location (+/-15 pix stack in X direction). In each plot, the X location is shown at the top of each sub-panel, and color shows the Y location (bluer means lower Y).
I'm perhaps doing stupid things, and I'm very happy to know a proper set of parameters. Anyway, I don't see a large change of the line profile in Y direction, but see slight change (1-2 percent level) in the wing of the profile.
|
| Comment by Kiyoto Yabe [ 29/Nov/19 ] |
|
This is an example of 2D (top) and 1D (bottom) residual of a fairly bright spot at the center of the image. You see 1-2 percent level of residual (compared to the peak). Note that this is actually a good case, and there is worse case indeed.
This is a map of RMS of 1D residual divided by the peak of the original line. Most of the spots show 2-3% level of residual, but some spots show >5% level residual. Bad spots in lower part of the image are fairly bright but the positional information of the detection result looks bad for some reason and this causes the large residual. |
| Comment by rhl [ 06/Dec/19 ] |
|
In plots like arc_ne_17244_psfex_xstack.png what are the units? The y-axis is labelled "counts" – are they in fractions of the peak, or the total flux, or something else? Also, the PSF images are showing ringing. Did you turn on oversampling, and (if so) are you using the version of psfEx in the LSST that I fixed/hacked? |
| Comment by Kiyoto Yabe [ 06/Dec/19 ] |
|
Yes, it is a normalized value so that the total count is unity. samplingSize=1.0, so I think oversampling is OFF. I'm using ver. 18.1.0 for meas_extensions_psfex but I'm not sure if this is a version you fixed. I actually asked naoki.yasuda to install the package on a server at IPMU, but some steps described in README (such as checking out your subversion repo) may have been skipped. |
| Comment by naoki.yasuda [ 06/Dec/19 ] |
|
It has been installed with `eups distrib install meas_extensions_psfex v18_1_0` on top of installed LSST stack for pfs_pipe. |
| Comment by rhl [ 07/Dec/19 ] |
|
The data is undersampled (as is normal for fibre spectrographs), so I think you need to turn on oversampling. |
| Comment by Kiyoto Yabe [ 22/Jan/20 ] |
|
As reported in previous telecon, turning on oversampling causes a strange result as shown below: This is an image of the local PSF modeling near the FoV center for 5x oversampling. In the processing, 192 out of 237 PSF candidate objects (arc spots) are used for the modeling. A set of configuration is shown below: // code placeholder config = CharacterizeImageTask.ConfigClass() config.psfIterations = 1 config.useSimplePsf = False config.repair.doCosmicRay = False config.doApCorr = False config.measurePsf.psfDeterminer.name = 'psfex' config.measurePsf.psfDeterminer['psfex'].badMaskBits=['INTRP', 'SAT'] config.measurePsf.psfDeterminer['psfex'].kernelSize=205 config.measurePsf.psfDeterminer['psfex'].kernelSizeMin=31 config.measurePsf.psfDeterminer['psfex'].kernelSizeMax=51 config.measurePsf.psfDeterminer['psfex'].sizeCellX=64 config.measurePsf.psfDeterminer['psfex'].sizeCellY=64 config.measurePsf.psfDeterminer['psfex'].samplingSize=0.2 config.measurePsf.psfDeterminer['psfex'].psfexBasis='PIXEL' config.measurePsf.psfDeterminer['psfex'].recentroid=True config.measurePsf.psfDeterminer['psfex'].lam=0.05 config.measurePsf.psfDeterminer['psfex'].spatialOrder=2 config.measurePsf.psfDeterminer['psfex'].spatialReject=3.0 config.measurePsf.psfDeterminer['psfex'].tolerance=0.01 config.measurePsf.psfDeterminer['psfex'].reducedChi2ForPsfCandidates=2.0 config.measurePsf.starSelector.name = 'objectSize' config.measurePsf.starSelector['objectSize'].doFluxLimit=False config.measurePsf.starSelector['objectSize'].fluxMin=1000. config.measurePsf.starSelector['objectSize'].fluxMax=5000000. config.measurePsf.starSelector['objectSize'].doSignalToNoiseLimit=True config.measurePsf.starSelector['objectSize'].signalToNoiseMin=50. config.measurePsf.starSelector['objectSize'].signalToNoiseMax=1000. config.measurePsf.starSelector['objectSize'].widthMin = 0.5 config.measurePsf.starSelector['objectSize'].widthMax = 5.0 config.measurePsf.starSelector['objectSize'].widthStdAllowed = 0.3 config.measurePsf.starSelector['objectSize'].nSigmaClip = 2.0 config.measurePsf.starSelector['objectSize'].sourceFluxField = 'base_PsfFlux_instFlux' Please let me know, if you have any idea on the possible cause or what can be helpful...
|
| Comment by ncaplar [ 21/Mar/20 ] |
|
I have talked with Bob Amstrong. He immediately recognized the strange feature discussed above. He says that the feature is caused by the fact that the code only does the real analysis in the inner part of the PSF, while outside it does some sort of simplified averaging. The parameter that controls how large the region is in which ``real analysis'' is conducted is given by the parameter BASIS_NUMBER which is not accessible via python, but is accessible via the default configuration file. On GitHub, this file can be found at {[https://github.com/LSST-nonproject/meas_extensions_psfex/blob/master/config/default-lsst.psfex].}
On Monday I plan to play to see if the changing the BASIS_NUMBER changes the results |
| Comment by ncaplar [ 25/Mar/20 ] |
|
I did conduct the change that Bob suggested and increased the BASIS_NUMBER from 20 to 40. The code ran 10 times longer (4517 seconds, compared to 467 when BASIS_NUMBER was 20), but I do get a similar result:
|
| Comment by Kiyoto Yabe [ 25/Mar/20 ] |
|
Thank you very much for this test ncaplar. I do appreciate if you get a further chance to talk to Bob or other folks. |
| Comment by ncaplar [ 26/Mar/20 ] |
|
Kiyoto Yabe Yes, I am trying to get in contact with Bob to discuss further.
|
| Comment by ncaplar [ 27/Mar/20 ] |
|
I have talked with Bob Amstrong about our problem when using PSFex. To repeat what I mentioned in the ticket, he says that the feature is caused by the fact that the code only does the real analysis in the inner part of the PSF, while outside it does some sort of simplified averaging. He first recommended increasing the BASIS_NUMBER parameter, but that did not change the result (only made code run longer).
|
| Comment by ncaplar [ 27/Mar/20 ] |
|
We discussed this during DRP telecom on March 27, 2020. We have reached the conclusion that at this point it is not worth investigating this further. Changing the size of the box would probably include considerable amounts of time and possibly working on the underlying C-code. |