From dbf513059e922e652c6927098eaa38169606450a Mon Sep 17 00:00:00 2001 From: Dominik Neise Date: Wed, 25 Jan 2017 12:11:06 +0100 Subject: [PATCH 1/3] introduce some more numbers needed by `photon_stream` repo --- fact/geometry.py | 18 ++++++++++++++++++ fact/pixels.py | 18 +++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 fact/geometry.py diff --git a/fact/geometry.py b/fact/geometry.py new file mode 100644 index 0000000..1bdcfe5 --- /dev/null +++ b/fact/geometry.py @@ -0,0 +1,18 @@ +import numpy as np + + +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 +} diff --git a/fact/pixels.py b/fact/pixels.py index 33552ab..764bc11 100644 --- a/fact/pixels.py +++ b/fact/pixels.py @@ -23,6 +23,9 @@ ] ) +FOCAL_LENGTH_IN_M = 4.889 +DISTORTION_SLOPE = 0.031/1.5 # only Sebastian can explain this number. +PIXEL_SPACING_IN_M = 0.0095 GEOM_2_SOFTID = { (i, j): soft for i, j, soft in zip( @@ -48,13 +51,22 @@ def get_pixel_dataframe(): bias_patch_sizes = pm.bias_patch_id.value_counts().sort_index() pm['bias_patch_size'] = bias_patch_sizes[pm.bias_patch_id].values + pm['x'] = -pm.pos_Y.values * PIXEL_SPACING_IN_M + pm['y'] = pm.pos_X.values * PIXEL_SPACING_IN_M - pm['x'] = -pm.pos_Y.values*9.5 - pm['y'] = pm.pos_X.values*9.5 + pm['azimuth'] = np.rad2deg( + np.arctan(pm.x / FOCAL_LENGTH_IN_M) * (1 + DISTORTION_SLOPE) + ) + pm['zenith'] = np.rad2deg( + np.arctan(pm.y / FOCAL_LENGTH_IN_M) * (1 + DISTORTION_SLOPE) + ) + return pm +FOV_RADIUS = np.hypot( + get_pixel_dataframe().azimuth, get_pixel_dataframe().zenith +).max() - return pm patch_indices = get_pixel_dataframe()[[ 'trigger_patch_id', From b12073f6a231ffcce75d79d6f9fe7fb0022c40eb Mon Sep 17 00:00:00 2001 From: Dominik Neise Date: Wed, 25 Jan 2017 12:19:55 +0100 Subject: [PATCH 2/3] use units of mm instead of meter, to keep this PR api-non-changing --- fact/pixels.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fact/pixels.py b/fact/pixels.py index 764bc11..5f1ed41 100644 --- a/fact/pixels.py +++ b/fact/pixels.py @@ -23,9 +23,9 @@ ] ) -FOCAL_LENGTH_IN_M = 4.889 +FOCAL_LENGTH_IN_MM = 4889. DISTORTION_SLOPE = 0.031/1.5 # only Sebastian can explain this number. -PIXEL_SPACING_IN_M = 0.0095 +PIXEL_SPACING_IN_MM = 9.5 GEOM_2_SOFTID = { (i, j): soft for i, j, soft in zip( @@ -51,14 +51,14 @@ def get_pixel_dataframe(): bias_patch_sizes = pm.bias_patch_id.value_counts().sort_index() pm['bias_patch_size'] = bias_patch_sizes[pm.bias_patch_id].values - pm['x'] = -pm.pos_Y.values * PIXEL_SPACING_IN_M - pm['y'] = pm.pos_X.values * PIXEL_SPACING_IN_M + 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_IN_M) * (1 + DISTORTION_SLOPE) + np.arctan(pm.x / FOCAL_LENGTH_IN_MM) * (1 + DISTORTION_SLOPE) ) pm['zenith'] = np.rad2deg( - np.arctan(pm.y / FOCAL_LENGTH_IN_M) * (1 + DISTORTION_SLOPE) + np.arctan(pm.y / FOCAL_LENGTH_IN_MM) * (1 + DISTORTION_SLOPE) ) return pm From a17af251e4d43d75513f254c46311246497c39d2 Mon Sep 17 00:00:00 2001 From: Dominik Neise Date: Wed, 25 Jan 2017 12:21:14 +0100 Subject: [PATCH 3/3] bump version. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0317155..5beb20f 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='pyfact', - version='0.8.3', + version='0.8.4', description='A module containing useful methods for working with fact', url='http://github.com/fact-project/pyfact', author='Maximilian Noethe, Dominik Neise',