Image solving and fitting (ctapointing.imagesolver)

The ctapointing.imagesolver module contains the following core classes:

  • SpotExtractor: set of classes to extract spots from a ctapointing.Exposure objects, such as stars and science camera LEDs.

  • ImageSolver: provides functionality to register a set of extracted spots with a star catalog, i.e. functionality to identify which spot in an image belongs to which catalog star.

  • SkyFitter: class that fits the coordinate transformation between the ICRS positions of catalog stars and their respective spots in an image, providing precise information about e.g. the pointing of the centre of the camera chip and its rotation w.r.t. the horizon.

  • LEDFitter: class to determine the coordinate transformation between the LED positions on the front of the science camera and their positions in the pointing camera image. Provides information about e.g. the focal length of the telescope, and the position/rotation of the science camera w.r.t. the pointing camera.

  • ImageSolution: class that stores the information about the solved and fitted image, in particular parameters that fix the above mentioned coordinate transformations.

API

ctapointing.imagesolver Package

class ctapointing.imagesolver.ImageMask(inverted=True)

Class that stores an image mask.

__init__(inverted=True)
dilate(dilation_radius: int) array

Dilate the mask using a (num_pixels x num_pixels) quadratic kernel.

Parameters:

dilation_radius (float) – dilation radius

Returns:

image_dilated – dilated image

Return type:

np.array or None

erode(erosion_radius: int) array

Return erosion of mask using a (num_pix x num_pix) quadratic kernel.

Parameters:

erosion_radius (float) – erosion radius

Returns:

image_eroded – erosion of mask image

Return type:

np.array or None

estimate_masked_area()

Estimate the area masked by the mask, relative to the FoV of the image.

classmethod from_name(filename: str, inverted=True, **kwargs)

Read a ImageMask config from either file or database.

Parameters:
  • filename (str) – filename of the mask fits file

  • kwargs (arguments forwarded to ImageMask.read_mask_from_fits())

Returns:

mask

Return type:

ImageMask object

read_mask_from_fits(input_url: str, **kwargs) None

Read image mask from FITS file. By default, the mask is flipped on the vertical axis, since this is the standard for the real images.

Parameters:
  • input_url (str or Path) – path to the FITS file

  • swap_y (bool) – flag to mirror mask along y-axis (default True)

class ctapointing.imagesolver.ImageSolution(prefix=None, **fields)

Container for storing image solutions.

uuid

UUID

Type:

Field(default=None, type=str)

telescope_pointing_ra

right ascension coordinate of telescope pointing

Type:

Field(default=nan deg, unit=deg)

telescope_pointing_dec

declination coordinate of telescope pointing

Type:

Field(default=nan deg, unit=deg)

telescope_pointing_alt

altitude coordinate of telescope pointing

Type:

Field(default=nan deg, unit=deg)

telescope_pointing_az

right ascension coordinate of telescope pointing

Type:

Field(default=nan deg, unit=deg)

nominal_telescope_pointing_ra

right ascension of nominal telescope pointing

Type:

Field(default=nan deg, unit=deg)

nominal_telescope_pointing_dec

declination of nominal telescope pointing

Type:

Field(default=nan deg, unit=deg)

mean_exposure_time

mean time of exposure (UTC)

Type:

Field(default=None, type=Time)

exposure_duration

exposure duration

Type:

Field(default=nan s, unit=s)

camera_focal_length

pointing camera focal length

Type:

Field(default=nan m, unit=m)

camera_rotation

pointing camera rotation

Type:

Field(default=nan deg, unit=deg)

camera_tilt_x

pointing camera tilt in x

Type:

Field(default=nan deg, unit=deg)

camera_tilt_y

pointing camera tilt in y

Type:

Field(default=nan deg, unit=deg)

camera_offset_x

pointing camera offset in x

Type:

Field(default=nan m, unit=m)

camera_offset_y

pointing camera offset in y

Type:

Field(default=nan m, unit=m)

camera_chip_temperature

pointing camera chip temperature

Type:

Field(default=nan K, unit=K)

camera_temperature

pointing camera housing temperature

Type:

Field(default=nan K, unit=K)

