Skip to content

Commit

Permalink
Merge pull request #49 from fact-project/fix_relative_pixel_angle_naming
Browse files Browse the repository at this point in the history
Fix relative pixel angle naming
  • Loading branch information
maxnoe authored May 2, 2017
2 parents dcf1115 + 56b7773 commit 03d07b8
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 27 deletions.
Binary file added docs/figures/pincushin_distortion_slope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 8 additions & 6 deletions fact/instrument/camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd

from .constants import (
FOCAL_LENGTH_MM, DISTORTION_SLOPE,
FOCAL_LENGTH_MM, PINCUSHION_DISTORTION_SLOPE,
PIXEL_SPACING_IN_MM, FOV_PER_PIXEL_DEG
)

Expand Down Expand Up @@ -73,18 +73,20 @@ def get_pixel_dataframe():
pm['x'] = -pm.pos_Y.values * PIXEL_SPACING_IN_MM
pm['y'] = pm.pos_X.values * PIXEL_SPACING_IN_MM

pm['azimuth'] = np.rad2deg(
np.arctan(pm.x / FOCAL_LENGTH_MM) * (1 + DISTORTION_SLOPE)
pm['x_angle'] = np.rad2deg(
np.arctan(pm.x / FOCAL_LENGTH_MM) *
(1 + PINCUSHION_DISTORTION_SLOPE)
)
pm['zenith'] = np.rad2deg(
np.arctan(pm.y / FOCAL_LENGTH_MM) * (1 + DISTORTION_SLOPE)
pm['y_angle'] = np.rad2deg(
np.arctan(pm.y / FOCAL_LENGTH_MM) *
(1 + PINCUSHION_DISTORTION_SLOPE)
)

return pm


FOV_RADIUS = np.hypot(
get_pixel_dataframe().azimuth, get_pixel_dataframe().zenith
get_pixel_dataframe().x_angle, get_pixel_dataframe().y_angle
).max()


Expand Down
51 changes: 30 additions & 21 deletions fact/instrument/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,39 @@
'''
import numpy as np

LATITUDE_DEC_DEG = 28.7616 #: FACT's latitude in decimal degrees
LONGITUDE_DEC_DEG = -17.8911 #: FACT's longitude in decimal degrees
ALTITUDE_ASL_M = 2200 #: FACT's altitude above sea level in meters

position = {
'latitude': {
'dir': 'N',
'deg': 28,
'min': 45,
'sec': 41.9
},
'longitude': {
'dir': 'W',
'deg': 17,
'min': 53,
'sec': 28.0
},
'altitude_above_sea_level': 2200
}
#: The inner diameter of the hexagonal pixels in mm.
#: This is also the grid constant of the hex grid.
PIXEL_SPACING_IN_MM = 9.5
FOCAL_LENGTH_MM = 4889
#:The segmented imaging reflector of FACT is well described using the thin lens
#:equation. However, the most prominent deviation from the thin lens, is the
#:imaging reflectors pincushin distortion. The pincushin distortion projects
#:incomning light further away from the optical axis as it is expected from the
#:thin lens equation. The additional outward pin-cushin distortion gets stronger
#:the further the distance to the optical axis is.
#:
#:``actual_projection_angle = (1 + PINCUSHION_DISTORTION_SLOPE) * thin_lens_prediction_angle``
#:
#:Example:
#:According to the tĥin lens model one expects incoming light of 1.5 deg
#:incident angle relative to the optical axis to be projected in:
#:
#:``tan(1.5deg)*focal_length = 128.02mm``
#:
#:distance to the optical axis on the image sensor screen.
#:But the reflector actually projects this incoming light further to the
#:outside to:
#:
#:``128.02mm * (1 + PINCUSHION_DISTORTION_SLOPE) = 130.67mm``
#:
#:As one can see, the correction is minor. It is only half a pixel at the outer
#:rim of the field of view.
#:
#:.. image:: figures/pincushin_distortion_slope.png
PINCUSHION_DISTORTION_SLOPE = 0.031/1.5
LATITUDE_DEC_DEG = 28.7616 #: FACT's latitude in decimal degrees
LONGITUDE_DEC_DEG = -17.8911 #: FACT's longitude in decimal degrees
ALTITUDE_ASL_M = 2200 #: FACT's altitude above sea level in meters
FOCAL_LENGTH_MM = 4889 #: FACT's reflector focal length in mm.
DISTORTION_SLOPE = 0.031/1.5

#: Field of view of a single pixel in decimal degrees
FOV_PER_PIXEL_DEG = np.rad2deg(2 * np.arctan(0.5 * PIXEL_SPACING_IN_MM / FOCAL_LENGTH_MM))

0 comments on commit 03d07b8

Please sign in to comment.