AperturePhotometry

By Andrés del Pozo


Script for measuring the flux of the known stars in astronomical images. [more]

Keywords: photometry, aperture photometry

Contents

[hide]

1 Introduction

[hide]

Wikipedia defines Photometry [3] as a technique of astronomy concerned with measuring the flux, or intensity of an astronomical object's electromagnetic radiation. Although there are several methods for measuring the flux, this script uses one based on what we call apertures: windows of a given size where the flux is integrated.

This script is limited to the flux calculation. Further analysis must be done using other tools.

For each star we want to measure, an aperture is centered on the star with dimensions chosen by the user. The flux is obtained by adding the value of each pixel contained in the aperture and subtracting the estimated background level. The script implements two different algorithms for calculating the flux depending on how the background is estimated.

When the background is estimated from a background model (see Multiscale Median Transform or Automatic Background Extraction), the script uses this formula:

[1]

Where is the index of each pixel of the image. is the area of the intersection of the pixel and the aperture. The values of are such that the area of the aperture is the sum of the values of for all the pixels:

[2]

When the background is estimated from the source image (see Source Image), the script uses this formula:

[3]

The background level is estimated by calculating the median value of the pixels inside the background aperture (see Square ring). This value is calculated after making a sigma clipping outlier rejection inside the background aperture (see Square ring).

The script currently only measures the flux of known stars in one of the supported catalogs.

The script uses the following steps:

  • Image selection: The user can choose between analyzing the active image in PixInsight or processing a list of images. The images must be plate-solved in order before applying the script. If the images do not have an astrometric solution yet, the script can solve them.
  • Star extraction: For each image the script queries a catalog to get the catalogued stars in the field of view of the image. Then, these stars are projected into the image and their exact position is calculated.
  • Flux calculation: For each star the script calculates the raw flux adding the value (in electrons) of each pixel inside the aperture. The pixels only partially inside the aperture are weighted proportionally to the area inside of it.
  • Background calculation: For each star the script calculates the background flux. This calculation can be using different methods. The net flux of the star is obtained subtracting the background flux from the raw flux.
  • Output: After measuring all the stars in the images, the scrip can write the results to files. The user can choose what types of data wants to write.

The configuration dialog of the script is structured mirroring these steps. The dialog has a tab for configuring each step. The usage of the script is explained in the next section.

2 Usage

[hide]

The photometry script has many configuration parameters. To simplify its use the configuration dialog has been divided in separate sections. Each allows to define a set of parameters.

2.1 Images

The objective of the Images tab is the selection of the image or images that the script will process:

Active image in PixInsight

When this option is selected the script will process the active image in PixInsight. This option is enabled only when there is at least one image open in the application.

Files

Click this option to select a list of files to process. Use the buttons Add files and Remove files to add or remove files to the list. The button Clear files removes all the files in the list.

The files in this list don't need to be open in the application as the script opens them before processing each one.

2.1.1 Plate-solve parameters

This collapsible section allows to define the plate-solving parameters for the images.

Plate-solve the unsolved images

The script requires an astrometric solution for each image, stored in tags using the WCS convention [1] [2]. If the image has not coordinates and this option is selected the script tries to solve it by using the ImageSolver script. If the image cannot be solved, the script skips it and jumps to the next image.

The button Configure solver opens the configuration dialog of ImageSolver. These parameters are used as a starting point when solving the images. This forces to have a similar center and resolution for all the image set. If the images are from different sky areas, they must be solved prior to running the AperturePhotometry script, using ImageSolver on each one.

Use image metadata

When solving an image the solver will prioritize the image metadata (Coordinates, focal length, epoch). If any of the parameters is not available the solver will substitute them with the values in the solver dialog.

Use solver configuration

When solving an image the solver will use the configuration in the solver dialog while ignoring the values (coordinates, focal length, epoch, ...) that the images could have.

Force plate-solving the already solved images

When this option is active the script tries to plate-solve all the images, including those already solved.

This option can be used when the current astrometric solution is not good enough and you desire to improve it.

Save the solution of the plate-solving

If this option is selected the images are saved with the newly found astrometric solution. When this option is not selected the images are not modified in the disk and the coordinates are lost when the script finishes. This option is only enabled when Plate-solve the unsolved images is selected.

Output file suffix

This suffix will be appended to the filename when saving the plate-solve solution. If it is empty, the original file will be overwritten.

2.2 Stars

This tab provides the options for configuring how the stars are found in the image.

The star extraction process has additional parameters:

Margin

This value sets a minimum distance in pixels of the stars to the borders. The stars that are too close to the image borders are not processed.