camera_humidity

pointing camera housing relative humidity

Type:

Field(default=-1.0, type=float)

camera_cooling_power

pointing camera relative chip cooling power

Type:

Field(default=-1.0, type=float)

num_quad_matches

number of quad matches

Type:

Field(default=-1, type=int)

num_quad_matches_selected

number of selected quad matches

Type:

Field(default=-1, type=int)

num_iterations_skyfit

number of iterations for sky fit

Type:

Field(default=-1, type=int)

num_outliers_skyfit

number of outliers for sky fit

Type:

Field(default=-1, type=int)

num_fitted_stars_skyfit

number of fitted stars in sky fit

Type:

Field(default=-1, type=int)

residual_mean_x

mean residual in x of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

residual_mean_y

mean residual in y of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

residual_rms_x

rms residual in x of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

residual_rms_y

rms residual in y of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

residual_r68

68% containment of residuals of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

residual_r95

95% containment of residuals of sky fit

Type:

Field(default=nan arcsec, unit=arcsec)

stars_fit_converged

True if fit converged

Type:

Field(default=False, type=bool)

stars_fit_quality

fit function at minimum

Type:

Field(default=-1.0, type=float)

stars_fitted_ra

RA position of fitted stars

Type:

Field(default=None, unit=deg, dtype=float64, ndim=1)

stars_fitted_dec

Dec position of fitted stars

Type:

Field(default=None, unit=deg, dtype=float64, ndim=1)

stars_fitted_x

x position of fitted stars

Type:

Field(default=None, dtype=float64, ndim=1)

stars_fitted_y

y position of fitted stars

Type:

Field(default=None, dtype=float64, ndim=1)

stars_fitted_mag

magnitude of fitted stars

Type:

Field(default=None, dtype=float64, ndim=1)

star_spots_fitted_ra

RA position of fitted spots

Type:

Field(default=None, unit=deg, dtype=float64, ndim=1)

star_spots_fitted_dec

Dec position of fitted spots

Type:

Field(default=None, unit=deg, dtype=float64, ndim=1)

star_spots_fitted_x

x position of fitted star spots

Type:

Field(default=None, dtype=float64, ndim=1)

star_spots_fitted_y

y position of fitted star spots

Type:

Field(default=None, dtype=float64, ndim=1)

star_spots_fitted_flux

intensity of fitted star spots

Type:

Field(default=None, dtype=float64, ndim=1)

mean_background

mean background in image

Type:

Field(default=None, type=float)

science_camera_focal_length

science camera focal length

Type:

Field(default=nan m, unit=m)

science_camera_rotation

science camera rotation

Type:

Field(default=nan deg, unit=deg)

science_camera_tilt_x

science camera tilt in x

Type:

Field(default=nan deg, unit=deg)

science_camera_tilt_y

science camera tilt in y

Type:

Field(default=nan deg, unit=deg)

science_camera_offset_x

science camera offset in x

Type:

Field(default=nan m, unit=m)

science_camera_offset_y

science camera offset in y

Type:

Field(default=nan m, unit=m)

science_camera_centre_x

x position of science camera centre

Type:

Field(default=None, type=float)

science_camera_centre_y

y position of science camera centre

Type:

Field(default=None, type=float)

leds_fitted_x

x position of fitted LEDs

Type:

Field(default=None, dtype=float64, ndim=1)

leds_fitted_y

y position of fitted LEDs

Type:

Field(default=None, dtype=float64, ndim=1)

led_spots_fitted_x

x position of fitted LED spots

Type:

Field(default=None, dtype=float64, ndim=1)

led_spots_fitted_y

y position of fitted LED spots

Type:

Field(default=None, dtype=float64, ndim=1)

led_fit_quality

LED fit function at minimum

Type:

Field(default=-1.0, type=float)

lid_spots_x

x position of lid spots

Type:

Field(default=None, dtype=float64, ndim=1)

lid_spots_y

y position of lid spots

Type:

Field(default=None, dtype=float64, ndim=1)

registration_time

registration time

Type:

Field(default=None, unit=s)

matching_time

matching time

Type:

Field(default=None, unit=s)

fitting_time

