Pointing and Science Cameras (ctapointing.camera)

The ctapointing.camera module contains generic descriptions of pointing cameras and science cameras used in the process of calculating pointing corrections. Besides camera properties such as focal length and pixel geometries, the classes provide coordinate transformations from/into the specific camera frames, using the proper telescope pointing.

API

ctapointing.camera Package

class ctapointing.camera.ApogeeAspen8050Camera(**kwargs: Any)

Class that describes a generic Apogee Aspen 8050 CCD camera.

__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.camera.DistortionCorrection(**kwargs: Any)

Base class for implementing distortion corrections.

__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.

classmethod from_config(**kwargs)

Read a DistortionCorrection 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 DistortionCorrection (as in DistortionCorrection.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 DistortionCorrection.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:

DistortionCorrection object

name

distortion correction name

uuid

UUID of Camera

class ctapointing.camera.DistortionCorrectionBrownConrady(**kwargs: Any)
class ctapointing.camera.DistortionCorrectionNull(**kwargs: Any)
class ctapointing.camera.DistortionCorrectionSIP(**kwargs: Any)

Class implementing simple polynomial distortion correction for images

Pixel corrections are implemented according to “The SIP Convention for Representing Distortion in FITS Image Headers”

Currently, a 2nd order polynominal correction is implemented. For the transformation from ideal (intermediate) pixel coordinates to physical pixel coordinates:

\[ \begin{align}\begin{aligned}x_p = A_{10} x^1 y^0 + A_{20} x^2 y^0 + A_{11} x^1 y^1 + A_{02} x^0 y^2\\y_p = B_{10} x^1 y^0 + B_{20} x^2 y^0 + B_{11} x^1 y^1 + B_{02} x^0 y^2\end{aligned}\end{align} \]

For the inverse transformation from physical pixel coordinates to ideal (intermediate) pixel coordinates:

\[ \begin{align}\begin{aligned}x = AP_{10} x_p^1 y_p^0 + AP_{20} x_p^2 y_p^0 + AP_{11} x_p^1 y_p^1 + AP_{02} x_p^0 y_p^2\\y = BP_{10} x_p^1 y_p^0 + BP_{20} x_p^2 y_p^0 + BP_{11} x_p^1 y_p^1 + BP_{02} x_p^0 y_p^2\end{aligned}\end{align} \]
apply_correction(coords)

Apply distortion correction from ideal (intermediate) pixel coordinates (x, y) to physical pixel coordinates (xp, yp).

Parameters:

coords (np.array) – 2D array of ideal pixel positions

Returns:

coords_p – 2D array of physical pixel positions

Return type:

np.array

apply_inverse_correction(coords_p)

Apply distortion correction from physical pixel coordinates (xp, yp) to ideal (intermediate) pixel coordinates (x, y).

Parameters:

coords_p (np.array) – 2D array of physical pixel positions

Returns:

coords – 2D array of ideal pixel positions

Return type:

np.array

class ctapointing.camera.FlashCam(**kwargs: Any)
__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.camera.MAGICCam(**kwargs: Any)

Dummy implementation of a MAGIC camera.

__init__(name='MAGICCam')
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.camera.PointingCamera(**kwargs: Any)

Pointing camera class.

Hosts routines and parameters necessary to project Alt-Az coordinates into the chip plane.

Uses correct tangential projection into the chip plane (i.e. no small-angle approximation). Takes account for the orientation of the telescope (in Alt-Az coordinates), rotation of the camera w.r.t. the horizon, a tilt of the camera’s optical axis w.r.t. the telescope pointing, and possible shifts of the chip centre w.r.t. the optical axis and lens distortions.

The camera coordinate system has its origin exactly at the centre of the chip (for chips with odd number of pixels in the middle of the central pixel, for chips with even number of pixels at the boundary between the two innermost pixels).

Transformation of camera coordinates into chip coordinates follows the FITS/astropy standard, in which integer pixel coordinates are at the centre of a pixel, with pixel index 0 covering the range [-0.5, 0.5], representing physical pixel 1.

x points from bottom to top of the up-right chip, when viewing from the chip into the scene; y points from left to right.

By default, a ctapointing.camera.DistortionCorrectionNull model is loaded as the default for the correction of lens distortions. Any other DistortionCorrection model can be applied by adding it as a sub-component of the camera config in the configuration file.

Parameters:
  • uuid (Unicode) – UUID of the camera

  • name (Unicode) – name of the camera

  • location (astropy.coordinates.EarthLocation) – location of the camera on Earth

  • f_stop (Float) – f_stop of the lens (focal length / aperture diameter)

  • num_pix (List of Int: number of pixels in x and y)

  • pixel_size (AstroQuantity[length]) – size of a pixel edge

  • tilt (AstroQuantity[angle]) – camera tilt w.r.t. telescope orientation (x/y)

  • offset (AstroQuantity[length]) – offset of chip centre w.r.t. telescope orientation (x/y)

  • rotation (AstroQuantity[angle]) – rotation of the camera around optical axis

  • noise_mean (List[float]) – list of mean noise values (one per pixel fraction)

  • noise_rms (List[float]) – list of rms noise values (one per pixel fraction)

  • noise_pixel_fraction (List[Float]) – list of pixel fractions

  • expansion_coefficient (Float) – chip expansion coefficient

  • efficiency (Float) – pixel efficiency

  • manufacturer (Unicode) – camera manufacturer

  • model (Unicode) – camera model

  • serial_number (Unicode) – camera serial number

  • telescope_id (Int) – telescope ID

  • dtype (Enum) – pixel depth (in bits)

  • used_since (AstroTime) – date and time of first operation

  • used_until (AstroTime) – date and time of decommissioning

__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.

property aperture

Aperture of the camera lens.

Returns:

aperture – lens aperture in millimeter-squared

Return type:

astropy.Quantity

bit_depth

pixel depth (bits)

property chip_area

Camera chip area (in physical units).

Returns:

area – chip area

Return type:

astropy.Quantity

property chip_centre

Camera chip centre in physical pixel coordinates.

  • for odd number of pixels, the chip centre is located at the centre of the central pixel, hence the centre corresponds to an integer in physical pixel coordinates

  • for even number of pixels, the chip centre is in between the innermost pixels, hence the centre corresponds to an integer+0.5 in physical pixel coordinates

  • the pixel with index 0 covers the coordinate range [-0.5, 0.5]

Returns:

(centre_x, centre_y) – physical pixel coordinates of chip centre

Return type:

array of floats

property chip_size

Camera chip size (in physical units).

Returns:

(size_x, size_y) – size along x and y axes

Return type:

tuple of astropy.Quantity

clip_to_chip(pix_coords, tolerance=0)

Clip an array of pixel coordinates to those coordinates which are inside the chip boundaries.

Parameters:
  • pix_coords (array) – 2D array of pixel coordinates

  • tolerance (float) – tolerance in units of pixels

Returns:

mask – boolean array of same shape as pix_coords, with positions which are inside the chip boundaries (and within tolerance) set to True (and False otherwise)

Return type:

numpy.array

efficiency

pixel efficiency

expansion_coefficient

chip expansion coefficient

f_stop

f-stop of lens

focal_length

focal length of lens (x/y chip direction)

property fov

Angular field of view.

Returns:

(fov_x, fov_y) – field of view along x and y direction

Return type:

tuple of astropy.Angle

property fov_plane_projected

Field of view, projected onto a tangent plane of the unit sphere.

Returns:

(fov_x, fov_y) – field of view along x and y direction, plane projected

Return type:

tuple of astropy.Angle

classmethod from_config(**kwargs)

Read a camera 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 camera (as in PointingCamera.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:

camera

Return type:

PointingCamera object

location

earth location of camera, either ‘x, y, z’ in geocentriccoordinates or site location string

manufacturer

camera manufacturer

model

camera model

name

camera name

noise_mean

list of mean noise values (one per pixel fraction)

noise_pixel_fraction

list of pixel fractions

noise_rms

list of rms noise values (one per pixel fraction)

num_pix

camera chip number of pixels (x/y chip direction

offset

offset of chip centre w.r.t. telescope orientation (x/y)

property pixel_angle

Angle covered by a pixel edge in units of arcsec

Returns:

angle – angle in arc seconds

Return type:

astropy.Quantity

pixel_size

camera pixel size

property pixel_solid_angle

Returns the solid angle of a pixel in units of arc seconds squared

Returns:

solid_angle – solid angle in arc seconds squared

Return type:

astropy.Quantity

project_from(coords, obstime, telescope_pointing)

Project given SkyCameraFrame coordinates back to AltAz.

Parameters:
  • coords (SkyCoord in SkyCameraFrame) – coordinates on CCD chip in SkyCameraFrame

  • obstime (Astropy.Time) – time of the observation

  • telescope_pointing (SkyCoord) – telescope pointing direction

Returns:

coords_altaz – transformed coordinates in the AltAz system

Return type:

SkyCoord

project_into(coords, telescope_pointing, use_obstime_of_first_coordinate=True)

Project a given array of altaz coordinates into the pointing camera chip. Takes current camera orientation, camera intrinsic parameters and distortions into account.

Parameters:
  • coords (array(astropy.SkyCoord)) – array of sky coordinates in the AltAz system

  • telescope_pointing (astropy.SkyCoord) – telescope pointing position (RADec or AltAz system)

  • use_obstime_of_first_coordinate (bool) – use observation time of the first coordinate if array of SkyCoords is provided. This reduces computation time by a lot, and should be the default for coordinates that are part of the same image.

Returns:

  • coords_proj (SkyCoord) – 2D projections in chip coordinates (in SkyCameraFrame)

  • todo (star projection is wrong when translation t is switched on. This happens because)

  • the altaz position of the (infinitely) distant star is converted to a vector on the

  • unit circle. Should explicitly distinguish between star projection and projection of

  • world objects.

rotation

rotation of camera w.r.t. horizon, in degrees

serial_number

camera serial number

telescope_id

telescope ID

tilt

camera tilt w.r.t. telescope orientation (x/y)

transform_to_camera(coords_pix)

Transform coordinates from the pixel system to the SkyCameraFrame.

Parameters:

coords_pix (2D array of pixel coordinates)

Returns:

cam_coords – coordinates in SkyCameraFrame

Return type:

SkyCoord

transform_to_pixels(coords_cam)

Transform coordinates from the SkyCameraFrame to pixel coordinates.

Parameters:

coords_cam (SkyCoord) – coordinates in the SkyCameraFrame

Returns:

coords_pix – 2D array of pixel coordinates

Return type:

numpy.array

used_since

date of first usage

used_until

date of decommissioning

uuid

UUID of Camera

class ctapointing.camera.SBIG_STC428_Camera(**kwargs: Any)

Class that describes an SBIG STC-428 CMOS camera.

__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.camera.ScienceCamera(**kwargs: Any)

CTA Science camera class.

Stores information about the focal plane of the camera, its distance from the mirror dish, and the position of pointing LEDs. Provides a method to transform sky coordinates into positions on the planar focal plane.

__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.

body_intensity

intensity of camera body (for simulations)

body_vertex_positions_x

x coordinate of vertices defining body outer dimensions (for simulations, in camera frame)

body_vertex_positions_y

y coordinate of vertices defining body outer dimensions (for simulations, in camera fram)

property centre

Return the centre of the camera in the ScienceCameraFrame

focal_length

focal length of mirror dish

classmethod from_config(**kwargs)

Read a camera 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 camera (as in ScienceCamera.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 ScienceCamera.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:

camera

Return type:

ScienceCamera object

led_intensity

LED intensities (for simulations)

property led_positions

Return the camera LED positions in the ScienceCameraFrame

led_positions_x

LED positions (x coordinate) in camera frame

led_positions_y

LED positions (y coordinate) in camera frame

led_radius

radius of the LED pinholes (for simulations)

lid_intensity

intensity of camera lid (for simulations)

lid_radius

radius of circular camera lid

manufacturer

camera manufacturer

mirror_area

effective area of mirror dish

model

camera model

name

camera name

offset

offset of camera centre w.r.t. telescope orientation (x/y)

project_from(coords, obstime, telescope_pointing)

Project given SkyCameraFrame coordinates back to AltAz.

Parameters:
  • coords (SkyCoord in SkyCameraFrame) – coordinates on CCD chip in SkyCameraFrame

  • obstime (Astropy.Time) – time of the observation

  • telescope_pointing (SkyCoord) – telescope pointing direction

Returns:

coords_altaz – transformed coordinates in the AltAz system

Return type:

SkyCoord

project_into(coords, telescope_pointing=None)

Project a given array of altaz coordinates into the science camera frame. Takes current camera orientation and tilts into account.

Parameters:
  • coords (array(astropy.SkyCoord)) – array of sky coordinates in the AltAz system

  • telescope_pointing (astropy.SkyCoord) – telescope pointing position (RADec or AltAz system)

Returns:

  • coords_proj (SkyCoord) – 2D projections in chip coordinates (in ScienceCameraFrame)

  • todo (star projection is wrong when translation t is switched on. This happens because)

  • the altaz position of the (infinitely) distant star is converted to a vector on the

  • unit circle. Should explicitly distinguish between star projection and projection of

  • world objects.

rotation

rotation of camera w.r.t. horizon, in degrees

property sciencecameraframe

Return a ScienceCameraFrame object, initialised from current camera (focal length, rotations, tilts etc.) properties.

Can be used to transform from/to SciemceCameraFrame using up-to-date transformation parameters.

tilt

camera tilt w.r.t. telescope orientation (x/y)

uuid

UUID of Camera

class ctapointing.camera.ZWO_ASI2600_Camera(**kwargs: Any)

Class that describes a ZWO ASI2600-MM CMOS camera.

__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.

ctapointing.camera.plot_camera_frame(camera, coords=None, camera_pointing_altaz=None, marker_size=1, **kwargs)

Plots the chip frame of a PointingCamera object, with useful curves to show altitude/azimuth projections, camera rotation and distortions. Can also be used to display a set of coordinates on the chip.

Parameters:
  • camera (PointingCamera) – PointingCamera object

  • coords (array(SkyCoord)) – coordinates to plot into frame. Coordinates

must be given in the chip coordinate (SkyCameraFrame) system ToDo camera_pointing_altaz must not be none :param array(float) marker_size: individual marker size for each coordinate

further parameters (kwargs): :chip_centre: Plot the chip centre. True by default. :fov_centre: Plot the Fov centre. True by default. :chip_edges: Plot the chip edges. True by default. :alt_proj: Plot altitude lines. False by default. :az_proj: Plot azimuth lines. False by default. :proj_fov: Plot projected FoV circles. False by default. :chip_fov: Plot physical chip FoV circle. False by default.

Returns:

plot handles (fig, ax)

ctapointing.camera.plot_distortion_correction(camera, plot_inverse=False, ax=None)

Plot the distortion correction model stored in the camera object

Functions

plot_camera_frame(camera[, coords, ...])

Plots the chip frame of a PointingCamera object, with useful curves to show altitude/azimuth projections, camera rotation and distortions.

plot_distortion_correction(camera[, ...])

Plot the distortion correction model stored in the camera object

Classes

PointingCamera(**kwargs)

Pointing camera class.

ApogeeAspen8050Camera(**kwargs)

Class that describes a generic Apogee Aspen 8050 CCD camera.

SBIG_STC428_Camera(**kwargs)

Class that describes an SBIG STC-428 CMOS camera.

ZWO_ASI2600_Camera(**kwargs)

Class that describes a ZWO ASI2600-MM CMOS camera.

ScienceCamera(**kwargs)

CTA Science camera class.

FlashCam(**kwargs)

MAGICCam(**kwargs)

Dummy implementation of a MAGIC camera.

DistortionCorrection(**kwargs)

Base class for implementing distortion corrections.

DistortionCorrectionSIP(**kwargs)

Class implementing simple polynomial distortion correction for images

DistortionCorrectionBrownConrady(**kwargs)

DistortionCorrectionNull(**kwargs)

Class Inheritance Diagram

Inheritance diagram of ctapointing.camera.pointingcamera.PointingCamera, ctapointing.camera.pointingcamera.ApogeeAspen8050Camera, ctapointing.camera.pointingcamera.SBIG_STC428_Camera, ctapointing.camera.pointingcamera.ZWO_ASI2600_Camera, ctapointing.camera.sciencecamera.ScienceCamera, ctapointing.camera.sciencecamera.FlashCam, ctapointing.camera.sciencecamera.MAGICCam, ctapointing.camera.distortion.DistortionCorrection, ctapointing.camera.distortion.DistortionCorrectionSIP, ctapointing.camera.distortion.DistortionCorrectionBrownConrady, ctapointing.camera.distortion.DistortionCorrectionNull