2.2.1 Stars Catalog

The Stars Catalog section configures the queries to the star catalog.

Catalog

This options determine which catalog is going to be used for finding stars. The script will only process the stars in this catalog. The list shows all the available catalogs in AnnotateImage. Since some of the catalogs don't store stars, the catalog must be chosen carefully.

VizieR server

This list shows the list of mirrors of VizieR. You should select the best server for your location.

Maximum magnitude

This option limits the magnitude of the extracted stars. This magnitude is the actual value in the catalog and not the effective magnitude in the image. You should select a suitable value for the images that are going to be processed. It is useless to select a too high magnitude limit for your image set because they will have a very low SNR.

Since most of the catalogs store the magnitudes for different filters, you have to select the desired catalog filter.

2.2.2 User defined objects

Sometimes it is necessary to measure the flux of objects that are not in the catalog (supernovas, faint stars, asteroids, comets, etc). This collapsible section allows to add objects to the list of objects that will be measured. This objects will be measured the same way as the objects read from the catalog.

List of objects

This list shows the objects defined by the user. For each object the list contains its name and equatorial coordinates.

Add object

This button opens a dialog for defining a new object. This dialog has two tabs: one for searching the coordinates in the service Sesame. The other has fields for writing the coordinates.

Delete object

Deletes the selected objects in the list.

Modify object

This button opens the configuration dialog of the selected object.

2.2.3 Source for star extraction

After querying the catalog for the J2000 coordinates of the stars, the script tries to map these coordinates to actual stars in the image. This collapsible section defines the method the script uses for finding the position of the stars in the image.

Extract stars from the catalog

The position of the stars is calculated by projecting the catalog coordinates to image coordinates using the referentiation stored in the image.

This option is only valid when the referentiation is very good. However, if the referentiation is good enough, it allows to predict the position in the image of stars with very low SNR.

Extract stars from each image

The stars are extracted from each image searching for the best position using the catalog coordinates as a starting point.

The stars are searched applying DynamicPSF directly to each image. This is the best method when the image has good SNR.

Extract stars from reference image

The stars are not searched directly in each image but in a reference image. You have to select an image from the list that covers the same area as the images to be processed. After finding the exact position of the stars in the reference image, these positions are translated to pixel coordinates in the target images.

This option is currently considered as experimental. The idea behind this capability is that if the reference image is the result of the integration of many frames, the SNR of the faintest stars should be much better. Therefore, DynamicPSF should be able to get more precise positions for the fainter stars.

2.3 Star Flux

The parameters of this section configure how the star flux is calculated.

Filter

The filter used in the image can be defined by selecting it from a list, by writing its name in the Filter field or by choosing the FITS keyword that stores it. The name of the filter is not used anywhere in the calculation and it is used only when writing the results.

Aperture shape

The aperture used for calculating the flux can be a square or a circle centered on the star position. For each star the script calculates the raw flux adding the value (in electrons) of each pixel inside the aperture. The pixels only partially inside the aperture are weighted proportionally to the area inside it.

Figure 1

Aperture size

The script can calculate the flux for a range of aperture sizes spaced evenly. The field Minimum aperture defines the minimum aperture size in pixels. Aperture steps defines the number of different sizes to use. Aperture step size defines the separation between the steps.

For square apertures, the size is the length in pixels of the sides of the square. For circular apertures, the size is the diameter in pixels of the circle.

CCD gain

This value is the gain of the camera expressed in electrons/ADU. It is used for converting the values of the pixels to electrons.

If you press the arrow button, the script tries to get the gain value form the EGAIN keyword of the image.

SNR threshold

This parameter is used for flagging the stars which measured SNR is too low. The available flags are defined in the section Image Table.

Saturation threshold

This parameter is used for flagging the stars that have at least one pixel with value greater than the threshold. The threshold is defined as a percent of the maximum value. The available flags are defined in the section Image Table.

2.4 Background

The script needs to calculate the background level at the position of each star. This level is subtracted from the raw flux to get the final flux.

2.4.1 Background aperture

The flux can be calculated using one of two algorithms:

Square ring

The script centers a square ring around each star. This ring's internal and external sizes can be defined. The script uses the pixels of the background model inside the ring for calculating the background level.

Figure 2

Photometric aperture

The script gets the value of the background using the same aperture as used in the flux calculation (see Aperture shape and Aperture size). Since this aperture covers the star, this option needs to use a background model without the stars. It cannot be used when the background is extracted from the Source Image.

2.4.2 Background model

The script can use three different background models:

Source image