fitting time

Type:

Field(default=None, unit=s)

spotlist_uuid

SpotList UUID

Type:

Field(default=None, type=str)

image_uuid

image UUID

Type:

Field(default=None, type=str)

when_solved

time of solving

Type:

Field(default=None, type=str)

meta

dict of attached metadata

Type:

dict

prefix

Prefix attached to column names when saved to a table or file

Type:

str

__init__(prefix=None, **fields)
classmethod from_name(name, **kwargs)

Load ImageSolution from HDF5 file or database. See ctapointing.io.from_name() for details.

class ctapointing.imagesolver.ImageSolver(**kwargs: Any)

ImageSolver class.

Hosts algorithms to solve a given image, i.e. determine the position of each individual pixel in sky (RADec) coordinates. Needs a reasonably well-known pointing position for the image. On the basis of this pointing, catalog stars are selected and matched with image spots using quad matching. The matching algorithm of the astroalign package is used.

classmethod from_config(**kwargs)

Read an ImageSolver configuration from either configuration file or database. Either the path of a configuration file (‘input_url’) or a database collection (‘collection’) must be provided.

Parameters:
  • input_url (str or Path) – path of the configuration file.

  • name (str) – name of the ImageSolver (as in ImageSolver.name). When loading the configuration from file, can be set to check that the configuration with the correct name is loaded. When loading from database, is used to identify the correct database record.

  • uuid (str) – UUID of the camera (as in ImageSolver.uuid). When loading the configuration from file, can be set to check that the configuration with the correct UUID is loaded. When loading from database, is used to identify the correct database record.

  • collection (str) – name of the database collection from which configuration is read

  • database (str) – name of the database in which the collection is stored

Returns:

extractor

Return type:

SpotExtractor object

matching_distance

maximum distance for quad matching in L2/L1 L0/L1 plane

matching_radius

distance in pixels within which a star is matched to a spot in the field matching

max_magnitude

maximum magnitude of stars for catalog search

max_num_spots

maximum number of image spots used for matching

max_num_stars

maximum number of stars used for matching

max_pointing_deviation

assumed maximum angular deviation (in degrees) between true and nominalpointing position and/or pointing camera optical axisand true telescope pointing

min_camera_shadow

assumed minimum FoV side length (in degrees) blocked by an(assumed square) science camera in the inner part of the image

min_magnitude

minimum magnitude of stars for catalog search

name

name of ImageSolver

process(spotlist, exposure, estimated_pointing=None, fov_radius=None, image_solution=None)

Solve the image given an exposure object.

Parameters:
  • spotlist (SpotList) – List of pixel coordinates of extracted spots

  • exposure (Exposure) – Exposure object. Should be removed at some point.

  • estimated_pointing (SkyCoord[RADec]) – guess of the optical axis pointing of the telescope. If None, try exposure.nominal_telescope_pointing

  • fov_radius (Angle or None) – radius of the field of view (for star matching) If set to None, estimated FoV from camera parameters

  • image_solution (ctapointing.imagesolver.ImageSolution) – object that is to be updated by the results of the image solving process. If None, new ImageSolution object is created and returned by this method.

Return type:

Tuple of Registration object and best-match Quad object

scale_tolerance

allowed deviation in true vs. nominal focal length of camera

uuid

UUID of ImageSolver

class ctapointing.imagesolver.LEDFitter(**kwargs: Any)

LED fitting class.

TODO: If we can really base this on a cicle fit, consider using the method proposed in https://link.springer.com/content/pdf/10.1007/s10851-010-0249-8.pdf

static circlefit(spotlist)

Fit a circle to all coordinates of the spotlist.

static construct_leds_on_circle(radius, position_angles, centre=None)

Construct LED position coordinates in the CTA CameraFrame (i.e. x points down, y points left when viewed from the dish)

radius: circle radius position_angles: list of position angles

returns: array of coordinates

distance_goal

fit distance goal

fixed_parameters

list of parameters fixed during fitting

classmethod from_config(**kwargs)

Read a LEDFitter configuration from either configuration file or database. Either the path of a configuration file (‘input_url’) or a database collection (‘collection’) must be provided.

