sorcha.modules.PPFootprintFilter

Attributes

deg2rad

sin

cos

logger

Classes

Detector

Detector class

Footprint

Camera footprint class

Functions

distToSegment(points, x0, y0, x1, y1)

Compute the distance from each point to the line segment defined by

radec_to_tangent_plane(ra, dec, field_ra, field_dec)

Converts ra and dec to xy on the plane tangent to image center, in the 2-d coordinate system where y is aligned with the meridian.

radec_to_focal_plane(ra, dec, field_ra, field_dec, ...)

Convert ra, dec to points on focal plane, x pointing to celestial north

Module Contents

deg2rad[source]
sin[source]
cos[source]
logger[source]
distToSegment(points, x0, y0, x1, y1)[source]

Compute the distance from each point to the line segment defined by the points (x0, y0) and (x1, y1). Returns the distance in the same units as the points are specified in (radians, degrees, etc.). Uses planar geometry for the calculations (assuming small angular distances).

Parameters:
  • points (array) -- Array of shape (2, n) describing the corners of the sensor.

  • x0 (float) -- The x coordinate of the first end of the segment.

  • y0 (float) -- The y coordinate of the first end of the segment.

  • x1 (float) -- The x coordinate of the second end of the segment.

  • y1 (float) -- The y coordinate of the second end of the segment.

Returns:

dist -- Array of length n storing the distances.

Return type:

array

radec_to_tangent_plane(ra, dec, field_ra, field_dec)[source]

Converts ra and dec to xy on the plane tangent to image center, in the 2-d coordinate system where y is aligned with the meridian.

Parameters:
  • ra (float/array of floats) -- observation Right Ascension, radians.

  • dec (float/array of floats) -- observation Declination, radians.

  • field_ra (float/array of floats) -- field pointing Right Ascension, radians.

  • field_dec (float/array of floats) -- field pointing Declination, radians.

Returns:

x, y -- Coordinates on the focal plane, radians projected to the plane tangent to the unit sphere.

Return type:

float/array of floats

radec_to_focal_plane(ra, dec, field_ra, field_dec, field_rot)[source]

Convert ra, dec to points on focal plane, x pointing to celestial north

Parameters:
  • ra (float/array of floats) -- observation Right Ascension, radians.

  • dec (float/array of floats) -- observation Declination, radians.

  • field_ra (float/array of floats) -- field pointing Right Ascension, radians.

  • field_dec (float/array of floats) -- field pointing Declination, radians.

  • field_roat (float/array of floats) -- field rotation angle, radians

Returns:

x, y -- Coordinates on the focal plane, radians on the detector focal plane

Return type:

float/array of floats

class Detector(points, ID=0, units='radians')[source]

Detector class

ID = 0[source]
ra[source]
dec[source]
units = 'radians'[source]
x[source]
y[source]
centerx[source]
centery[source]
ison(point, ε=10.0**-11, edge_thresh=None, plot=False)[source]

Determines whether a point (or array of points) falls on the detector.

Parameters:
  • point (array) -- Array of shape (2, n) for n points.

  • ϵ (float, default: 10.0 ** (-11)) -- Threshold for whether point is on detector.

  • edge_thresh (float, default=None) -- The focal plane distance (in arcseconds) from the detector's edge for a point to be counted. Removes points that are too close to the edge for source detection.

  • plot (Boolean, default=False) -- Flag for whether to plot the detector and the point.

Returns:

selectedidx -- Indices of points in point array that fall on the sensor.

Return type:

array

trueArea()[source]

Returns the area of the detector. Uses the same method as segmentedArea, but the test point is the mean of the corner coordinates. Will probably fail if the sensor is not convex.

Parameters:

None.

Returns:

area -- The area of the detector.

Return type:

float

segmentedArea(point)[source]

Returns the area of the detector by calculating the area of each triangle segment defined by each pair of adjacent corners and a point inside the sensor. Fails if the point is not inside the sensor or if the sensor is not convex.

Parameters:

point (array) -- Array of shape (2, n) for n points.

Returns:

area -- The area of the detector.

Return type:

float

sortCorners()[source]

Sorts the corners to be counterclockwise by angle from center of the detector. Modifies self.

Parameters:

None.

Return type:

None.

rotateDetector(theta)[source]

Rotates a sensor around the origin of the coordinate system its corner locations are provided in.

Parameters:

theta (float) -- Angle to rotate by, in radians.

Returns:

Detector -- New Detector instance.

Return type:

Detector

rad2deg()[source]

Converts corners from radians to degrees.

Parameters:

None.

Return type:

None.

deg2rad()[source]

Converts corners from degrees to radians.

Parameters:

None.

Return type:

None.

plot(theta=0.0, color='gray', units='rad', annotate=False)[source]

Plots the footprint for an individual sensor. Currently not on the focal plane, just the sky coordinates. Relatively minor difference (width of footprint for LSST is <2.1 degrees), so should be fine for internal demonstration purposes, but not for confirming algorithms or for offical plots.

Parameters:
  • theta (float, optional) -- Aangle to rotate footprint by, radians or degrees. Default =0.0

  • color (string, optional) -- Line color. Default = "gray"

  • units (string, optional) -- Units. Units is provided in ("deg" or "rad"). Default = 'rad'.

  • annotate (Boolean) -- Flag whether to annotate each sensor with its index in self.detectors. Default = False

Return type:

None.

class Footprint(path=None, surveyname='rubin_sim', detectorName='detector')[source]

Camera footprint class

detectors[source]
N[source]
plot(theta=0.0, color='gray', units='rad', annotate=False)[source]

Plots the footprint. Currently not on the focal plane, just the sky coordinates. Relatively minor difference (width of footprint for LSST is <2.1 degrees), so should be fine for internal demonstration purposes, but not for confirming algorithms or for offical plots.

Parameters:
  • theta (float, default=0.0) -- Angle to rotate footprint by, radians or degrees.

  • color (string, default="gray") -- Line color.

  • units (string, default="rad") -- Units theta is provided in ("deg" or "rad").

  • annotate (boolean, default=False) -- Whether to annotate each sensor with its index in self.detectors.

Return type:

None.

applyFootprint(field_df, ra_name='RA_deg', dec_name='Dec_deg', field_name='FieldID', ra_name_field='fieldRA_deg', dec_name_field='fieldDec_deg', rot_name_field='fieldRotSkyPos_deg', edge_thresh=None)[source]

Determine whether detections fall on the sensors defined by the footprint. Also returns the an ID for the sensor a detection is made on.

Parameters:
  • field_df (Pandas dataframe) -- Dataframe containing detection information with pointings.

  • ra_name (string, default = "RA_deg") --

    "field_df" dataframe's column name for object's RA

    for the given observation. [units: degrees]

  • dec_name (string, optional, default = "Dec_deg") --

    "field_df" dataframe's column name for object's declination

    for the given observation. [units: dgrees]

  • ra_name_field (string, default = "fieldRA_deg") --

    "field_df" dataframe's column name for the observation field's RA

    [units: degrees]

  • dec_name_field (string, default = "fieldDec_deg") -- "field_df" dataframe's column name for the observation field's declination [Units: degrees]

  • rot_name_field (string, default = "fieldRotSkyPos_deg") -- "field_df" dataframe's column name for the observation field's rotation angle Default = "fieldRotSkyPos_deg" [Units: degrees]

  • edge_thresh (float, default=None) -- An angular threshold in arcseconds for dropping pixels too close to the edge.

Returns:

  • detected (array) -- Indices of rows in field_df which fall on the sensor(s).

  • detectorID (array) -- Index corresponding to a detector in self.detectors for each entry in detected.