rotator
index
/home/optics/dazle/dics/dics/rotator.py

 
Modules
       
datetime
logging
math
slalib

 
Classes
       
exceptions.Exception
Error
ParseError
SlalibError
UnitsError
angle
rotator
target
telescope

 
class Error(exceptions.Exception)
    Base class for exceptions in this module.
 
  Methods inherited from exceptions.Exception:
__getitem__(...)
__init__(...)
__str__(...)

 
class ParseError(Error)
    Raised when problems occur when parsing strings with slalib routines.
 
 
Method resolution order:
ParseError
Error
exceptions.Exception

Methods defined here:
__init__(self, function, status, startPos, endPos)

Methods inherited from exceptions.Exception:
__getitem__(...)
__str__(...)

 
class SlalibError(Error)
    Raised when an error code is returned by a slalib routine.
 
 
Method resolution order:
SlalibError
Error
exceptions.Exception

Methods defined here:
__init__(function, status)

Methods inherited from exceptions.Exception:
__getitem__(...)
__str__(...)

 
class UnitsError(Error)
    Raised where invalid units are specified.
 
 
Method resolution order:
UnitsError
Error
exceptions.Exception

Methods defined here:
__init__(self, function, unit)
__repr__()
__str__()

Methods inherited from exceptions.Exception:
__getitem__(...)

 
class angle
    Class for storing angles.  Internally stores an angle as a float in radians
and provides methods for setting and retrieving the angle in a variety of
units, both via floats or various string formats.
 
  Methods defined here:
__abs__(self)
__add__(self, other)
__div__(self, other)
__eq__(self, other)
__ge__(self, other)
__gt__(self, other)
__iadd__(self, other)
__idiv__(self, other)
__imul__(self, other)
__init__(self, value=0.0, units=False)
Standard initialiser, takes up to two arguments.  The first argument
(which defaults to zero) is the angle to store, the second argument
(which defaults to 'r') indicates the units used, 'r' for radians,
'd' for degrees and 'h' for hours.  The angle may be in any numeric
type acceptable to the builtin function float().  Alternatively, if
value is itself an angle object, this becomes a C++ style 'copy
constructor' and units is ignored.  Thirdly, value may be a string
representation of an angle, in which case it will be parsed by
angle.setString().  For string values only units of 'd' or 'h' are
acceptable, and units will default to 'd'.
__isub__(self, other)
__itruediv__(self, other)
__le__(self, other)
__lt__(self, other)
__mul__(self, other)
__ne__(self, other)
__neg__(self)
__pos__(self)
__radd__(self, other)
__repr__(self)
__rmul__(self, other)
__rsub__(self, other)
__str__(self)
__sub__(self, other)
__truediv__(self, other)
getAngle(self, units='r')
Returns the value of the angle as a float in the specified units,
'r' - radians, 'd' - degrees or 'h' - hours.
getString(self, units='d', ndp=3)
Returns a string representation of the angle in sexagesimal or
'time' formats.  The optional first parameter units can be 'd', 'h' or
't' for degrees, hours (sexagesimal) or hours (time format), default
is 'd'.  The optional second parameter, 'ndp', specified the number of
decimal places in the seconds field, default 3.
 
For decimal string representations getAngle() can be used together with
standard string formatting commands.
norm2Pi(self)
Normalises the angle into the range 0-2Pi.
normPi(self)
Normalises the angle into the range +/-Pi.
setAngle(self, value=0.0, units='r')
Sets the angle. Takes up to two arguments.  The first argument
(which defaults to zero) is the angle to store, the second argument
(which defaults to 'r') indicates the units used, 'r' for radians,
'd' for degrees and 'h' for hours.  The angle may be in any form
acceptable to the builtin function float().  Alternatively, if value
is itself an angle object, this makes the angles equal and the units
argument is ignored.
setString(self, angleString, units='d', startPos=1)
Sets the angle from a string representation.  The first argument
contains a free format string representing the angle as either
a decimal or sexagesimal number (or a combination of the two) and
the second is a character specifying the units used ('d' for degrees,
'h' for hours).  Uses slaDafin from the slalib module to parse the
string.  An optional third argument specifies where in the string
to start parsing (in a 1 based, not zero based, count).
 
Returns the position in the string at which encoding finished.

 
class rotator
    Class representing the camera rotation system used by DAZLE for field
rotation comepensation.
 
  Methods defined here:
__init__(portname, position, lower_limit, upper_limit, encoder_units, observatory, field, name='rotator')
Initialiser for rotator class.
 
Arguments:
 
portname:       The device name of the serial port which the
                Taranis stepper motor controller is connected to.
position:       The initial position of the rotator, in encoder units.
lower_limit:    Lower limit of range of motion, in encoder units.
upper_limit:    Upper limit of range of motion, in encoder units.
encoder_units:  Number of encoder units per radian of rotator rotation.
name:           label used for logging purposes.

 
class target
    Class representing a target field.  Stores the position of the field
in mean place FK5 J2000 coordinates, and calculates the geocentric
apparent coordinates when given the epoch.  Also have a number of methods
for setting and retrieving coordinates.
 
  Methods defined here:
