Changeset 6005 for trunk/doc/psphot/psphot.tex
- Timestamp:
- Jan 15, 2006, 2:26:07 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/doc/psphot/psphot.tex (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/doc/psphot/psphot.tex
r4902 r6005 142 142 discussion and add in the references.} 143 143 144 \note{Add discussion of the lessons learned from experience with previous 145 analysis programs} 146 144 147 The Pan-STARRS IPP team decided that none of the existing packages met 145 148 all of their needs, particularly given the very challenging goals of … … 156 159 Python). 157 160 158 \note{Add discussion of the lessons learned from experience with previous 159 analysis programs} 161 \section{PSPhot Design Goals} 162 163 PSPhot has a number of important requirements that it must meet, and a 164 number of design goals which we believe will help to make usable in a 165 wide range of circumstances. The critical requirements of the 166 Pan-STARRS IPP which drive the requirements for PSPhot: 160 167 161 168 \begin{itemize} 162 \item Flexible PSF model: functional form should be 163 easily modified. 164 \item PSF variation is fundamental : PSF representation should incorporate 2-D variations. 165 \item Speed fitting with accurate parameter guesses. 166 \item Make good use of moment information to speed analysis. 167 \item Careful definition of PSF validity tests. 168 \item Careful analysis of aperture corrections. 169 \item Flexible non-PSF models. 170 \item Good code abstraction to simplify modification. 169 \item {\bf 10 millimagnitude photometric accuracy}. For PSPhot, this 170 implies that the measured photometry of stellar objects must be 171 substantially better than this 10 mmag since the photometry error 172 per image is combined with an error in the flat-field calibration 173 and an error in measuring the atmospheric effects. We have set a 174 goal for PSPhot of 3mmag photometric consistency for bright stars 175 between pairs of images obtained in photometric conditions at the 176 same pointing, ie to remove sensitivity to flat-field errors. This 177 goal splits the difference between the three main contributors and 178 still allows some leeway. This requirement must be met for 179 well-sampled images and images with only modest undersampling. 180 181 \item {\bf 10 milliarcsecond astrometric accuracy}. Relative 182 astrometric calibration depends on the consistency of the individual 183 measurements. The measurements from PSPhot must be sufficiently 184 representative of the true object position to enable astrometric 185 calibration at the 10mas level. The error in the individual 186 measurements will be folded together with the errors introduced by 187 the optical system, the effects of seeing, and by the available 188 reference catalogs. We have set a goal for PSPhot of 5mas 189 consistency between the true source postion and the measured 190 position given reasonable PSF variations under simulations. This 191 level must be reached for images with 250 mas pixels, implying 192 PSPhot must introduce measurement errors less than 1/50th of a 193 pixel. 194 195 \item {\bf processing time of 45 seconds} This requirement depends 196 strongly on the hardware organization, the amount of time spent on 197 other analysis steps, the density of stars per image, and the depth 198 for a given type of image. For the sources at the faint limit (eg, 199 $5\sigma$), the average density of sources is expected to be roughly 200 $3\times10^5$ per square degree, while sources at the 20 $\sigma$ 201 level may have densities of $\sim 5\times10^4$ per square degree. 202 Allowing 30 seconds for the PSPhot portion of the analysis, of which 203 15 is used for careful analysis of the brighter sources, 10 seconds 204 is used for PSF modeling and other overheads, and the remaining 5 205 seconds is used for the PSF fitting of the faintest source implies 206 that the detailed modelling may take roughly 3msec per source, and 207 the basic PSF fitting may be allowed 150 usec per source. 171 208 \end{itemize} 172 209 210 The design goals for PSPhot are chosen to make the program flexible, 211 general, and able to meet the unknown usages cases future projects may 212 require: 213 214 \begin{itemize} 215 \item {\bf Flexible PSF model} Different image sources require 216 different ways of representing the PSF. Ideally, both analytical 217 and pixel-based versions should be possible. 218 219 \item {\bf PSF spatial variation} Most images result in some spatial 220 PSF variations at a certain level. The PSF representation should 221 naturally incorporate 2-D variations. 222 223 \item {\bf Flexible non-PSF models} PSPhot must be able to represent 224 PSF-like objects as well as non-PSF sources. It must be easy to add 225 new object models as interesting representations of sources are 226 invented. 227 228 \item {\bf Clean code base} PSPhot should incorporate a high-degree of 229 abstraction and encapsulation so that changes to the code structure 230 can be performed without pulling the code apart and starting from scratch. 231 232 \item {\bf PSF validity tests} PSPhot should include the ability to 233 choose different types of PSF models for diffent situations, or to 234 provide the user with methods for assessing the different PSF models. 235 236 \item {\bf Careful aperture corrections} PSPhot must carefully measure 237 and correct for the photometric and astrometric trends introduced by 238 using analytical PSF models. 239 240 \item {\bf User Configurable} PSPhot should allow users to change the 241 options easily and to allow different approaches to the analysis. 242 243 \end{itemize} 244 173 245 \section{PSPhot Analysis Process} 174 246 … … 178 250 179 251 \begin{itemize} 180 \item image preparation - load data, characterize the image252 \item {\bf Image preparation} Load data, characterize the image 181 253 background, load or construct noise and mask images. 182 254 183 \item initial object detection - smooth, find peaks, measure basic 184 properties 185 186 \item PSF determination - select PSF candidates, perform model fits, 187 build PSF model from fits, select best PSF model class, determine 188 image aperture corrections. 189 190 \item Fit PSF objects - fit objects with PSFs, determine PSF validity, 191 subtract PSF-like objects 192 193 \item Fit non-PSF objects - fit non-PSF model, select best model 194 class, subtract model 195 196 \item low S/N sources - detect low-level sources, measure properties 197 198 \item output - write out objects in selected format, write out 255 \item {\bf Initial object detection} Smooth, find peaks, measure basic 256 properties 257 258 \item {\bf PSF determination} Select PSF candidates, perform model 259 fits, build PSF model from fits, select best PSF model class. 260 261 \item {\bf Bright object analysis} Fit objects with PSFs, determine 262 PSF validity, subtract PSF-like objects, fit non-PSF model(s), 263 select best model class, subtract model. 264 265 \item {\bf Low S/N sources} Detect low-level sources, measure 266 properties (aperture or PSF) 267 268 \item {\bf Aperture corrections} Measure the curve-of-growth, spatial 269 aperture variations, and background-error corrections. 270 271 \item {\bf Output} Write out objects in selected format, write out 199 272 difference image, noise image, etc, as selected. 200 273 \end{itemize} 201 274 202 \note{the current configuration variables and some of the function 203 names are not very well chosen. expect these to be modified as the 204 code base is cleaned.} 275 Note that a given run of PSPhot \note{should} allow the user to 276 perform any of these stages as an option. For example, the PSF model 277 may already be available from external information, in which case the 278 PSF modeling stage can be skipped. Or, when used as a library 279 function, the image may have already been loaded and the mask and 280 weight images constructed. In some implementations, it may be 281 possible to skip the initial object detection stage because only 282 supplied sources are measured. These are only some of the possible 283 configurations. The use of these different configurations depends on 284 the source of the image, the desired detail and speed of the 285 processing, and the level of accuracy desired from the analysis. 205 286 206 287 \subsection{Image Preparation} … … 241 322 \code{XMIN}, \code{XMAX}, \code{YMIN}, \code{YMAX}. 242 323 243 \note{minimum valid data value is currently unimplemented} 244 245 \note{mask values are currently hard-wired numbers : they should be 246 given named enum values} 324 \note{Mask values are currently hard-wired numbers. We need a method 325 for user-defined mask values to be supplied. PSLib needs to have a 326 mask registration system.} 247 327 248 328 The noise image, if not supplied is constructed by default from the … … 267 347 dependent on the form of this smoothing function. 268 348 269 \note{Is this smoothing needed?} 349 \note{Is this smoothing needed? we could save time here by skipping 350 it.} 270 351 271 352 The local peaks in the smoothed image are found by first detecting … … 412 493 represent the shape in some way}. 413 494 414 \subsubsection{PSF Object CandidateSelection}495 \subsubsection{PSF Candidate Object Selection} 415 496 416 497 The first stage of determining the PSF model for an image is to … … 446 527 the image. 447 528 448 \subsubsection{PSF candidates object model fits}529 \subsubsection{PSF Candidate Object Model Fits} 449 530 450 531 All candidate PSF objects are then fitted with the selected object … … 453 534 non-linear fitting. Non-linear fitting can be very computationally 454 535 intensive, particularly for if the starting parameters are far from 455 the minimization values. PSPhot uses a the first and second moments456 tomake a good guess for the centroid and shape parameters for the PSF536 the minimization values. PSPhot uses the first and second moments to 537 make a good guess for the centroid and shape parameters for the PSF 457 538 models. In order to minimize the impact of close neighbors, the noise 458 539 values used in the fit are enhanced by a fraction of the deviation of … … 490 571 ApResid}) is a critical parameter for any PSF modeling software which 491 572 uses an analytical model to represent the flux distribution of the 492 objects in an image. 573 objects in an image. An approximate correction is measured here, with 574 a more detailed correction measured after all object analysis is 575 performed. The PSF model with the best consistency of the aperture 576 correction is judged to be the best model. 577 578 \subsubsection{Basic Deblending} 579 580 The collection of identified peaks is examined to find peaks which are 581 'blended', that is, they are close enough together to make the 582 analysis of one of the sources difficult if performed in isolation. 583 Saturated stars also result in additional peaks which are likely to be 584 invalid; it is useful to restrict a saturated star to a single primary 585 position with associated neighboring peaks. 586 587 The deblending process first searches for any peaks which are within 588 the image cell of another peak. All such groups are examined, 589 starting with the brightest source. An isophot is found about the 590 primary peak which is at least \code{DEBLEND_SKY_NSIGMA} times the sky 591 sigma above the local background and which is otherwise 592 \code{DEBLEND_PEAK_FRACTION} of the primary peak central pixel flux. 593 Any secondary sources which are contained within this isophot are 594 considered to be blended peaks associated with the primary peak. 595 596 \subsection{Bright Source Analysis} 597 598 After a PSF model has been determined, PSPhot performs the analysis of 599 the bright objects in the image. In this stage, all of the objects 600 with an estimated signal to noise (based on the moments analysis) 601 greater than a user-set threshold are analysed and subtracted from the 602 image. An optional successive stage then finds fainter sources and 603 measures them as well (see Faint Source Analysis, 604 Section~\ref{faintsources}). In the bright source analysis stage, two 605 major varients are available. In the primary version, all objects are 606 examined (in decending order of brightness) and an appropriate models 607 is determined for each object which is then subtracted; in the 608 alternate version, the objects are examined (in decending order of 609 brightness) and the PSF-like objects subtracted first, then the 610 extended objects are analysed on a second pass. 611 612 \subsubsection{Fast Ensemble PSF Fitting} 613 614 Before the detailed analysis of the objects is performed, it is 615 convenient to subtract off all of the sources, at least as well as 616 possible at this stage. We make the assumption that all sources are 617 PSF-like. We also assume their position can be taken as the peak of a 618 2D quadratic function fitted to the peak pixel and its surrounding 8 619 pixels. A single linear fit is used to simultaneously measure all 620 source fluxes. Since the local sky has been subtracted, this 621 measurement assumes the local sky is zero. 622 623 \[ 624 \chi^2 = \sum_{\rm pixels} (F_{x,y} - \sum_{\rm sources} A_i PSF[x,y])^2 625 \] 626 627 Minimizing this equation with respect to each of the $A_i$ values 628 results in a matrix equation: 629 \[ M_{i,j} \bar{A_i} = \bar{F_j}\] 630 where $\bar{A_i}$ is the vector of $A_i$ values, the elements of 631 $M_{i,j}$ consist of the dot product of the unit-flux PSF for source 632 $i$ and source $i$, and $\bar{F_j}$ is the dot product of the 633 unit-flux PSF for source $i$ with the pixels corresponding to source 634 $i$. The dot products are calculated only using pixels within the 635 source apertures. Since most sources have no overlap with most other 636 sources, this matrix equation results in a very sparse, mostly 637 diagonal square matrix. The dimension is the number of sources, 638 likely to be 1000s or 10,000s. Such a matrix does not lend itself to 639 direct inversion. However, an interative solution quickly yields a 640 result with sufficient accuracy. In the iterative solution, a guess 641 at the solution is made; the guess is multiplied by the matrix, and 642 the result compared with the observed vector $\bar{F_j}$. The 643 difference is used to modify the initial guess. This proces is 644 repeated several times to achieve a good convergence. 645 646 Once a solution set for $A_i$ is found, all of the objects are 647 subtracted from the by applying these values to the unit-flux PSF. 648 649 \subsubsection{PSF Model applied to detected objects} 650 651 Once a PSF model has been selected for an image, PSPhot attempts to 652 fit all of the detected objects, above a user-defined signal-to-noise 653 ratio (\note{KEYWORD}) with the PSF model. For these fits, the 654 dependent parameters are fixed by the PSF model and only the 4 655 independent object model parameters are allowed to vary in the fit. 656 PSPhot again uses the Levenberg-Marqardt process for the non-linear 657 fitting. The objects are fitted in their S/N order, starting with the 658 brightest and working down to the user-specified limit. 659 660 Once a solution has been achieved, PSPhot attempts to judge the 661 quality of the PSF model as a representation of the object shape. To 662 do this, it calculates the next step of the minimization {\em allowing 663 the shape parameters to vary}. This step, essentially the 664 Gauss-Newton minimization distance from the current local minimum, 665 should be very small if the object is well represented by the PSF, but 666 large if the PSF is not a good representation of the object flux. The 667 model quality is judged by the change in the two shape parameters 668 which represent the 2D size of the object. For the case of the 669 elliptical Gaussian, these two parameters are $\sigma_x$ and 670 $\sigma_y$. For a generic model, the shape parameters may be defined 671 differently, but the should always be two parameters which scale the 672 object size in two dimensions (what about a polar-coordinate form?) 673 Currently, PSPhot requires the two relevant shape parameters to be the 674 first two dependent parameters in the list of model parameters (ie, 675 parameters 4 \& 5). 676 677 The expected distribution of the variation of the two shape parameters 678 will be a function of the signal-to-noise of the object in question 679 and the value of the shape parameter itself. The expected standard 680 deviation on the shape parameter is, eg, $\sigma_x / {\rm SN}$. If 681 the object is well-represented by the PSF, then the shape parameter 682 values should be close to their minimization value. We can thus ask, 683 for each object, given the measured amplitude of the Gauss-Newton 684 step, how many standard deviations from the expected value (of 0.0) is 685 this particular value? Objects for which the variation in the shape 686 parameters is a large positive number of standard deviations are 687 likely to be better represented by a larger flux distribution than the 688 PSF (eg, a Galaxy or Comet, etc). Objects for which the variation in 689 the shape parameters is a large negative number of standard deviations 690 are likely to be better represented by a smaller flux distribution 691 than the PSF (ie, a cosmic ray or other defect). A user-defined 692 number of standard deviations is used to select these two cases, and 693 to flag the object as a likely galaxy (really meaning 'extended') or 694 as a likely defect. 695 696 At this stage of the analysis, PSPhot uses two additional indicators 697 to identify good and poor PSF fits. The first of these is the 698 signal-to-noise ratio. It is possible for the peak finding algorithm 699 to identify peaks in locations which are not actually a normal peak. 700 Some of these cases are in the edges of saturated, bleeding columns 701 from bright stars, in the nearly flat halos of very bright stars, and 702 so on. In these cases, a local peak exists, with a lower nearby sky 703 region. However, the fitted PSF model cannot converge on the peak 704 because it is very poorly defined (perhaps only existing in the 705 smoothed image). The fit can either fail to converge or it can 706 converge on a fit with very low or negative peak flux / flux 707 normalization. PSPhot will flag any non-convergent PSF fit and any 708 object with PSF S/N ratio lower than a user-defined cutoff. It is 709 also useful to identify very poor fits by setting a maximum Chi-Square 710 cutoff for objects. 711 712 As the objects are fitted to the PSF model, those which survive the 713 exclusion stage are subtracted from the image. The subtraction 714 process modifies the image pixels (removing the fitted flux, though 715 not the locally fitted background) but does not modify the mask or the 716 noise images. The signal-to-noise ratio in the image after 717 subtraction represents the significance of the remaining flux. If the 718 subtractions are sufficiently accurate models of the PSF flux 719 distribution, the remaining flux should be below 1 $\sigma$ 720 significance. In practice the cores of bright stars are poorly 721 represented and may have larger residual significance. \note{in future 722 work, we may choose to enhance the noise to minimize detection of 723 objects in the residuals of brighter objects}. 724 725 \subsubsection{Blended Sources} 726 727 Sources which are blended with other sources are fitted together as a set of 728 PSFs. A single multi-object fit is performed on all blended peaks. 729 The resulting fits are evaluated independently and any which are 730 determined to be PSFs are subtracted from the image. 731 732 \subsubsection{Double Sources} 733 734 Sources which are judged to be non-PSF-like are confronted with two 735 possible alternative choices. First, the object is fitted with a 736 double-source model. In this pass, the assumption is made that there 737 are two neighboring sources, but the peaks are blended together, or 738 otherwise not distinguished. The initial guess for the two peaks is 739 made by splitting the flux of the single source in half and locating 740 the two starting peaks at +/- 2 pixels from the original peak along 741 the direction of the semi-major axis of the sources, as measured from 742 the second moments. In order for the two-source model to be accepted, 743 both sources must be judged as a valid PSF source. Otherwise, the 744 double-PSF model is rejected and the source is fitted with the 745 available non-PSF model or models. 746 747 \note{better description of the acceptance criteria; the FLT model is 748 tried before the DBL is accepted or rejected}. 749 750 \subsubsection{Non-PSF Objects} 751 752 Once every object (above the S/N cutoff) has been confronted with the 753 PSF model, the objects which are thought to be galaxies (extended) can 754 now be fit with appropriate models for the galaxies (or other likely 755 extended shapes). Again, the fitting stage starts with the brightest 756 sources (as judged by the rough S/N measured from the moments 757 aperture) and working to a user defined S/N limit. 758 759 PSPhot will use the user-selected galaxy model to attempt the galaxy 760 model fits. In the configuration system, the keyword \code{GAL_MODEL} 761 is set to the model of interest. All suspected extended objects are 762 fitted with the model, allowing all of the parameters to float. The 763 initial parameter guesses are critical here to achieving convergence 764 on the model fits in a reasonable time. The moments and the pixel 765 flux distribution are used to make the initial parameter guess. Many 766 of the object parameters can be accurately guessed from the first and 767 second moments. The power-law slope can be guessed by measuring the 768 isophotal level at two elliptical radii and comparing the ratio to 769 that expected. 770 771 For each of the galaxy models (in fact for all object models), a 772 function is defined which examines the fit results and determines if 773 the fit can be consider as a success or a failure. The exact criteria 774 for this decision will depend on the details of the model, and so this 775 level of abstraction is needed. For example, in some case, the range 776 of valid values for each of the parameters must be considered in the 777 fit assessment. In other cases, we may choose to use only the 778 parameter errors and the fit Chi-Square value. 779 780 All galaxy model fits which are successful are then subtracted from 781 the image as is done for the successful PSF model fits. Of course, 782 the background flux is retained, with the result that only the object 783 is subtracted from the image. Again, the noise image is (currently) 784 not modified. 785 786 \note{we have no code yet to select the best of several models for a 787 given objects. The relative value of the Chi-Square is the obvious 788 test in this case}. 789 790 \subsection{Faint Sources} 791 792 \note{this is not done : should use the ensemble PSF fitting to fit 793 just the new significant peaks} 794 795 After a first pass through the image, in which the brighter sources 796 above a high threshold level have been detected, measured, and 797 subtracted, PSPhot optionally begins a second pass at the image. In 798 this stage, the new peaks are detected on the image with the bright 799 objects subtracted. In this pass, the peak detection process uses the 800 noise image to test the validity of the individual peaks. All peaks 801 with a significance greater than a user-defined minimum threshold are 802 accepted as objects of potential interest. 803 804 The objects which are measured in this faint-object stage are clearly 805 low significance detections. A typical threshold for the bright 806 object analysis would S/N of 5 - 10. The lower limit cutoff for the 807 faint object analysis would typically be S/N of 2 - 4. In this stage, 808 PSPhot can perform one of three types of analysis. The difference 809 between these options is one of speed vs detail. 810 811 In the first option, PSPhot can repeat the analysis described above in 812 sections XXX and XXX, performing a PSF fit followed by a non-PSF fit 813 to the objects which are not PSF-like, and subtracting them. The 814 advantage of this option is that the faint objects are treated 815 identically to the bright objects, and all potential parameters are 816 measured, even for marginally extended sources. The disadvantage of 817 this option is that the low signal-to-noise of the objects in this 818 stage limits the amount of information which can be extracted from 819 them. The marginal gain may not be worth the large expense of 820 processing time. 821 822 In the second option, PSPhot can perform only the PSF model fit to the 823 remaining peaks, but ignore any further questions of the shape of the 824 objects. The advantage of this option is that it is substantially 825 faster than performing the more complex (and less stable) 826 multi-parameter non-linear fits on all faint objects. On the 827 downside, less information is learned about the objects. 828 829 Finally, PSPhot can simply ignore the fitting process and instead 830 glean information about the fainter sources on the basis of the peak 831 characteristics. In this option, the image is smoothed with the PSF 832 model, and the peak for each object is measured. The peak flux and 833 the local peak curvature theoretically give sufficient information to 834 recover the object flux, the centroid coordinates, and the centroid 835 errors. The advantage of the stage is speed, especially for the very 836 faintest levels: if the lower limit is not sufficiently faint, the 837 time spent in performing the smoothing (3 FFTs) cannot make up for the 838 time which would have been spent applying the PSF model to the peaks. 839 The downside of this method is an increased sensitivity to the local 840 sky model (the local sky must be correctly subtracted) and fewer 841 constraints on the quality of the detection (no Chi-Square is 842 measured, for example). 843 844 \note{In the ideal case, if we were only interested in detecting PSFs, 845 and we had a good model for the PSF, we could optimally find the 846 sources by smoothing the image and the noise image with the PSF model. 847 \em write out the description of Nick's optimal PSF finding}. 848 849 PSPhot allows the user to select between these three options for the 850 analysis of the faint sources. Three separate user-controlled 851 signal-to-noise ratio limits are defined. One specifies the depth to 852 which the PSF / non-PSF analysis is performed. A second (which must 853 be smaller) specifies the depth to which only the PSF is fitted. A 854 third specifies the depth to which the analysis is performed using on 855 the peak statistics. If two of these are identical, then certain of 856 these options are simply skipped. For example, if the peak analysis 857 threshold is set to the same value as the PSF-only threshold, no peak 858 analysis is performed. 859 860 \subsection{Aperture Correction Measurement} 493 861 494 862 The important concept here is that an analytical model will always … … 581 949 tested. 582 950 583 \subsubsection{PSF Model applied to detected objects}584 585 Once a PSF model has been selected for an image, PSPhot attempts to586 fit all of the detected objects, above a user-defined signal-to-noise587 ratio (\note{KEYWORD}) with the PSF model. For these fits, the588 dependent parameters are fixed by the PSF model and only the 4589 independent object model parameters are allowed to vary in the fit.590 PSPhot again uses the Levenberg-Marqardt process for the non-linear591 fitting. The objects are fitted in their S/N order, starting with the592 brightest and working down to the user-specified limit.593 594 Once a solution has been achieved, PSPhot attempts to judge the595 quality of the PSF model as a representation of the object shape. To596 do this, it calculates the next step of the minimization {\em allowing597 the shape parameters to vary}. This step, essentially the598 Gauss-Newton minimization distance from the current local minimum,599 should be very small if the object is well represented by the PSF, but600 large if the PSF is not a good representation of the object flux. The601 model quality is judged by the change in the two shape parameters602 which represent the 2D size of the object. For the case of the603 elliptical Gaussian, these two parameters are $\sigma_x$ and604 $\sigma_y$. For a generic model, the shape parameters may be defined605 differently, but the should always be two parameters which scale the606 object size in two dimensions (what about a polar-coordinate form?)607 Currently, PSPhot requires the two relevant shape parameters to be the608 first two dependent parameters in the list of model parameters (ie,609 parameters 4 \& 5).610 611 The expected distribution of the variation of the two shape parameters612 will be a function of the signal-to-noise of the object in question613 and the value of the shape parameter itself. The expected standard614 deviation on the shape parameter is, eg, $\sigma_x / {\rm SN}$. If615 the object is well-represented by the PSF, then the shape parameter616 values should be close to their minimization value. We can thus ask,617 for each object, given the measured amplitude of the Gauss-Newton618 step, how many standard deviations from the expected value (of 0.0) is619 this particular value? Objects for which the variation in the shape620 parameters is a large positive number of standard deviations are621 likely to be better represented by a larger flux distribution than the622 PSF (eg, a Galaxy or Comet, etc). Objects for which the variation in623 the shape parameters is a large negative number of standard deviations624 are likely to be better represented by a smaller flux distribution625 than the PSF (ie, a cosmic ray or other defect). A user-defined626 number of standard deviations is used to select these two cases, and627 to flag the object as a likely galaxy (really meaning 'extended') or628 as a likely defect.629 630 At this stage of the analysis, PSPhot uses two additional indicators631 to identify good and poor PSF fits. The first of these is the632 signal-to-noise ratio. It is possible for the peak finding algorithm633 to identify peaks in locations which are not actually a normal peak.634 Some of these cases are in the edges of saturated, bleeding columns635 from bright stars, in the nearly flat halos of very bright stars, and636 so on. In these cases, a local peak exists, with a lower nearby sky637 region. However, the fitted PSF model cannot converge on the peak638 because it is very poorly defined (perhaps only existing in the639 smoothed image). The fit can either fail to converge or it can640 converge on a fit with very low or negative peak flux / flux641 normalization. PSPhot will flag any non-convergent PSF fit and any642 object with PSF S/N ratio lower than a user-defined cutoff. It is643 also useful to identify very poor fits by setting a maximum Chi-Square644 cutoff for objects.645 646 As the objects are fitted to the PSF model, those which survive the647 exclusion stage are subtracted from the image. The subtraction648 process modifies the image pixels (removing the fitted flux, though649 not the locally fitted background) but does not modify the mask or the650 noise images. The signal-to-noise ratio in the image after651 subtraction represents the significance of the remaining flux. If the652 subtractions are sufficiently accurate models of the PSF flux653 distribution, the remaining flux should be below 1 $\sigma$654 significance. In practice the cores of bright stars are poorly655 represented and may have larger residual significance. \note{in future656 work, we may choose to enhance the noise to minimize detection of657 objects in the residuals of brighter objects}.658 659 951 \subsubsection{Types of Object / PSF models currently available} 660 952 … … 662 954 663 955 \begin{itemize} 664 \item Pure elliptical Gaussian (GAUSS)665 \item polynomial approximation to a Gaussian (PGAUSS)666 \item RGAUSS667 \item QGAUSS - power law with variable exponential term956 \item GAUSS : Pure elliptical Gaussian 957 \item PGAUSS : polynomial approximation to a Gaussian (PGAUSS) 958 \item QGAUSS : power law with variable exponential term 959 \item SGAUSS : 668 960 \end{itemize} 669 961 670 \subsection{Non-PSF Objects} 671 672 Once every object (above the S/N cutoff) has been confronted with the 673 PSF model, the objects which are thought to be galaxies (extended) can 674 now be fit with appropriate models for the galaxies (or other likely 675 extended shapes). Again, the fitting stage starts with the brightest 676 sources (as judged by the rough S/N measured from the moments 677 aperture) and working to a user defined S/N limit. 678 679 PSPhot will use the user-selected galaxy model to attempt the galaxy 680 model fits. In the configuration system, the keyword \code{GAL_MODEL} 681 is set to the model of interest. All suspected extended objects are 682 fitted with the model, allowing all of the parameters to float. The 683 initial parameter guesses are critical here to achieving convergence 684 on the model fits in a reasonable time. The moments and the pixel 685 flux distribution are used to make the initial parameter guess. Many 686 of the object parameters can be accurately guessed from the first and 687 second moments. The power-law slope can be guessed by measuring the 688 isophotal level at two elliptical radii and comparing the ratio to 689 that expected. 690 691 For each of the galaxy models (in fact for all object models), a 692 function is defined which examines the fit results and determines if 693 the fit can be consider as a success or a failure. The exact criteria 694 for this decision will depend on the details of the model, and so this 695 level of abstraction is needed. For example, in some case, the range 696 of valid values for each of the parameters must be considered in the 697 fit assessment. In other cases, we may choose to use only the 698 parameter errors and the fit Chi-Square value. 699 700 All galaxy model fits which are successful are then subtracted from 701 the image as is done for the successful PSF model fits. Of course, 702 the background flux is retained, with the result that only the object 703 is subtracted from the image. Again, the noise image is (currently) 704 not modified. 705 706 \note{we have no code yet to select the best of several models for a 707 given objects. The relative value of the Chi-Square is the obvious 708 test in this case}. 709 710 \subsection{Faint Sources} 711 712 \note{the following discussion is theoretical : it is not yet coded} 713 714 After a first pass through the image, in which the brighter sources 715 above a high threshold level have been detected, measured, and 716 subtracted, PSPhot optionally begins a second pass at the image. In 717 this stage, the new peaks are detected on the image with the bright 718 objects subtracted. In this pass, the peak detection process uses the 719 noise image to test the validity of the individual peaks. All peaks 720 with a significance greater than a user-defined minimum threshold are 721 accepted as objects of potential interest. 722 723 The objects which are measured in this faint-object stage are clearly 724 low significance detections. A typical threshold for the bright 725 object analysis would S/N of 5 - 10. The lower limit cutoff for the 726 faint object analysis would typically be S/N of 2 - 4. In this stage, 727 PSPhot can perform one of three types of analysis. The difference 728 between these options is one of speed vs detail. 729 730 In the first option, PSPhot can repeat the analysis described above in 731 sections XXX and XXX, performing a PSF fit followed by a non-PSF fit 732 to the objects which are not PSF-like, and subtracting them. The 733 advantage of this option is that the faint objects are treated 734 identically to the bright objects, and all potential parameters are 735 measured, even for marginally extended sources. The disadvantage of 736 this option is that the low signal-to-noise of the objects in this 737 stage limits the amount of information which can be extracted from 738 them. The marginal gain may not be worth the large expense of 739 processing time. 740 741 In the second option, PSPhot can perform only the PSF model fit to the 742 remaining peaks, but ignore any further questions of the shape of the 743 objects. The advantage of this option is that it is substantially 744 faster than performing the more complex (and less stable) 745 multi-parameter non-linear fits on all faint objects. On the 746 downside, less information is learned about the objects. 747 748 Finally, PSPhot can simply ignore the fitting process and instead 749 glean information about the fainter sources on the basis of the peak 750 characteristics. In this option, the image is smoothed with the PSF 751 model, and the peak for each object is measured. The peak flux and 752 the local peak curvature theoretically give sufficient information to 753 recover the object flux, the centroid coordinates, and the centroid 754 errors. The advantage of the stage is speed, especially for the very 755 faintest levels: if the lower limit is not sufficiently faint, the 756 time spent in performing the smoothing (3 FFTs) cannot make up for the 757 time which would have been spent applying the PSF model to the peaks. 758 The downside of this method is an increased sensitivity to the local 759 sky model (the local sky must be correctly subtracted) and fewer 760 constraints on the quality of the detection (no Chi-Square is 761 measured, for example). 762 763 \note{In the ideal case, if we were only interested in detecting PSFs, 764 and we had a good model for the PSF, we could optimally find the 765 sources by smoothing the image and the noise image with the PSF model. 766 \em write out the description of Nick's optimal PSF finding}. 767 768 PSPhot allows the user to select between these three options for the 769 analysis of the faint sources. Three separate user-controlled 770 signal-to-noise ratio limits are defined. One specifies the depth to 771 which the PSF / non-PSF analysis is performed. A second (which must 772 be smaller) specifies the depth to which only the PSF is fitted. A 773 third specifies the depth to which the analysis is performed using on 774 the peak statistics. If two of these are identical, then certain of 775 these options are simply skipped. For example, if the peak analysis 776 threshold is set to the same value as the PSF-only threshold, no peak 777 analysis is performed. 962 \note{discuss the stability issues with the galaxy model(s)} 963 964 \subsection{Output Options} 965 966 \note{need to discuss tests} 967 968 \note{need to discuss failings and holes} 969 970 \section{Alternative Scenarios} 971 972 \subsection{Trailed Sources} 973 974 \subsection{Fixed / Known-position Sources} 778 975 779 976 \subsection{Difference Images} … … 833 1030 discussed in the section on Galaxy models. 834 1031 835 \note{need to discuss tests} 836 837 \note{need to discuss failings and holes} 1032 \section{PSPhot Structures and Data Elements} 1033 1034 The following structures are described in detail in the document 1035 `Pan-STARRS PS-1 Image Processing Pipeline Modules Supplementary 1036 Design Requirements' (psModules SDRS; PSDC-430-012). 1037 1038 \begin{datatype} 1039 pmModel 1040 pmModelGroup 1041 pmGrowthCurve 1042 pmPSF 1043 pmPSFTry 1044 pmSource 1045 pmPeak 1046 pmMoments 1047 \end{datatype} 1048 1049 \note{psphot is supposed to operate on individual readouts, and use 1050 the techniques used by ppImage to extract header-related metadata. 1051 currently, psphot uses an alternative to the psReadout until the 1052 ppImage code can be folded together with psphot}. 1053 1054 \subsection{Top-Level APIs} 1055 1056 \begin{prototype} 1057 psMetadata *psphotArguments (int *argc, char **argv); 1058 \end{prototype} 1059 Load the command-line arguments, parse the configuration file, and 1060 place the configuration information on a single metadata structure. 1061 This function searches for the following command line option flags, 1062 and places their corresponding values on the output metadata with the 1063 given name. These options override any such values in the 1064 configuration file. 1065 \begin{verbatim} 1066 -mask (filename) : MASK_IMAGE 1067 -weight (filename) : WEIGHT_IMAGE 1068 -resid (filename) : RESID_IMAGE 1069 -region [x0:x1,y0:y1] : ANALYSIS_REGIONP 1070 -photcode (code) : PHOTCODE 1071 -psf (filename) : PSF_INPUT_FILE 1072 -modeltest x y : TEST_FIT_X, TEST_FIT_Y 1073 -model (name) : TEST_FIT_MODEL 1074 -fitmode (name) : TEST_FIT_MODE 1075 -fitset (name) : TEST_FIT_SET 1076 \end{verbatim} 1077 1078 The following option flags can be used to set any option: 1079 \begin{verbatim} 1080 -D (key) (value) : any string value 1081 -Df (key) (value) : any F32 value 1082 -Di (key) (value) : any S32 value 1083 \end{verbatim} 1084 1085 The function next examines the remaining command-line arguments and 1086 complains if there are not exactly 3 arguments, reporting the program 1087 usage. It sets default configuration variables, and then loads the 1088 configuration file specified as the third command-line option. 1089 Finally, it sets the \code{IMAGE} and \code{OUTPUT_FILE} config 1090 options to arguments 1 and 2, respecitively. 1091 1092 \begin{prototype} 1093 eamReadout *psphotSetup (psMetadata *config); 1094 \end{prototype} 1095 This function examines the configuration data in \code{config} and 1096 loads the image into memory. It constructs the weight and mask images 1097 if they have not been specified, or loads the specified images. The 1098 weight image is built based on the read noise and gain of the image, 1099 as extracted from the header or from the configuration options 1100 directly. It defines the mask based on the selection image region, 1101 the values for saturation and the \code{min_VALID_PIXEL}. 1102 1103 \begin{prototype} 1104 bool psphotModelTest (eamReadout *imdata, psMetadata *config); 1105 \end{prototype} 1106 This function is an optional test mode for psphot. If the test mode 1107 has been selected, this function will attempt to fit a single object 1108 with the requested model. It writes out subimage containing the 1109 source, the difference, the mask, and the weight. This function may 1110 load a PSF model or fit a floating model. 1111 1112 \begin{prototype} 1113 psStats *psphotImageStats (eamReadout *imdata, psMetadata *config); 1114 \end{prototype} 1115 Measure the basic image properties: median sky, expected sky sigma 1116 1117 \begin{prototype} 1118 psPolynomial2D *psphotImageBackground (eamReadout *imdata, psMetadata *config, psStats *sky); 1119 \end{prototype} 1120 Model the image background as a 2D polynomial and subtract from the 1121 image. The should use a more sophisticated model and return the 1122 subtracted image. 1123 1124 \begin{prototype} 1125 psArray *psphotFindPeaks (eamReadout *imdata, psMetadata *config, psStats *sky); 1126 \end{prototype} 1127 Create a smoothed image and find all local peaks above the threshold 1128 level (uses: \code{PEAKS_SMOOTH_SIGMA, PEAKS_SMOOTH_NSIGMA, 1129 PEAKS_NSIGMA_LIMIT, PEAKS_OUTPUT_FILE}) 1130 1131 \begin{prototype} 1132 psArray *psphotSourceStats (eamReadout *imdata, psMetadata *config, psArray *allpeaks); 1133 \end{prototype} 1134 Create the basic source structures for all peaks, define the initial 1135 pixels, measure the local sky (sky offset) and the source moments. 1136 1137 \begin{prototype} 1138 bool psphotRoughClass (psArray *sources, psMetadata *config); 1139 \end{prototype} 1140 Find the PSF clump and make the first cut source identifications 1141 1142 \begin{prototype} 1143 bool psphotBasicDeblend (psArray *sources, psMetadata *config, psStats *sky); 1144 \end{prototype} 1145 Find all blended peaks and tag, group with single primary source. 1146 1147 \begin{prototype} 1148 pmPSF *psphotChoosePSF (psMetadata *config, psArray *sources, psStats *sky); 1149 \end{prototype} 1150 Try each of the selected PSF models on a subset of likely PSF stars. 1151 Measure the metric (aperture residual scatter) for each PSF model and 1152 choose the best model. 1153 1154 \begin{prototype} 1155 bool psphotEnsemblePSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 1156 \end{prototype} 1157 Perform simultaneous fitting to all sources in the array using a 1158 linear fitting process which assumes all sources are PSFs and their 1159 positions are fixed. Set the positions based on the bilinear 1160 interpolation of the peak implied by the 3x3 square of pixels 1161 containing the peak. Local sky is also assumed to be correctly subtracted. 1162 1163 \begin{prototype} 1164 bool psphotFullFit (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 1165 \end{prototype} 1166 Fit all sources in sequence starting from the brightest, and 1167 subtracting the sources as they are fitted. This function only 1168 attempts single PSF and single EXT models and chooses between them. 1169 The sources are assumed to have been subtracted in advance (ie, using 1170 psphotEnsembleFit). The models which do not succeed are re-subtracted 1171 using the prior model. 1172 1173 \begin{prototype} 1174 bool psphotBlendFit (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 1175 \end{prototype} 1176 Fit all sources in sequence starting from the brightest, and 1177 subtracting the sources as they are fitted. This function attempts a 1178 multi-source fit for blended sources, or a single PSF if it is not a 1179 blend, followed by both EXT and DBL models and chooses between them. 1180 The sources are assumed to have been subtracted in advance (ie, using 1181 psphotEnsembleFit). The models which do not succeed are re-subtracted 1182 using the prior model. 1183 1184 \begin{prototype} 1185 bool psphotReplaceUnfit (psArray *sources); 1186 \end{prototype} 1187 After models have been attempted for all sources, this function 1188 replaces the sources which were temporarily subtracted, but which did 1189 not succeed or converge on a good solution. 1190 1191 \begin{prototype} 1192 bool psphotApplyPSF (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 1193 \end{prototype} 1194 Attempt to fit the PSF model to all sources in brightness order, 1195 subtracting the resulting model if successful. Only attempts single 1196 PSF models. 1197 1198 \begin{prototype} 1199 bool psphotFitExtended (eamReadout *imdata, psMetadata *config, psArray *sources, psStats *skyStats); 1200 \end{prototype} 1201 Attempt to fit the PSF model to all sources in brightness order, 1202 subtracting the resulting model if successful. Only attempts single 1203 EXT models. 1204 1205 \begin{prototype} 1206 bool psphotApResid (eamReadout *imdata, psArray *sources, psMetadata *config, pmPSF *psf); 1207 \end{prototype} 1208 Measure the curve-of-growth and the aperture correction trend. 1209 1210 \begin{prototype} 1211 void psphotOutput (eamReadout *imdata, psMetadata *config, psArray *sources, pmPSF *psf, psStats *sky); 1212 \end{prototype} 1213 Write out data in various formats as selected. 838 1214 839 1215 \section{User's Guide} … … 879 1255 \section{Sample Tests} 880 1256 1257 \section{Further Work to be Completed} 1258 1259 \begin{itemize} 1260 \item convert to pmCell as input data 1261 \item loop over all readouts in a pmCell 1262 \item write out multiple files? 1263 \item better method for defining the recipe? 1264 \item additional options for image background 1265 \item image background should return a background image 1266 881 1267 \end{document}
Note:
See TracChangeset
for help on using the changeset viewer.