Parameters:
  • input_url (str or Path) – path of the configuration file.

  • name (str) – name of the LEDExtractor (as in LEDFitter.name). When loading the configuration from file, can be set to check that the configuration with the correct name is loaded. When loading from database, is used to identify the correct database record.

  • uuid (str) – UUID of the camera (as in PointingCamera.uuid). When loading the configuration from file, can be set to check that the configuration with the correct UUID is loaded. When loading from database, is used to identify the correct database record.

  • collection (str) – name of the database collection from which configuration is read

  • database (str) – name of the database in which the collection is stored

Returns:

extractor

Return type:

LEDFitter object or None

matching_distance

maximum distance between spot and predicted LED position (in pixels

name

name of LEDFitter

process(spotlist, exposure, science_camera, image_solution=None)

Fit a list of spots to science camera LEDs to find the transformation between pointing camera pixel coordinates and science camera coordinates.

Parameters:
Returns:

  • solution (ImageSolution) – ImageSolution object containing summary information on the result

  • m (iminuit.minuit) – minuit object for the sky -> pixels fit

  • m_inv (iminuit.minuit) – minuit object for the pixel -> intermediate pixel coordinates fit

uuid

UUID of LEDFitter

class ctapointing.imagesolver.Quad(objects, invariants, status=<Status.DEFAULT: 0>, quad_id=None)

Class representing a triangular quad object of either spot or star coordinates.

__init__(objects, invariants, status=<Status.DEFAULT: 0>, quad_id=None)
property area

Area of the quad, using Heron’s formula, calculated from the SkyCameraFrame coordinates.

class ctapointing.imagesolver.QuadMatch(spot_quad, star_quad, status=<Status.DEFAULT: 0>)

Class for storing a match between a spot quad object and a star quad object.

__init__(spot_quad, star_quad, status=<Status.DEFAULT: 0>)
set_status(status, combine=True)

Sets status flag for the quad match and star and spot quad :param status: the status flag to be set :param combine: if True, add status flag to other existing flags

if False, set this status flag as the only one

similarity_transform()

Perform similarity transform between spot and star quad.

For the similarity transform, scale, rotation and two offsets are fitted between the star quad and the spot quad of each QuadMatch object.

Transformation parameters are stored in the transformation_properties attribute of the QuadMatch object.

The status of the QuadMatch is set to SIMFITTED.

transform_stars(stars=None, transformation_parameters=None)

Transform a set of stars using the transformation properties stored in this QuadMatch. Returns a new list of Star objects with updated SkyCameraFrame coordinates.

class ctapointing.imagesolver.Registration(spot_list, star_list)

Registration class. Used to find matches between spot quads and star quads, using quad similarities.

Implements the following registration algorithms: (1) A search for best-matching quads based on geometric properties of the quads/ (2) A similarity transformation for selected quads that determines the rough

transformation between star and spot coordinates for these quads

  1. A matching algorithm that can match further stars to spots, using the above similarity transform.

Furthermore, methods are implemented to select among chosen quads based on certain quad or transformation properties.

__init__(spot_list, star_list)

Constructor.

Parameters:
  • spot_list – list of Spot objects used in the primary quad matching.

  • star_list – list of Star objects used in the primary quad matching.

static build_quads(object_list, object_status=<Status.USED: 1>, quad_name='')

Build (triangular) quads from each triplet of Star or Spot SkyCameraFrame coordinate pairs. With n objects given, exactly m = (n/3) “n choose 3” independent quads can be constructed. Quad information is composed of L2/L1 (the ratio of the largest and second-to-largest side lengths of the triangle), L1/L0 (the ratio of the second largest and smallest side lengths), as well as L2+L1+L0 (i.e. the circumference of the triangle).

Parameters:
  • object_list – list of Spot or Star objects used to build the quads

  • object_status – status flag that can be used to select a subset of the objects from object_list

  • quad_name – prefix used to name the individual spots

Returns quad_list:

list of all Quad objects built

find_matches(radius=0.1)

Find matches between star Quad objects and Spot Quad objects, based on their geometric invariants.

The algorithm uses nearest neighbour matching in the L2/L1 - L0/L1 plane of the geometric invariants. It uses an efficient kd tree with k=2 for searching through all spot quads and identifying all star quads that match in this plane within a circle of given radius.

Resulting quad matches are stored in the objects QuadMatch list.

Note: If the search plane is densely populated and/or the search radius is large, there may exist more than one star-quad match for any given spot quad. Naturally, for some spot quads, no matching star quad will be found.

Parameters:

radius – search radius for the kd tree search. All matches within this search radius will be returned.

get_quad_matches(status=<Status.DEFAULT: 0>)

Return list of QuadMatch objects, matching status flag.

get_quad_matches_transformed(status=<Status.SELECTED: 4>)

Returns a copy of selected QuadMatch objects, in which all StarQuad coordinates have been transformed to the SkyCameraFrame according to the transformation parameters of the similarity transform carried out for this QuadMatch.

Parameters:

status – status flag for QuadMatch selection: only QuadMatches with this status flag set will be evaluated

Returns:

list (deep copy) of transformed QuadMatch objects

get_quads_spots(status=<Status.DEFAULT: 0>)

Return list of Quad objects constructed from Spots, matching status flag.

get_quads_stars(status=<Status.DEFAULT: 0>)

Return list of Quad objects constructed from Stars, matching status flag.

get_spots(status=<Status.DEFAULT: 0>)

Return list of stored Spot objects, matching status flag.

get_stars(status=<Status.DEFAULT: 0>)

Return list of stored Star objects, matching status flag.

preselect_by_scale(rtol=0.02)

From all primary QuadMatch objects, select those quad matches which match roughly in triangle circumference. This will reduce the number of false-positive quad matches quite a bit.

The selection is motivated by the fact that the focal length of the camera is a usually well-known constant. If chosen appropriately, star quads transformed into the SkyCameraFrame will have roughly the same circumference as spot quads.

Selected QuadMatch objects will obtain the status PRESELECTED.

Parameters:

rtol – maximum accepted relative tolerance between the circumference of star and spot quads used for selection.

select_by_similarity(exp_rotation=(<Quantity 0. deg>, <Quantity 5. deg>), exp_scale=(1.0, 0.1), tolerance=2.0, status=<Status.PRESELECTED: 2>)

Select QuadMatch objects based on their similarity transformation parameters.

(1) Perform a similarity transformation on all matched quad pairs, resulting in a set of four transformation parameters for each match: - rotation of star quad w.r.t. spot quad - scaling of star quad w.r.t. spot quad - offsets (x, y) between star quad and spot quads.

(2) Create a histogram of each parameter. We expect a smooth distribution in the parameter for falsely matched quads, and a narrow peak for those quad matches that are correctly matched.

(3) Find the peak in each of the parameter distributions, and select, based on the peak width and the tolerance argument, all quad matches closely around the peak.

  1. Accept all quad matches which pass selection in all parameters.

Selected QuadMatch objects will be marked with status SELECTED.

Parameters:
  • exp_rotation – tuple of Angle expected relative rotation between fitted star and spot quads and maximum tolerance (usually 0.0 deg, 10.0 deg)

  • exp_scale – tuple of float expected scaling between fitted star and spot quads and maximum tolerance (usually 1.0, 0.1)

  • tolerance – relative tolerance for cut around the peak. Set to None to disable the automatic procedure

and instead use the expected parameter ranges given as arguments

similarity_transform(status=<Status.PRESELECTED: 2>)

Perform similarity transform between quads of stored QuadMatch objects.

For the similarity transform, scale, rotation and two offsets are fitted between the star quad and the spot quad of each QuadMatch object.

Transformation parameters are stored in the transformation_properties attribute of the QuadMatch object.

The status of the QuadMatch is set to SIMFITTED.

Parameters:

status – status flag for QuadMatch selection: only QuadMatches with this status flag set will be evaluated

class ctapointing.imagesolver.SkyFitter(**kwargs: Any)

Sky fitting class

Fits a list of spots to matched stars using the full transformation tree or an astropy WCS transformation

distance_goal

fit distance goal

fit_camera_distortion

fit camera distortion parameters

fixed_parameters

list of parameters fixed during fitting

classmethod from_config(**kwargs)

Read a SkyFitter configuration from either configuration file or database. Either the path of a configuration file (‘input_url’) or a database collection (‘collection’) must be provided.

Parameters:
  • input_url (str or Path) – path of the configuration file.

  • name (str) – name of the SpotExtractor (as in SkyFitter.name). When loading the configuration from file, can be set to check that the configuration with the correct name is loaded. When loading from database, is used to identify the correct database record.

  • uuid (str) – UUID of the camera (as in PointingCamera.uuid). When loading the configuration from file, can be set to check that the configuration with the correct UUID is loaded. When loading from database, is used to identify the correct database record.

  • collection (str) – name of the database collection from which configuration is read

  • database (str) – name of the database in which the collection is stored

Returns:

fitter

Return type:

SkyFitter object or None

max_num_fit_iterations

maximum number of fit iterations

name

name of SkyFitter

process(spot_star_match_list, exposure, estimated_pointing=None, distortion_correction=None, image_solution=None)

Fit a list of spots to pre-matched stars to find the transformation parameters for coordinate transformations from pixel coordinates to sky coordinates.

The fit uses the full (non-idealised) set of coordinate transformations, taking into account refraction effects in the atmosphere and lens distortion.

Parameters:
  • spot_star_match_list (list) – list of StarSpotMatch objects that contain information about the pre-matched spot-star pairs

  • exposure (Exposure) – exposure object, holding information about the actual exposure (camera properties etc.)

  • estimated_pointing (astropy.SkyCoord) – estimated telescope pointing position (in the ICRS frame)

  • image_solution (ctapointing.imagesolver.ImageSolution) – image solution object that is updated with fit results. If None, a new object is created.

Returns:

  • solution (ImageSolution) – ImageSolution object containing summary information on the result

  • m (iminuit.minuit) – minuit object for the sky -> pixels fit

  • m_inv (iminuit.minuit) – minuit object for the pixel -> intermediate pixel coordinates fit

residual_cut

cut value for spot outlier removal

uuid

UUID of SkyFitter

class ctapointing.imagesolver.Spot(c_radec=None, c_skycam=None, c_pix=None, flux=None, mean_background=None, status=<Status.USED: 1>, id=None)

Class for storing spot positions.

__init__(c_radec=None, c_skycam=None, c_pix=None, flux=None, mean_background=None, status=<Status.USED: 1>, id=None)
class ctapointing.imagesolver.SpotExtractorLED(**kwargs: Any)

SpotExtractor for the camera LEDs

__init__(config=None, parent=None, **kwargs)
Parameters:
  • config (traitlets.loader.Config) – Configuration specified by config file or cmdline arguments. Used to set traitlet values.

  • parent (Tool or Component) – If a Component is created by another Component or Tool, you need to pass the creating Component as parent, e.g. parent=self. This makes sure the config is correctly handed down to the child components. Do not pass config in this case.

  • kwargs – Traitlets to be overridden. TraitError is raised if kwargs contains a key that does not correspond to a traitlet.

generate_led_mask(exposure, science_camera, circle_radius=100)

Construct a mask that is suited for extracting the LED positions from an exposure image.

The algorithm calculates, based on the hardware position of the LEDs in the science camera, the expected position of the LED spots in the exposure (taking into account the pointing camera parameters from the exposure object). It then constructs a circular mask around the LED positions.

Parameters:
class ctapointing.imagesolver.SpotExtractorLid(**kwargs: Any)

SpotExtractor for the camera lid

__init__(config=None, parent=None, **kwargs)
Parameters:
  • config (traitlets.loader.Config) – Configuration specified by config file or cmdline arguments. Used to set traitlet values.

  • parent (Tool or Component) – If a Component is created by another Component or Tool, you need to pass the creating Component as parent, e.g. parent=self. This makes sure the config is correctly handed down to the child components. Do not pass config in this case.

  • kwargs – Traitlets to be overridden. TraitError is raised if kwargs contains a key that does not correspond to a traitlet.

generate_lid_mask(exposure, science_camera)

Construct a mask that is suited for extracting the spots on the camera lid.

It creates a circular masked region centred at the position of the science camera in the image, with a radius that corresponds to the physical radius of the lid (as stored in the ctapointing.camera.ScienceCamera class).

Parameters:
science_camera_name

name of science camera

class ctapointing.imagesolver.SpotExtractorSky(**kwargs: Any)

SpotExtractor for sky fields.

__init__(config=None, parent=None, **kwargs)
Parameters:
  • config (traitlets.loader.Config) – Configuration specified by config file or cmdline arguments. Used to set traitlet values.

  • parent (Tool or Component) – If a Component is created by another Component or Tool, you need to pass the creating Component as parent, e.g. parent=self. This makes sure the config is correctly handed down to the child components. Do not pass config in this case.

  • kwargs – Traitlets to be overridden. TraitError is raised if kwargs contains a key that does not correspond to a traitlet.

class ctapointing.imagesolver.SpotList(prefix=None, **fields)

Container for storing spot lists.

uuid

UUID

Type:

Field(default=None, type=str)

spot_type

spot type (0: UNKNOWN, 1: SKY, 2: LED, 3: LID

Type:

Field(default=None, dtype=int64, ndim=1)

coord_x

x coordinate of spot

Type:

Field(default=None, dtype=float64, ndim=1)

coord_y

y coordinate of spot

Type:

Field(default=None, dtype=float64, ndim=1)

var_x

variance of spot profile along x

Type:

Field(default=None, dtype=float64, ndim=1)

var_y

variance of spot profile along y

Type:

Field(default=None, dtype=float64, ndim=1)

cov_xy

covariance of spot profile

Type:

Field(default=None, dtype=float64, ndim=1)

flux

flux of spot

Type:

Field(default=None, dtype=float64, ndim=1)

peak

peak flux of spot

Type:

Field(default=None, dtype=float64, ndim=1)

mean_background

mean background in image

Type:

Field(default=nan, type=float)

rms_background

rms background in image

Type:

Field(default=nan, type=float)

start_time

start time of exposure

Type:

Field(default=None, type=Time)

duration

exposure duration

Type:

Field(default=nan s, unit=s)

moon_position_az

moon position azimuth

Type:

Field(default=nan deg, unit=deg)

moon_position_alt

moon position altitude

Type:

Field(default=nan deg, unit=deg)

moon_phase

moon phase

Type:

Field(default=-1.0, type=float)

sun_position_az

sun position azimuth

Type:

Field(default=nan deg, unit=deg)

sun_position_alt

sun position altitude

Type:

Field(default=nan deg, unit=deg)

chip_temperature

camera chip temperature

Type:

Field(default=nan K, unit=K)

camera_temperature

camera housing temperature

Type:

Field(default=nan K, unit=K)

cooling_power

relative chip cooling power

Type:

Field(default=-1.0, type=float)

camera_humidity

camera housing humidity

Type:

Field(default=-1.0, type=float)

image_uuid

image UUID

Type:

Field(default=None, type=str)

camera_uuid

camera UUID

Type:

Field(default=None, type=str)

extractor_uuid

spot extractor UUID

Type:

Field(default=None, type=str)

detection_threshold

spot detection threshold

Type:

Field(default=nan, type=float)

when_extracted

time of spot extraction

Type:

Field(default=None, type=str)

meta

dict of attached metadata

Type:

dict

prefix

Prefix attached to column names when saved to a table or file

Type:

str

__init__(prefix=None, **fields)
append(spot_list, copy_meta: bool = False)

Append spots of another SpotList object to self. Only spot information is appended, i.e. any metadata, such as start time, is not touched, unless copy_meta is True

Parameters:
  • spot_list (SpotList or None) – Spot list the spots of which should be appended

  • copy_meta (bool) – flag that indicates to copy metadata

property coords_pix

Return the pixel coordinates as an array.

classmethod from_name(name, **kwargs)

Load SpotList from HDF5 file or database. See ctapointing.io.from_name() for details.

select_by_type(spot_type: SpotType)

Return a copy of self, limited to spots of type spot_type

Parameters:

spot_type (SpotType) – spot type

Returns:

spot_list – new SpotList, limited to spots matching the selected spot type

Return type:

SpotList

class ctapointing.imagesolver.SpotType(value)

Spot type class.

class ctapointing.imagesolver.Star(c_radec=None, c_skycam=None, c_pix=None, magnitude=None, status=<Status.USED: 1>, id=None)

Class for storing star positions.

__init__(c_radec=None, c_skycam=None, c_pix=None, magnitude=None, status=<Status.USED: 1>, id=None)
class ctapointing.imagesolver.Status(value)

Status flags used during spot extraction, matching and fitting.

ctapointing.imagesolver.plot_angular_distance_radec(star_spot_match_list, exposure, plot_distance_squared=False)

Plot (angular distance)**2 between matched stars and spots.

ctapointing.imagesolver.plot_image_fit(quad_match, exposure)

Plot the exposure image, with fitted stars overlaid.

ctapointing.imagesolver.plot_quad_parameter_space(registration)

Plot all preselected and selected spot and star quads in (1) the L1/L0 vs L2/L1 parameter space (2) the L1/L0 vs quad circumference space

ctapointing.imagesolver.plot_quad_transformation_parameters(registration)

Plot distribution of similarity transformation parameters for preselected and selected quad matches: (1) rotation and scale factor between the quads (2) corner deviation between spots vs. averaged quad side length (3) corner deviation vs. scale factor

Functions

plot_quads(quads, camera[, ax, label, ...])

plot_quad_parameter_space(registration)

Plot all preselected and selected spot and star quads in (1) the L1/L0 vs L2/L1 parameter space (2) the L1/L0 vs quad circumference space

plot_quad_transformation_parameters(registration)

Plot distribution of similarity transformation parameters for preselected and selected quad matches: (1) rotation and scale factor between the quads (2) corner deviation between spots vs.

plot_angular_distance_radec(...[, ...])

Plot (angular distance)**2 between matched stars and spots.

plot_image_fit(quad_match, exposure)

Plot the exposure image, with fitted stars overlaid.

Classes

SpotExtractorSky(**kwargs)

SpotExtractor for sky fields.

SpotExtractorLED(**kwargs)

SpotExtractor for the camera LEDs

SpotExtractorLid(**kwargs)

SpotExtractor for the camera lid

SpotList([prefix])

Container for storing spot lists.

SpotType(value)

Spot type class.

ImageSolver(**kwargs)

ImageSolver class.

ImageMask([inverted])

Class that stores an image mask.

LEDFitter(**kwargs)

LED fitting class.

SkyFitter(**kwargs)

Sky fitting class

Registration(spot_list, star_list)

Registration class.

Spot([c_radec, c_skycam, c_pix, flux, ...])

Class for storing spot positions.

Star([c_radec, c_skycam, c_pix, magnitude, ...])

Class for storing star positions.

Quad(objects, invariants[, status, quad_id])

Class representing a triangular quad object of either spot or star coordinates.

QuadMatch(spot_quad, star_quad[, status])

Class for storing a match between a spot quad object and a star quad object.

Status(value)

Status flags used during spot extraction, matching and fitting.

ImageSolution([prefix])

Container for storing image solutions.

Class Inheritance Diagram

Inheritance diagram of ctapointing.imagesolver.spotextractor.SpotExtractorSky, ctapointing.imagesolver.spotextractor.SpotExtractorLED, ctapointing.imagesolver.spotextractor.SpotExtractorLid, ctapointing.imagesolver.spotlist.SpotList, ctapointing.imagesolver.spotlist.SpotType, ctapointing.imagesolver.imagesolver.ImageSolver, ctapointing.imagesolver.imagemask.ImageMask, ctapointing.imagesolver.ledfitter.LEDFitter, ctapointing.imagesolver.skyfitter.SkyFitter, ctapointing.imagesolver.registration.Registration, ctapointing.imagesolver.registration.Spot, ctapointing.imagesolver.registration.Star, ctapointing.imagesolver.registration.Quad, ctapointing.imagesolver.registration.QuadMatch, ctapointing.imagesolver.statusbase.Status, ctapointing.imagesolver.imagesolution.ImageSolution