This file will define structures and functions related to the task of source detection and measurement. The elements defined in this section are generally low-level components which can be connected together to construct a complete object measurement suite.
Definition in file pmObjects.h.
#include <stdio.h>
#include <math.h>
#include "pslib.h"
#include "pmAstrometry.h"
Include dependency graph for pmObjects.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Data Structures | |
| struct | pmPeak |
| pmPeak data structure More... | |
| struct | pmMoments |
| pmMoments data structure More... | |
| struct | pmPSFClump |
| pmPSFClump data structure More... | |
| struct | pmModel |
| pmModel data structure More... | |
| struct | pmSource |
| pmSource data structure More... | |
Defines | |
| #define | PM_OBJECTS_H |
| #define | PS_MODEL_GAUSS 0 |
| #define | PS_MODEL_PGAUSS 1 |
| #define | PS_MODEL_QGAUSS 2 |
| #define | PS_MODEL_SGAUSS 3 |
Typedefs | |
| typedef int | pmModelType |
Enumerations | |
| enum | psphotMaskValues { PSPHOT_MASK_CLEAR = 0x00, PSPHOT_MASK_INVALID = 0x01, PSPHOT_MASK_SATURATED = 0x02, PSPHOT_MASK_MARKED = 0x08 } |
| In the object analysis process, we will use specific mask values to mark the image pixels. More... | |
| enum | pmPeakType { PM_PEAK_LONE, PM_PEAK_EDGE, PM_PEAK_FLAT, PM_PEAK_UNDEF } |
| pmPeakType More... | |
| enum | pmSourceType { PM_SOURCE_DEFECT, PM_SOURCE_SATURATED, PM_SOURCE_SATSTAR, PM_SOURCE_PSFSTAR, PM_SOURCE_GOODSTAR, PM_SOURCE_POOR_FIT_PSF, PM_SOURCE_FAIL_FIT_PSF, PM_SOURCE_FAINTSTAR, PM_SOURCE_GALAXY, PM_SOURCE_FAINT_GALAXY, PM_SOURCE_DROP_GALAXY, PM_SOURCE_FAIL_FIT_GAL, PM_SOURCE_POOR_FIT_GAL, PM_SOURCE_OTHER } |
| pmSourceType enumeration More... | |
| enum | pmContourType { PS_CONTOUR_CRUDE, PS_CONTOUR_UNKNOWN01, PS_CONTOUR_UNKNOWN02 } |
| pmContourType More... | |
Functions | |
| pmPeak * | pmPeakAlloc (int x, int y, float counts, pmPeakType class) |
| pmPeakAlloc() | |
| pmMoments * | pmMomentsAlloc () |
| pmMomentsAlloc() | |
| pmModel * | pmModelAlloc (pmModelType type) |
| pmModelAlloc() | |
| pmSource * | pmSourceAlloc () |
| pmSourceAlloc() | |
| psVector * | pmFindVectorPeaks (const psVector *vector, float threshold) |
| pmFindVectorPeaks() | |
| psArray * | pmFindImagePeaks (const psImage *image, float threshold) |
| pmFindImagePeaks() | |
| psList * | pmCullPeaks (psList *peaks, float maxValue, const psRegion valid) |
| pmCullPeaks() | |
| psArray * | pmPeaksSubset (psArray *peaks, float maxvalue, const psRegion valid) |
| pmPeaksSubset() | |
| bool | pmSourceDefinePixels (pmSource *mySource, pmReadout *readout, psF32 x, psF32 y, psF32 Radius) |
| pmSourceDefinePixels() | |
| bool | pmSourceLocalSky (pmSource *source, psStatsOptions statsOptions, float Radius) |
| pmSourceLocalSky() | |
| bool | pmSourceMoments (pmSource *source, float radius) |
| pmSourceMoments() | |
| pmPSFClump | pmSourcePSFClump (psArray *source, psMetadata *metadata) |
| pmSourcePSFClump() | |
| bool | pmSourceRoughClass (psArray *source, psMetadata *metadata, pmPSFClump clump) |
| pmSourceRoughClass() | |
| pmModel * | pmSourceModelGuess (pmSource *source, pmModelType model) |
| pmSourceModelGuess() | |
| psArray * | pmSourceContour (pmSource *source, const psImage *image, float level, pmContourType mode) |
| pmSourceContour() | |
| bool | pmSourceFitModel (pmSource *source, pmModel *model, const bool PSF) |
| pmSourceFitModel() | |
| bool | pmModelFitStatus (pmModel *model) |
| pmModelFitStatus() | |
| bool | pmSourceAddModel (psImage *image, psImage *mask, pmModel *model, bool center) |
| pmSourceAddModel() | |
| bool | pmSourceSubModel (psImage *image, psImage *mask, pmModel *model, bool center) |
| pmSourceSubModel() | |
| bool | pmSourcePhotometry (float *fitMag, float *obsMag, pmModel *model, psImage *image, psImage *mask) |
| The function returns both the magnitude of the fit, defined as -2.5log(flux), where the flux is integrated under the model, theoretically from a radius of 0 to infinity. | |
| int | pmSourceDophotType (pmSource *source) |
| This function converts the source classification into the closest available approximation to the Dophot classification scheme:. | |
| int | pmSourceSextractType (pmSource *source) |
| pmSourceSextractType() | |
| bool | pmSourceFitModel_v5 (pmSource *source, pmModel *model, const bool PSF) |
| pmSourceFitModel_v5() | |
| bool | pmSourceFitModel_v7 (pmSource *source, pmModel *model, const bool PSF) |
| pmSourceFitModel_v7() | |
| psF32 | pmModelEval (pmModel *model, psImage *image, psS32 col, psS32 row) |
| pmModelEval() | |
|
|
Definition at line 20 of file pmObjects.h. |
|
|
Definition at line 121 of file pmObjects.h. |
|
|
Definition at line 122 of file pmObjects.h. |
|
|
Definition at line 123 of file pmObjects.h. |
|
|
Definition at line 124 of file pmObjects.h. |
|
|
Definition at line 120 of file pmObjects.h. |
|
|
pmContourType Only one type is defined at present. Definition at line 436 of file pmObjects.h. |
|
|
pmPeakType A peak pixel may have several features which may be determined when the peak is found or measured. These are specified by the pmPeakType enum. PM_PEAK_LONE represents a single pixel which is higher than its 8 immediate neighbors. The PM_PEAK_EDGE represents a peak pixel which touching the image edge. The PM_PEAK_FLAT represents a peak pixel which has more than a specific number of neighbors at the same value, within some tolarence:
Definition at line 56 of file pmObjects.h. |
|
|
pmSourceType enumeration A given source may be identified as most-likely to be one of several source types. The pmSource entry pmSourceType defines the current best-guess for this source. XXX: The values given below are currently illustrative and will require some modification as the source classification code is developed. (TBD)
Definition at line 158 of file pmObjects.h. |
|
|
In the object analysis process, we will use specific mask values to mark the image pixels. The following structure defines the relevant mask values. XXX: This is probably a bad solution: we will want to set mask values outside of the PSPHOT code. Perhaps we can set up a registered set of mask values with specific meanings that other functions can add to or define? Definition at line 38 of file pmObjects.h. |
|
||||||||||||||||
|
Eliminate peaks from the psList that have a peak value above the given maximum, or fall outside the valid region.
|
|
||||||||||||
|
Find all local peaks in the given image above the given threshold. This function should find all row peaks using pmFindVectorPeaks, then test each row peak and exclude peaks which are not local peaks. A peak is a local peak if it has a higher value than all 8 neighbors. If the peak has the same value as its +y neighbor or +x neighbor, it is NOT a local peak. If any other neighbors have an equal value, the peak is considered a valid peak. Note two points: first, the +x neighbor condition is already enforced by pmFindVectorPeaks. Second, these rules have the effect of making flat-topped regions have single peaks at the (+x,+y) corner. When selecting the peaks, their type must also be set. The result of this function is an array of pmPeak entries.
|
|
||||||||||||
|
Find all local peaks in the given vector above the given threshold. A peak is defined as any element with a value greater than its two neighbors and with a value above the threshold. Two types of special cases must be addressed. Equal value elements: If an element has the same value as the following element, it is not considered a peak. If an element has the same value as the preceding element (but not the following), then it is considered a peak. Note that this rule (arbitrarily) identifies flat regions by their trailing edge. Edge cases: At start of the vector, the element must be higher than its neighbor. At the end of the vector, the element must be higher or equal to its neighbor. These two rules again places the peak associated with a flat region which touches the image edge at the image edge. The result of this function is a vector containing the coordinates (element number) of the detected peaks (type psU32).
|
|
|
|
|
||||||||||||||||||||
|
XXX: Need descriptions |
|
|
This function wraps the call to the model-specific function returned by pmModelFitStatusFunc_GetFunction. The model-specific function examines the model parameters, parameter errors, Chisq, S/N, and other parameters available from model to decide if the particular fit was successful or not. XXX: Must code this.
|
|
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||
|
Create a new peaks array, removing certain types of peaks from the input array of peaks based on the given criteria. Peaks should be eliminated if they have a peak value above the given maximum value limit or if the fall outside the valid region. The result of the function is a new array with a reduced number of peaks.
|
|
||||||||||||||||||||
|
Add the given source model flux to/from the provided image. The boolean option center selects if the source is re-centered to the image center or if it is placed at its centroid location. The boolean option sky selects if the background sky is applied (TRUE) or not. The pixel range in the target image is at most the pixel range specified by the source.pixels image. The success status is returned.
|
|
|
|
|
||||||||||||||||||||
|
Find points in a contour for the given source at the given level. If type is PM_CONTOUR_CRUDE, the contour is found by starting at the source peak, running along each pixel row until the level is crossed, then interpolating to the level coordinate for that row. This is done for each row, with the starting point determined by the midpoint of the previous row, until the starting point has a value below the contour level. The returned contour consists of two vectors giving the x and y coordinates of the contour levels. This function may be used as part of the model guess inputs. Other contour types may be specified in the future for more refined contours (TBD)
|
|
||||||||||||||||||||||||
|
Define psImage subarrays for the source located at coordinates x,y on the image set defined by readout. The pixels defined by this operation consist of a square window (of full width 2Radius+1) centered on the pixel which contains the given coordinate, in the frame of the readout. The window is defined to have limits which are valid within the boundary of the readout image, thus if the radius would fall outside the image pixels, the subimage is truncated to only consist of valid pixels. If readout->mask or readout->weight are not NULL, matching subimages are defined for those images as well. This function fails if no valid pixels can be defined (x or y less than Radius, for example). This function should be used to define a region of interest around a source, including both source and sky pixels. XXX: must code this.
|
|
|
This function converts the source classification into the closest available approximation to the Dophot classification scheme:. PM_SOURCE_DEFECT: 8 PM_SOURCE_SATURATED: 8 PM_SOURCE_SATSTAR: 10 PM_SOURCE_PSFSTAR: 1 PM_SOURCE_GOODSTAR: 1 PM_SOURCE_POOR_FIT_PSF: 7 PM_SOURCE_FAIL_FIT_PSF: 4 PM_SOURCE_FAINTSTAR: 4 PM_SOURCE_GALAXY: 2 PM_SOURCE_FAINT_GALAXY: 2 PM_SOURCE_DROP_GALAXY: 2 PM_SOURCE_FAIL_FIT_GAL: 2 PM_SOURCE_POOR_FIT_GAL: 2 PM_SOURCE_OTHER: ?
|
|
||||||||||||||||
|
Fit the requested model to the specified source. The starting guess for the model is given by the input source.model parameter values. The pixels of interest are specified by the source.pixelsand source.maskentries. This function calls psMinimizeLMChi2() on the image data. The function returns TRUE on success or FALSE on failure.
|
|
||||||||||||||||
|
Fit the requested model to the specified source. The starting guess for the model is given by the input source.model parameter values. The pixels of interest are specified by the source.pixelsand source.maskentries. This function calls psMinimizeLMChi2() on the image data. The function returns TRUE on success or FALSE on failure.
|
|
||||||||||||||||
|
Fit the requested model to the specified source. The starting guess for the model is given by the input source.model parameter values. The pixels of interest are specified by the source.pixelsand source.maskentries. This function calls psMinimizeLMChi2() on the image data. The function returns TRUE on success or FALSE on failure.
|
|
||||||||||||||||
|
Measure the local sky in the vicinity of the given source. The Radius defines the square aperture in which the moments will be measured. This function assumes the source pixels have been defined, and that the value of Radius here is smaller than the value of Radius used to define the pixels. The annular region not contained within the radius defined here is used to measure the local background in the vicinity of the source. The local background measurement uses the specified statistic passed in via the statsOptions entry. This function allocates the pmMoments structure. The resulting sky is used to set the value of the pmMoments.sky element of the provided pmSource structure.
|
|
||||||||||||
|
Convert available data to an initial guess for the given model. This function allocates a pmModel entry for the pmSource structure based on the provided model selection. The method of defining the model parameter guesses are specified for each model below. The guess values are placed in the model parameters. The function returns TRUE on success or FALSE on failure.
|
|
||||||||||||
|
Measure source moments for the given source, using the value of source.moments.sky provided as the local background value and the peak coordinates as the initial source location. The resulting moment values are applied to the source.moments entry, and the source is returned. The moments are measured within the given circular radius of the source.peak coordinates. The return value indicates the success (TRUE) of the operation.
|
|
||||||||||||||||||||||||
|
The function returns both the magnitude of the fit, defined as -2.5log(flux), where the flux is integrated under the model, theoretically from a radius of 0 to infinity. In practice, we integrate the model beyond 50sigma. The aperture magnitude is defined as -2.5log(flux) , where the flux is summed for all pixels which are not excluded by the aperture mask. The model flux is calculated by calling the model-specific function provided by pmModelFlux_GetFunction. XXX: must code this.
|
|
||||||||||||
|
We use the source moments to make an initial, approximate source classification, and as part of the information needed to build a PSF model for the image. As long as the PSF shape does not vary excessively across the image, the sources which are represented by a PSF (the start) will have very similar second moments. The function pmSourcePSFClump searches a collection of sources with measured moments for a group with moments which are all very similar. The function returns a pmPSFClump structure, representing the centroid and size of the clump in the sigma_x, sigma_y second-moment plane. The goal is to identify and characterize the stellar clump within the sigma_x, sigma_y second-moment plane. To do this, an image is constructed to represent this plane. The units of sigma_x and sigma_y are in image pixels. A pixel in this analysis image represents 0.1 pixels in the input image. The dimensions of the image need only be 10 pixels. The peak pixel in this image (above a threshold of half of the image maximum) is found. The coordinates of this peak pixel represent the 2D mode of the sigma_x, sigma_y distribution. The sources with sigma_x, sigma_y within 0.2 pixels of this value are then * used to calculate the median and standard deviation of the sigma_x, sigma_y values. These resulting values are returned via the pmPSFClump structure. The return value indicates the success (TRUE) of the operation. XXX: Limit the S/N of the candidate sources (part of Metadata)? (TBD). XXX: Save the clump parameters on the Metadata (TBD)
|
|
||||||||||||||||
|
Based on the specified data values, make a guess at the source classification. The sources are provides as a psArray of pmSource entries. Definable parameters needed to make the classification are provided to the routine with the psMetadata structure. The rules (in SDRS) refer to values which can be extracted from the metadata using the given keywords. Except as noted, the data type for these parameters are psF32.
|
|
|
This function converts the source classification into the closest available approximation to the Sextractor classification scheme. the correspondence is not yet defined (TBD) . XXX: Must code this.
|
|
||||||||||||||||||||
|
Subtract the given source model flux to/from the provided image. The boolean option center selects if the source is re-centered to the image center or if it is placed at its centroid location. The boolean option sky selects if the background sky is applied (TRUE) or not. The pixel range in the target image is at most the pixel range specified by the source.pixels image. The success status is returned.
|
1.4.5