TwiceAsNice  2019-02-18
Classes | Functions
AG_Utils Namespace Reference

Classes

class  MonThread
 
class  MyMD
 
class  MyQGS
 

Functions

def logTxt (msgT, nLin)
 
def Det2TCS (dX, dY)
 PATROL CAM <==> TCS TRANSFORMATIONS. More...
 
def genPixMap (ary, wid, z1, z2, auto)
 
def getState (lstFile)
 
def saveState (lstFile)
 
def NewStuffStars (catNm)
 
def StuffStars (starFile)
 
def GetSEpos ()
 
def SepPA2Pix (sep, PA)
 
def GetPointing ()
 read the major pointing parameters from the TCS Results are not returned but stored in the AG_Conf properties More...
 
def GetLoopState ()
 read the state of the AO loop This is stored in the AG_Conf properties, not returned More...
 
def GetKmirror ()
 read the current k-mirror angle This is stored in the AG_Conf properties, not returned More...
 
def SetGuideOffset (off1, off2, typ, _max=AG_Conf.maxGuideCorrection)
 
def SetOffset (off1, off2, typ)
 

Function Documentation

◆ Det2TCS()

def AG_Utils.Det2TCS (   dX,
  dY 
)

PATROL CAM <==> TCS TRANSFORMATIONS.

Here is where we gather our knowledge (ignorance?) of the transformation between PCam pixels and the sky. There are two complementary routines:

Det2TCS transforms a vector (i.e. and offset) in PCam to suitable TCS TCS2Det does the opposite

This routine uses the current telescope pointing parameters (stored in AG_Conf.py), such as AG_Conf.RA, AG_Conf.dec, AG_Conf.par, etc.

    This routine determines the Elevation and Azimuth offsets for the
    supplied PCam pixel offsets dx,dy. To do so, it calls the standard
    routines in LN_Angles.py

        Inputs:   dX,dY    - offset in PCam pixels between current and goal

        Outputs:  dEl,dAz  - corresponding offsets in Elevation & Azimuth (arcsec)
        Note that the dAz component is derived on the same plate scale
        as the dEl component, so actually it is the value of dAz*cos(dEl).

    The sense of the offsets is as follows: dx and dy are the current star
    position minus the reference (i.e. guide spot) position. Thus, if dX
    is positive, the star is to the right of where it should be.

    NOTE: This routine returns the El/Az offset corresponding to dX,dY. To
    autoguide, for example, you must supply these same offsets (not the opposite)!

◆ genPixMap()

def AG_Utils.genPixMap (   ary,
  wid,
  z1,
  z2,
  auto 
)
   Generates and returns a PixMap suitable for onscreen display, that is, of size wid
   and scaled from 0-255.

   Parameters:  ary   - numpy array of input data (any size, but must be SQUARE!)
                wid   - width of PixMap to return
                z1,z2 - grayscale cuts (dummy parameters if autoscale=True)
                auto  - whether to autoscale

   Returns:     pMp   - pixmap suitable for onscreen display
                z1,z2 - grayscale cuts (changes if auto=True)
                ok    - flag indicating success

◆ GetKmirror()

def AG_Utils.GetKmirror ( )

read the current k-mirror angle This is stored in the AG_Conf properties, not returned

    This routine reads the current K mirror angle in degrees

◆ GetLoopState()

def AG_Utils.GetLoopState ( )

read the state of the AO loop This is stored in the AG_Conf properties, not returned

    This routine reads the loop state of the BCUs

◆ GetPointing()

def AG_Utils.GetPointing ( )

read the major pointing parameters from the TCS Results are not returned but stored in the AG_Conf properties

    This routine requests current pointing information from the TCS and
    adds the following to the AG_Conf structure:

        RA  - current Right Ascension
        dec - current declination
        ep  - corresponding epoch/equinox (presumably J2000)
        az  - azimuth angle
        el  - elevation angle
        par - parallactic angle

◆ GetSEpos()

def AG_Utils.GetSEpos ( )
    Returns the current SE locations (X,Y) in focal plane millimeters.

    Note: THIS WILL HAVE TO CHANGE, AS THE SE LOCATIONS MAY GET UPDATED!
          (also, it currently fudges a circle of SE...)

◆ getState()

def AG_Utils.getState (   lstFile)
    Hides a lot of ugly. This routine accepts the (known to exist) file
    lstFile and reads in the last state of the program. 

    WARNING: If you find that values in AG_Conf.py don't seem to have an
             effect, check that they are not being overwritten here!

    NOTE: This routine is not yet fully implemented!

◆ logTxt()

def AG_Utils.logTxt (   msgT,
  nLin 
)

◆ NewStuffStars()

