opihiexarata.photometry.solution module

The general photometric solver.

class opihiexarata.photometry.solution.PhotometricSolution(fits_filename: str, solver_engine: PhotometryEngine, astrometrics: AstrometricSolution, exposure_time: float = None, filter_name: str = None, vehicle_args: dict = {})[source]

Bases: ExarataSolution

The primary class describing an photometric solution, based on an image provided and catalog data provided from the photometric engine.

This class is the middleware class between the engines which solve the photometry, and the rest of the OpihiExarata code.

_original_filename

The original filename where the fits file is stored at, or copied to.

Type:

string

_original_header

The original header of the fits file that was pulled to solve for this astrometric solution.

Type:

Header

_original_data

The original data of the fits file that was pulled to solve for this photometric solution.

Type:

array-like

astrometrics

The astrometric solution that is required for the photometric solution.

Type:

AstrometricSolution

sky_counts

The average sky contribution per pixel.

Type:

float

star_table

A table of stars around the image with their RA, DEC, and filter magnitudes. It is not guaranteed that this star table and the astrometric star table is correlated.

Type:

Table

intersection_star_table

A table of stars with both the astrometric and photometric RA and DEC coordinates found by the astrometric solution and the photometric engine. The filter magnitudes of these stars are also provided. It is guaranteed that the stars within this table are correlated.

Type:

Table

exposure_time

How long, in seconds, the image in question was exposed for.

Type:

float

filter_name

A single character string describing the name of the filter band that this image was taken in. Currently, it assumes the MKO/SDSS visual filters.

Type:

string

aperture_radius

The aperture radius that defines the aperture for aperture photometry, in arcseconds.

Type:

float

available_filters

The list of filter names which the star table currently covers and has data for.

Type:

tuple

zero_point

The zero point of the image.

Type:

float

zero_point_error

The standard deviation of the error point mean as calculated using many stars.

Type:

float

__calculate_intersection_star_table() Table

This function determines the intersection star table.

Basically this function matches the entries in the astrometric star table with the photometric star table. This function accomplishes that by simply associating the closest entires as the same star. The distance function assumes a tangent sky projection.

Parameters:

None

Returns:

intersection_table – The intersection of the astrometric and photometric star tables giving the correlated star entries between them.

Return type:

Table

__calculate_sky_counts_mask() ndarray

Calculate a mask which blocks out all but the sky for sky counts determination.

The method used is to exclude the regions where stars exist (as determined by the star tables) and also the central region of the image (as it is expected that there is a science object there).

Parameters:

None

Returns:

sky_counts_mask – The mask which masks out which is not interesting regarding sky count calculations.

Return type:

float

__calculate_sky_counts_value() float

Calculate the background sky value, in counts, from the image. Obviously needed for photometric calibrations.

The regions outside of the sky mask represent the sky and the sky counts is extracted from that.

Parameters:

None

Returns:

sky_counts – The total number of counts, in DN that, on average, the sky contributes per pixel.

Return type:

float

__init__(fits_filename: str, solver_engine: PhotometryEngine, astrometrics: AstrometricSolution, exposure_time: float = None, filter_name: str = None, vehicle_args: dict = {}) None[source]

Initialization of the photometric solution.

Parameters:
  • fits_filename (string) – The path of the fits file that contains the data for the astrometric solution.

  • solver_engine (PhotometryEngine) – The photometric solver engine class. This is what will act as the “behind the scenes” and solve the field, using this middleware to translate it into something that is easier.

  • astrometrics (AstrometricSolution, default = None) – A precomputed astrometric solution which belongs to this image.

  • exposure_time (float, default = None) – How long, in seconds, the image in question was exposed for. If not provided, calculation of the zero-point is skipped.

  • filter_name (string, default = None) – A single character string describing the name of the filter band that this image was taken in. Currently, it assumes the MKO/SDSS visual filters. If it is None, calculation of the zero-point is skipped.

  • vehicle_args (dictionary) – If the vehicle function for the provided solver engine needs extra parameters not otherwise provided by the standard input, they are given here.

Return type:

None

_calculate_zero_point(exposure_time: float, filter_name: str = None) float[source]

This function calculates the photometric zero-point of the image provided the data in the intersection star table.

This function uses the set exposure time and the intersection star table. The band is also assumed from the initial parameters.

Parameters:
  • exposure_time (float) – How long, in seconds, the image in question was exposed for.

  • filter_name (string, default = None) – A single character string describing the name of the filter band that this image was taken in. Currently, it assumes the MKO/SDSS visual filters. If it is None, then this function does nothing.

Returns:

  • zero_point (float) – The zero point of this image. This is computed as a mean of all of the calculated zero points.

  • zero_point_error (float) – The standard deviation of the zero points calculated.

calculate_star_aperture_magnitude(pixel_x: int, pixel_y: int) tuple[float, float][source]

This function calculates the photometric aperture magnitude of a star (or any PSF-like object) from the zero-point as provided by the photometric solution.

Parameters:
  • pixel_x (int) – The x coordinate of the center pixel of the star/target.

  • pixel_y (int) – The y coordinate of the center pixel of the star/target.

Returns:

  • star_magnitude (float) – The magnitude of the star/PSF as determined by aperture photometry.

  • star_magnitude_error (float) – The error on the magnitude after errors have been propagated.

calculate_star_photon_counts_coordinate(ra: float, dec: float, radius: float) float[source]

Calculate the total number of photometric counts at an RA DEC. The counts are already corrected for the sky counts.

This function does not check if a star is actually there. This function is a wrapper around its pixel version, converting via the WCS solution.

Parameters:
  • ra (float) – The right ascension in degrees.

  • dec (float) – The declination in degrees.

  • radius (float) – The radius of the circular aperture to be considered, in degrees.

Returns:

photon_counts – The sum of the sky corrected counts for the region defined.

Return type:

float

calculate_star_photon_counts_pixel(pixel_x: int, pixel_y: int, radius: float) float[source]

Calculate the total number of photometric counts at a pixel location. The counts are already corrected for the sky counts.

This function does not check if a star is actually there.

Parameters:
  • pixel_x (int) – The x coordinate of the center pixel.

  • pixel_y (int) – The y coordinate of the center pixel.

  • radius (float) – The radius of the circular aperture to be considered in pixel counts. This is in pixel units.

Returns:

photon_counts – The sum of the sky corrected counts for the region defined.

Return type:

float

opihiexarata.photometry.solution._vehicle_panstarrs_mast_web_api(ra: float, dec: float, radius: float) dict[source]

A vehicle function for photometric solutions. Extract photometric data using the PanSTARRS database accessed via the MAST API.

Parameters:
  • ra (float) – The right ascension of the center of the area to extract from, in degrees.

  • dec (float) – The declination of the center of the area to extract from, in degrees.

  • radius (float) – The search radius from the center that defines the search area.

Returns:

photometry_results – The results of the photometry engine.

Return type:

dictionary