When this option is used the value of the background level is calculated directly from the pixels of the source image. The background level is estimated by calculating the sigma-clipped, median value of the pixels inside the background aperture. The values Sigma low and Sigma high configure the rejection of the SigmaClipping.

This option can only be used with the option Square ring.

Multiscale Median Transform

The script generates a background model using MultiscaleMedianTransform (MMT) for removing the smaller scale layers. You can choose the number of images that are removed. If enough layers are removed, the stars disappear from the image. The option Show background model can be useful for deciding the number of layers to remove.

Automatic Background Extraction

The script generates a background model using AutomaticBackgroundExtraction (ABE). This process tries to generate a background model placing samples in the background and then interpolating between them. The option Show background model can be used to validate the background model.

2.5 Output

In the Output tab you can configure several options that determine what kind of values are written in the output files and some debugging options.

Output directory

This field is the path of the directory where the script will write the results. If it is left empty the files will be created in the directory of the first file.

Click in the down arrow to open the directory selection dialog.

2.5.1 Debug Images

The Output tab has several options to debug the process. They are useful for adjusting the parameters of the process. The best way to use them is to activate the debug options and try the process with only one image. When the parameters are set as desired the debug options can be deactivated before processing a large batch of images.

Generate image with detected stars

Select this option to generate an annotated image where the detected stars are drawn. For each star the script draws the shape of the photometric apertures and the background ring (when the option Square ring is selected). This option helps to configure the star extraction process and to adjust the photometric apertures.

The stars have different colors depending on the flags that the process has set on them. The colors have this meaning:

  • Red: The star has the flag MULTIPLE.
  • Yellow: The star has the flags OVERLAPPED or BADPOS.
  • Cyan: The star has the flag LOWSNR.
  • Pink: The star has the flag SATURATED.
  • Green: The star has no flags.

The colors are assigned in this order. i.e. a star with the flags MULTIPLE and SATURATED is drawn red.

The images are shown in new windows or saved in files depending on the value of the option Save debug images.

Show background model

When the option for using the Source image as background model is selected this option generates a synthetic background model. This is generated interpolating with DynamicBackgroundExtraction the measured background values for every star. This option can be very slow if the number of stars is very high.

If the background model is generated with Multiscale Median Transform or Automatic Background Extraction, this option shows the generated model.

It is very important to check the background model before processing a batch of images in order to check that the model is correct.

The images are shown in new windows or saved in files depending on the value of the option Save debug images.

Save debug images

When this option is activated the script saves the debug images (Detected stars and Background model). These images are saved only when their corresponding options are selected.

If this option is not selected the debug images are shown in new windows in the workspace.

If this option is selected the debug images are saved in the output directory. In this last case the script do not show the images in new windows.

2.5.2 Photometry tables

The photometric process reads from the images and catalog and generates itself many different values. The section Photometry tables allows to configure what is written.

Table prefix

Prefix used as the first part of the filename of the generated tables. Its default value is 'Table_'.

Generate a table for each image with its information

This option generates a CSV file for each image with the full information available about it. The files have the same name as the images but with .csv extension. The section Image Table describes the contents of theses files.

Generate flux tables

This option generates tables that summarize the measured fluxes for all the stars in all the images. The script generates a different table for each photometric aperture (see Aperture size). The tables have the name 'PrefixFlux_ApN.csv' where N is the aperture size. The format of the table is described in the section Batch Table.

Generate background table

This option generates a table with the measured background for all the stars in all the images. When the option Photometric window is used and the script uses more than one aperture (see Aperture size), the values written in the table are the backgrounds for the smaller aperture. The table has the name 'PrefixBackground.csv'. The format of the table is described in the section Batch Table.

Generate SNR table

This option generates tables that summarize the measured SNR for all the stars in all the images. The script generates a different table for each photometric aperture (see Aperture size). The tables have the name 'PrefixSNR_ApN.csv' where N is the aperture size. The format of the table is described in the section Batch Table.

Generate flags table

This option generates a table with the flags of all the stars in all the images. The table has the name 'PrefixFlags.csv'. The format of the table is described in the section Batch Table.

Generate error file

When an error occurs in an image, the application does not stop and jumps to the next image. When the script finishes it writes in the console the number of successful images and the number of errors.

If this option is selected, a summary of the errors is written in a file. The name of the file is 'PrefixErrors.csv'.

3 Output tables

[hide]

3.1 Image Table

The photometry script can generate a table for each image with all the information available of it. This table is generated when the user activates the option Generate a table for each image with its information in the Output tab. The information in this table is read from the catalog or the FITS keywords or it is calculated by the script.