def AG_Utils.NewStuffStars (   catNm)
    Newer, hopefully more rational version of StuffStars using standard
    astronomical packages as opposed to my own math. The other major
    difference is that we now return just separation (sep) and position
    angle (PA), since the previous RA, RAR, etc. values are not used.

    TMH 4 April 2018

         Input:   catNm - Standard LN .cat file containing asterism

        Output: nStar   - Number of stars in file
                hNam    - Star names (text, typically "V003", etc.)
                sep, PA - Separation (arcsec) and PA (radians) from target

    The .cat files have the following format:

        ####   -----RA-----  -----DEC----  --pmRA- --pmDE- equinox epoch Rmag- B-R- -sep-
        0155   06 37 21.454  +05 57 43.77      0.0     0.0 2000.0 J2000  14.45  1.7   0.0
        #hws
        0156   06 37 19.385  +05 57 11.37      4.0    -6.0 2000.0 J2000   9.66  1.8  44.7
        0157   06 37 21.994  +05 58 17.98     -4.0     2.0 2000.0 J2000   9.88  0.1  35.2
        #gws
        0158   06 37 11.942  +05 58 22.80     -2.0     2.0 2000.0 J2000  10.22  0.2 147.2
        0159   06 37 30.056  +05 59 28.94      0.0     0.0 2000.0 J2000  10.71  0.4 165.9
        0160   06 37 26.910  +05 55 52.81      2.0    -2.0 2000.0 J2000  10.96  0.9 137.6

    flds:[0]    1 2    3      4  5    6         7       8    9      10     11    12  13

    Note that the code to read in the catalog is adapted from ChartMaker.py. We don't
    need or use the GWS stars.

    Strategy
    --------

    For "Blind Mode" operation, we need accurate star positions. We therefore should
    apply both proper motion and precession to the coordinates (CHECK for precession!).

    Note that this routine supplies Position Angles and separations for each of the
    reference stars from the central target, not absolute sky positions! This is
    appropriate, since presumably, we will always be placing the target on the
    hotspot.

◆ saveState()

def AG_Utils.saveState (   lstFile)
    This routine accepts writes the last state of the program to lstFile. 


    NOTE: This routine is not yet fully implemented!

◆ SepPA2Pix()

def AG_Utils.SepPA2Pix (   sep,
  PA 
)
Returns
a pair of (x,y)
    Returns the pixel location on the PCam for the supplied separation
    and position angle. The supplied units are arcsec (sep) and radians (PA),
    and the returned values are PCam pixels.

    Note: This requires up-to-date knowledge of the current parallactic
    angle, etc.!

◆ SetGuideOffset()

def AG_Utils.SetGuideOffset (   off1,
  off2,
  typ,
  _max = AG_Conf.maxGuideCorrection 
)
Parameters
off1[arcseconds]
off2[arcseconds]
typ
_max

◆ SetOffset()

def AG_Utils.SetOffset (   off1,
  off2,
  typ 
)
    This routine sends offset information to the TCS.
    This updates the pointing center !

    Specifically, if type='RADEC'

        off1 - The telescope pointing adjustment of the RA [arcsec]
        More accurately: off1 must be the product of the change in alpha*cos(delta),
           not the pure right ascension.
        off2 - The telescope pointing adjustment of the DEC [arcsec]

    and if typ = 'AZALT'
        off1 - The telescope pointing adjustment of the elevation [arcsec]
        off2 - The telescope pointing adjustment of the azimuth [arcsec]
           off2 includes the factor cos(elevation). Note that we use the
           nomenclature typ='AZALT' as in the LBTO software, although the
           first angle is ALT and the second AZ, so this interface is rather
           a 'ALTAZ' system.

    typ        - The coordinate system for this offset.

◆ StuffStars()

def AG_Utils.StuffStars (   starFile)
################################################################################
#
#  STUFFSTARS - Extract reference star data from LBT standard file
#
#     NOTE - This is a slightly modified version of the StuffStars routine
#            from T8_Utils.py (in the E2 directory). The most significant
#            change is the elimination of code to create arrays that are
#            not used in this context (i.e. PS,PP,theta,Xtp,Ytp,Xfb,Yfb,StX,StY)
#
#  PURPOSE - Reads and parses the reference star coordinates in LBT "standard format"
#          - Creates and partially fills needed data arrays
#
#  Here is a sample LBT file:
#
#  0 02 22 24.114   +30 19 27.85  +2  -4    2000.0 J2000  6.84 2.23  0.00
#  1 02 22 13.123   +30 19 48.86  -22 -10   2000.0 J2000  7.93 0.67  143.8
#  2 02 22 13.340   +30 17 32.92  -24 -20   2000.0 J2000  8.48 0.63  180.0
#
#  The routine reads in the data and calculates the separation (in arcsec) and
#  position angle (east of north) of each object with respect to the first ref object,
#  which is the field center. It creates, stuffs, and returns the needed arrays.
# 
#       Input:  StarFile - Standard LBT.catalog containing asterism
#                          The first object is the reference
#               Verbose  - True/False flag for printed output
#
#       Output: The following arrays are created and stuffed
#               nStar    - Number of stars in file
#               RA,dec   - RA, dec of stars in decimal hours, degrees
#               RAR,decR - Same, in radians
#               sep, PA  - Separation (arcsec) and PA (radians) from ref
#
#          The following arrays are just created here, not stuffed!        
#               theta    - Angle from ref in GWS frame NOTE: just created here! - UNUSED
#               Xt,Yt    - Target star position (arcsec) in the unrotated GWS rame
#               StX,StY  - Stage Motor steps to put SE on objects
#
#  Modified from T7/Plastic version by TMH 9 June 2014
#  Added ignore first line (column labels) TMH 2 July 2014
#   and removed it for telescope compatibility TMH 3 July 2014
#               
################################################################################