# $Header: https://svn.mpia.de/gulli/TwiceAsNice/branch/unstable/ln/lics/src/tom/guider/LN_Angles.py 15038 2018-01-23 22:57:12Z mathar $
#
# LN ANGLES - Gathers standard constants and transformations in one place.
#
# You can use these routines by using an absolute address input in python:
#
# import imp
# LNA = imp.load_source('LN_Angles','/Users/herbst/Dropbox/LINC-NIRVANA/Python/LN_Angles.py')
#
#
# The COORDINATE TRANSFORMATIONS are:
#
# CalcAllSky - Calculate all transformations based on input sky vector
#
# CalcAllSlit - Calculates all transformations post-slit coordinates based on ElAz
#
# Sky2SLit - Transforms from Sky to Slit coordinates and vice versa
# Slit2Sky
#
# Slit2Input - Transforms from Slit to Input coordinates and vice versa
# Input2Slit
#
# Input2PCam - Transforms from Input to PCam coordinates and vice versa
# PCam2Input
#
#
# GENERAL UTILITIES
#
# PSsep2ElAz - Returns the Elevation - Azimuth offsets for supplied Slit angle PS and sep
#
# Polar2XY - Returns the XY location of the supplied PA and sep
#
# XY2Polar - Returns the position angle (Cartesian) and separation for dx,dy
#
# * NOTE: Not all of these are currently implemented (28.2.17) !
#
################################################################################
################################################################################
#
# LN ANGLES - Gathers standard constants and transformations in one place.
#
# You can use these routines by using an absolute address input in python:
#
# import imp
# LNA = imp.load_source('LN_Angles','/Users/herbst/Dropbox/LINC-NIRVANA/Python/LN_Angles.py')
#
#
# The COORDINATE TRANSFORMATIONS are:
#
# CalcAllSky - Calculate all transformations based on input sky vector
#
# CalcAllSlit - Calculates all transformations post-slit coordinates based on ElAz
#
# Sky2SLit - Transforms from Sky to Slit coordinates and vice versa
# Slit2Sky
#
# Slit2Input - Transforms from Slit to Input coordinates and vice versa
# Input2Slit
#
# Input2PCam - Transforms from Input to PCam coordinates and vice versa
# PCam2Input
#
#
# Input2GWST* - Transforms Input to GWS coordinates and vice versa
# GWS2Input
#
# Input2HWS* - Transforms Input to HWS coordinates and vice versa
# HWS2Input
#
# Input2SC* - Transforms Input to Science Channel coordinates and vice versa
# SC2Input
#
# GENERAL UTILITIES
#
# PSsep2ElAz - Returns the Elevation - Azimuth offsets for supplied Slit angle PS and sep
#
# Polar2XY - Returns the XY location of the supplied PA and sep
#
# XY2Polar - Returns the position angle (Cartesian) and separation for dx,dy
#
# * NOTE: Not all of these are currently implemented (28.2.17) !
#
################################################################################
def LN_Angles.CalcAllSky |
( |
|
P, |
|
|
|
sep, |
|
|
|
par, |
|
|
|
km |
|
) |
| |
This routine calculates from Sky coordinates forward by calling
the utility routines below.
Input:
P - Position Angle on sky (East of North in degrees)
sep - Separation in arcsec
par - Parallactic angle
km - K-mirror angles numpy [SX,DX]
Output:
PS,sep - Slit angle PS and separation in arcsec
IA,sMM - Input Angle and separation mm [SX,DX]
PCA,sPC - PCam Angle and separation pixels [SX,DX]
pcX,pcY - PCam pixel wrt center
def LN_Angles.CalcAllSlit |
( |
|
PS, |
|
|
|
sep, |
|
|
|
km |
|
) |
| |
This routine calculates from horizontal/slit coordinates forward, calling a subset
of the routines below
Input:
PS - Slit angle CCW from Up in degrees
sep - Separation in arcsec
km - K-mirror angles numpy [SX,DX]
Output:
IA,sMM - Input Angle and separation mm [SX,DX]
PCA,sPC - PCam Angle and separation pixels [SX,DX]
pcX,pcY - PCam pixel wrt center
A glance will tell you that this is very similar to CalAllSky
This routine calculates from Slit coordinates forward, calling a subset
of the routines below
Input:
PS - Slit angle CCW from Up in degrees
sep - Separation in arcsec
km - K-mirror angles numpy [SX,DX]
Output:
IA,sMM - Input Angle and separation mm [SX,DX]
PCA,sPC - PCam Angle and separation pixels [SX,DX]
pcX,pcY - PCam pixel wrt center
A glance will tell you that this is very similar to CalAllSky
def LN_Angles.Input2PCam |
( |
|
IA, |
|
|
|
sMM, |
|
|
|
km |
|
) |
| |
Returns the Patrol Camera Angle (PCA) and separation (pixels) for the
supplied Input Angles IA and separation in mm sMM.
Due to peculiarities in assembly, the transformation is different for SX and DX.
Inputs: IA - 2-element numpy array of Input Angles [SX,DX]
sMM - Separation in mm numpy [SX,DX]
km - Current K-Mirror angles numpy [SX,DX]
Outputs: PCA - 2-element numpy array of Patrol Camera Angles [SX,DX]
sPC - Separation in pixels numpy [SX,DX]
pcX,pcY - Actual pixel location, assuming vector from center
NOT YET IMPLEMENTED !!
def LN_Angles.Input2Slit |
( |
|
IA, |
|
|
|
sMM |
|
) |
| |
Returns the slit position angle (PS) and separation (sep in arcsec) for
the supplied Input coordinate vector IA,sMM. Due to the geometry of the
LBT, the transformation is different for SX and DX.
Note also that, unlike Slit2Input (the forward transformation), there are
two sets of PS and sep returned! The calling routine must keep track!
Inputs: IA - 2-element numpy array of Input Angles [SX,DX]
sMM - 2-element numpy array of separation in mm [SX,DX]
Outputs: PSa - 2-element numpy array of Position angle in slit CCW from zenith direction
sepa - 2-element numpy array of Separation in arcsec
def LN_Angles.PCam2Input |
( |
|
PCA, |
|
|
|
sPC, |
|
|
|
km |
|
) |
| |
Returns the Input Angle (IA) and separation (mm) for the
supplied Patrol Camera Angles PCA and separation in pixels sPC.
Due to peculiarities in assembly, the transformation is different for SX and DX.
Inputs: PCA - 2-element numpy array of Patrol Camera Angles [SX,DX]
sPC - 2-element numpy array of Separation in pixels numpy [SX,DX]
km - 2-element numpy array of Current K-Mirror angles numpy [SX,DX]
Outputs: IA - 2-element numpy array of Input Angles [SX,DX]
sMM - 2-element numpy array of Separation in mm numpy [SX,DX]
The pcX,pcY stuff is not used and NOT YET IMPLEMENTED !!
def LN_Angles.PSsep2ElAz |
( |
|
PS, |
|
|
|
sep |
|
) |
| |
Returns the Elevation and Azimuth offsets in arcsec corresponding to the
supplied Slit coordinate position angle (PS degrees) and separation (sep arcsec)
Note that the azimuth offset is computed with the same linear scale as
the elevation offset; so actually the second coordinate is delta(Az)*cos(el)!
Note that this is not a normal polar to Cartesian conversion, since Slit
coordinate angles are measured CCW from "up", not the +X axis!
Inputs: PS - Slit coordinates position angle (degrees CCW from up)
sep - Separation (arcsec)
Returns: dEl,dAz - Offset converted to Elevation and Azimuth arcsec
Returns the Elevation and Azimuth offsets in arcsec corresponding to the
supplied Slit coordinate position angle (PS degrees) and separation (sep arcsec)
Note that this is not a normal polar to Cartesian conversion, since Slit
coordinate angles are measured CCW from "up", not the +X axis!
Inputs: PS - Slit coordinates position angle (degrees CCW from up)
sep - Separation (arcsec)
Returns: dEl,dAz - Offset converted to Elevation and Azimuth arcsec