__init__(self, RA, Dec, PA)
Initialises the target object.  Takes three arguments, the target's
RA, Dec and desired position angle.  RA and Dec should be mean place
FK5 J2000 coordinates.  Position angle is here defined as the angle
Northpole-field centre-'up', where 'up' is the upwards direction on the
detector.  Each of the arguments should be either a single value
acceptable to the rotator.angle constructor (e.g. a rotator.angle
object, a numeric type representing an angle in radians, or a string
containing a sexagesimal/decimal representation of the angle in
degrees) or a sequence object containing an argument list for
the constructor.
getApparentPlace(self)
If apparent place RA and Dec have been calculated (with
updateApparentPlace()) then returns them, else returns None.
getCoords(self)
Returns the mean place FK5 J2000 RA and Dec, and the position angle
for the target, as rotator.angle objects.
getPA(self)
Returns the position angle for the target as a rotator.angle object
setCoords(RA, Dec, PA)
Sets the mean place FK5 J2000 RA and Dec, and the requested position
angle for the target.  Arguments are as for __init__().
unwind(self, shiftnumber)
Changes the position angle by the argument, shiftnumber, times
90 degrees.  This will be done by a rotator object in order to
keep its required position within its range of motion.  The
argument must be a type acceptible to the builtin int() function.
updateApparentPlace(self, tdb)
Performs the precession-nutation, light deflection and annual
aberration calculations required to obtain the apparent place
RA and dec of the target, and both returns and stores the result.
 
A single argument is required, the Barycentric Dynamical Time of
observation as a datetime.datetime object.  According to the called
slalib.slaMap routine's notes, 'The distinction between the required
TDB and TT is always negligible.  Moreover, for all but the most
critical applications UTC is adequate'.

 
class telescope
    Class representing the telescope/observatory.  Stores information relating
to the position and meteorological conditions (for refraction
calculations) and performs calculations of observed azimuth and elevation.
 
  Methods defined here:
__init__(self, longitude, latitude, altitude, polar_motion_x, polar_motion_y, delta_UT, temperature, pressure, humidity, tlr, wavelength)
Initialiser for a telescope object.  Arguments representing angles
should be an object acceptable as an argument to the rotator.angle
constructor, or a sequence type containing a list of arguments
acceptible to rotator.angle().
 
Arguments:
 
longitude:      Mean longitude of the telescope, east positive.
latitude:       Mean geodetic latitude of the telescope.
altitude:       Telescope's height above mean sea level (metres).
polar_motion_x: Polar motion x-coordinate for today, from IERS
polar_motion_y: Polar motion y-coordinate for today, from IERS
delta_UT:       UT1-UTC from IERS, in seconds, as a float
temperature:    Local ambient temperature (Kelvin)
pressure:       Local atmospheric pressure (millibars)
humidity:       Local relative humidity (in the range 0.0-1.0)
tlr:            Tropospheric lapse rate (Kelvin/metre)
wavelength:     Effective wavelength of the observations (microns)
getIERS(self)
Returns the stored earth rotation parameters, as provided by the
International Earth Rotation Service, UT1-UTC (seconds, float),
and the x and y components of polar motion (rotator.angles).
getLocation(self)
Returns the telescope location information, longitude, latitude
(both as rotator.angles) and altitude (metres).
getPointing(field, utc)
Calculates the observed azimuth and zenith distance for a given field
and time.  Note that these calculations assume a 'perfect' telescope,
no pointing model is used.
 
Arguments:
 
field: the target field, expressed as a rotator.field object.
utc:   the time of observation, UTC, expressed as a datetime.datetime
       object
 
Returned:
 
az:    the observed azimuth expressed as a rotator.angle, East = 90deg
zd:    the observed zenith distance expressed as a rotator.angle.
getWavelength(self)
Returns the stored effective wavelength of observations, in microns.
getWeather(self)
Returns the stored meteorological parameters, temperature (in Kelvin),
pressure (in millibars), relative humidity (in the range 0-1.0) and
tropospheric lapse rate (Kelvin/metre).
setIERS(self, delta_UT, polar_motion_x, polar_motion_y)
Sets the earth rotation parameters.  The information to do this
should be obtained from the International Earth Rotation Service
bulletin covering the day in question.
 
Arguments:
 
delta_UT:       UT1-UTC, in seconds.
polar_motion_x: Polar motion x-coordinate, as either an argument or
                sequence containing an argument list for the
                rotator.angle() constructor.
polar_motion_y: Polar motion y-coordinate, as either an argument or
                sequence containing an argument list for the
                rotator.angle() constructor.
setLocation(self, longitude, latitude, altitude)
Sets the telescope location information.
 
Arguments:
 
longitude: Mean longitude of the telescope, east positive, as either
           an argument or sequence containing an argument list for the
           rotator.angle() constructor.
latitude:  Mean geodetic latitude of the telescope, as either an
           argument or sequence containing an argument list for the
           rotator.angle() constructor.
altitude:  The telescope's height above mean sea level, in metres.
setWavelength(self, wavelength)
Sets the effective wavelength of observations.
 
Arguments:
 
wavelength: Effective wavelength of observations, in microns.
setWeather(self, temperature, pressure, humidity, tlr)
Sets the meteorogical parameters used in the refraction calculations.
 
Arguments:
 
temperature:    Local ambient temperature (Kelvin)
pressure:       Local atmospheric pressure (millibars)
humidity:       Local relative humidity (in the range 0.0-1.0)
tlr:            Tropospheric lapse rate (Kelvin/metre)