Figure 3

The table has a header and, after it, one row for each star. The columns store the following information:

DATE_OBS

Value of the DATE_OBS keyword of the image. The value is stored as a julian date.

NAME

Name of the star as read from the catalog.

FILTER

Name of the filter chosen by the user in the option Filter. It can be obtained from a keyword of the image.

CATRA, CATDEC

Equatorial J2000 coordinates of the star as stored in the catalog. Both components are stored as degrees. Therefore the Right Ascension will be in the range [0,360).

IMGRA, IMGDEC

Equatorial J2000 coordinates of the star as measured in the image. This value is calculated unprojecting the measured pixel coordinates of the star. Both components are stored as degrees. Therefore the Right Ascension will be in the range [0,360).

IMGX, IMGY

Pixel coordinates of the star. This value is the returned by DynamicPSF.

CatalogMagnitude

The name of this column is the name of the filter chosen in the section Maximum magnitude. It contains the catalog value of the magnitude of the star for this filter.

BACKGROUND

Background level used for the star expressed in electrons. The background flux is the product of the background level and the area of the photometric aperture.

BGSTDDEV

This column is the estimation of the noise of the background of the star.

When the background is calculated from the source image this column contains the standard deviation of the result of the Median/SigmaClipping algorithm.

When the background is calculated from a MMT or ABE model, this column contains the noise of the whole image.

BGRJCT

This column contains the fraction of pixels rejected in the noise calculation. The value is in the range [0,1], being 0 no pixels rejected.

PSF_A, PSF_SIGMAX, PSF_SIGMAY, PSF_THETA, PSF_MAD

Values of the PSF fitting for the star as calculated by DynamicPSF.

FLUX

The table has a FLUX column for each aperture size. These columns contain the value of the measured flux in electrons for each star and aperture. The index is the size of the aperture.

SNR

The table has a SNR column for each aperture size. These columns contains the value of the Signal to Noise Ratio (SNR) for each star and aperture. The index is the size of the aperture.

FLAG

The script applies several validations for each star and generates a flag when when one of the validations fail.

The value of the flags of a star is the logical OR of the individual flags. When a star has no flags, the value is 0. The available flags are:

  • MULTIPLE (1): This flag is added to the stars that have another star less than one pixel away.
  • OVERLAPPED (2): This flag is added to the stars that have another star inside the photometric window.
  • BADPOS (4): This flag is used for the stars which predicted position from the catalog is too different to the actual position measured in the image. This usually happens when there is any problem in the star fitting process.
  • LOWSNR (8): This flag is added to the stars with a SNR below the threshold defined in the field SNR threshold.
  • SATURATED (16): This flag is added to the stars with at least one pixel with a value over the staturation threshold as defined in the field Saturation threshold.

3.2 Batch Table

The photometry script can generate tables with the summary of the calculated values of several images. These tables are generated when the user activates the options Generate flux tables, Generate background table, Generate SNR tables and Generate flags table in the Output tab. The script generates an individual table for each selected option (Fluxi, Background, SNRi or Flags).

Figure 4

This table has three sections. The screen capture has these sections highlighted with different colors.

3.2.1 Image section (Light red)

In this section there is a column for each image and rows for several fields:

ImageId

This row stores the name of the image.

DATE_OBS

Value of the DATE_OBS keyword of each image translated to julian date.

FILTER

Name of the filter chosen by the user in the option Filter. It can be obtained from a keyword of the image.

3.2.2 Star section (Light blue)

This section has a row for each star. These columns have the values of several fields common to all the images.

StarId

Name of the star as read from the catalog.

RA, Dec

Equatorial J2000 coordinates of the star as stored in the catalog. Both components are stored as degrees. Therefore the Right Ascension will be in the range [0,360).

Flags

Combination using logical OR of the flags of all the images.

Catalog_filter

Catalog value of the magnitude of the star for the filter chosen by the user for the parameter Maximum magnitude.

MinSNR

Minimum value for the SNR of the star in all the images.

3.2.3 Values section (Yellow)

This section is different depending on the summarized field of the table. It can contain the flux for an aperture, the background level, SNR or flags. Each row contains the value for a star and each column the value for an image.

References

[1] E. W. Greisen, M. R. Calabretta (2002) Representations of World Coordinates in FITS, Astronomy & Astrophysics, 395, 1061-1075

[2] M. R. Calabretta, E. W. Greisen (2002) Representations of Celestial Coordinates in FITS, Astronomy & Astrophysics, 395, 1077-1122

[3] Wikipedia contributors, Photometry, Wikipedia, The Free Encyclopedia