From f869d32fab0ab646964d5d18373f682705eccb22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Stcherbinine?= Date: Tue, 10 May 2022 10:04:34 -0700 Subject: [PATCH] deploy v1.0 --- .gitignore | 2 ++ README.md | 18 +++++++++++------- spip/emm_emirs.py | 14 ++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 80ca8b3..52e46dd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ __pycache__/ *.py[cod] *$py.class + +.venv/ diff --git a/README.md b/README.md index 64c1018..83a2dff 100644 --- a/README.md +++ b/README.md @@ -26,16 +26,20 @@ pip3 install . # Package importation import spip import numpy as np + # Genaration of a longitude/latitude grid to project the footprint -lon_array, lat_array = np.arange(0, 360.5, 0.5), np.arange(-90, 90.5, 0.5) +lon_array = np.arange(0, 360.5, 0.5) +lat_array = np.arange(-90, 90.5, 0.5) lon_grid, lat_grid = np.meshgrid(lon_array, lat_array) + # Pixel parameters -lon_px, lat_px = # Longitude/Latitude of the pixel center [deg] -emer = # Emergence angle of the pixel on the surface [deg] -lon_subsc, lat_subsc = # Longitude/Latitude sub-spacecraft [deg] -d_Mars_sc = # Distance surface-spacraft [km] +lon_px, lat_px = 58.2, 79.3 # Longitude/Latitude of the pixel center [deg] +emer = 61.7 # Emergence angle of the pixel on the surface [deg] +lon_subsc, lat_subsc = 28.0, 24.9 # Longitude/Latitude sub-spacecraft [deg] +d_Mars_sc = 27212 # Distance surface-spacraft [km] Rmars = spip.emm_emirs.Rmars # 3390 [km] ifov = spip.emm_emirs.ifov_emirs # 2.7e-3 [rad] + # Generation of the mask map of the pixel footprint #-- EMM/EMIRS spacecraft mask_footprint = spip.emm_emirs.emirs_ifov_px_projection( @@ -52,7 +56,7 @@ mask_footprint = spip.emm_emirs.emirs_ifov_px_projection( ) #-- General case, cirular pixel -a, b, θ = spip.circalar_pixels.params_ellipse_fov( +a, b, θ = spip.circular_pixels.params_ellipse_fov( lon_px, lat_px, emer, @@ -62,7 +66,7 @@ a, b, θ = spip.circalar_pixels.params_ellipse_fov( ifov ) -mask_footprint = spip.circalar_pixels.in_ellipse_spherical( +mask_footprint = spip.circular_pixels.in_ellipse_spherical( lon_grid, lat_grid, Rmars, diff --git a/spip/emm_emirs.py b/spip/emm_emirs.py index 2a5b949..6d3ee22 100644 --- a/spip/emm_emirs.py +++ b/spip/emm_emirs.py @@ -3,7 +3,7 @@ ## emm_emirs.py ## Created by Aurélien STCHERBININE -## Last modified by Aurélien STCHERBININE : 09/05/2022 +## Last modified by Aurélien STCHERBININE : 10/05/2022 ##---------------------------------------------------------------------------------------- """Projection of an EMM/EMIRS pixel fov on Mars. @@ -16,6 +16,8 @@ from copy import deepcopy import os import yaml +# Local +from . import circular_pixels # Name of the current file _py_file = 'emm_emirs.py' @@ -26,15 +28,15 @@ ##----------------------------------------------------------------------------------- ## Load data -with open(os.path.join(data_path, 'instruments.yml') as f_inst: +with open(os.path.join(data_path, 'instruments.yml')) as f_inst: instruments = yaml.safe_load(f_inst) -with open(os.path.join(data_path, 'celestial_objects.yml') as f_obj: +with open(os.path.join(data_path, 'celestial_objects.yml')) as f_obj: objects = yaml.safe_load(f_obj) # EMIRS IFOV [rad] ifov_emirs = u.Quantity(instruments['instruments']['emm-emirs']['ifov']).to('rad').value # Mars radius [km] -Rmars = u.Quantity(instruments['planets']['mars']['radius']).to('km').value +Rmars = u.Quantity(objects['planets']['mars']['radius']).to('km').value ##----------------------------------------------------------------------------------- ## EMIRS pixel footprint projection @@ -73,9 +75,9 @@ def emirs_ifov_px_projection(lon_grid, lat_grid, lon_px, lat_px, emer, lon_subsc | 0 -> Outside """ # Compute footprint ellipse parameters - a, b, θ = params_ellipse_fov(lon_px, lat_px, emer, lon_subsc, lat_subsc, d_Mars_sc, ifov) + a, b, θ = circular_pixels.params_ellipse_fov(lon_px, lat_px, emer, lon_subsc, lat_subsc, d_Mars_sc, ifov) # Search for grid pixels within the EMIRS footprint - mask_ellipse = in_ellipse_spherical(lon_grid, lat_grid, Rmars, a, b, lon_px, lat_px, θ) + mask_ellipse = circular_pixels.in_ellipse_spherical(lon_grid, lat_grid, Rmars, a, b, lon_px, lat_px, θ) mask_ellipse2 = deepcopy(mask_ellipse) * 1. # bool to float # Output return mask_ellipse2