atSlalib
These wrappers convert common structs in our tools (like TRANS and
ARRAY structs) to forms that the SLALIB package can understand.
DESCRIPTION:
Converts radians to degrees
RETURN VALUES:
Returns degrees
SIGNATURE:
double atRadToDeg(double radians)
DESCRIPTION:
Convergs degrees to radians
RETURN VALUES:
Returns radians
SIGNATURE:
double atRadFromDeg(double degrees)
DESCRIPTION:
All angles must be in decimal degrees. The tangent
plane coordinates are also returned in degrees.
Calls SLA_DS2TP.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atVS2tp(VECTOR* ra, VECTOR* dec, double raz, double decz)
DESCRIPTION:
All angles must be in decimal degrees, including the tangent
plane coordinates. Spherical coordinates are returned in
degrees
Calls SLA_DTP2S.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atVTp2s(VECTOR* ra, VECTOR* dec, double raz, double decz)
DESCRIPTION:
Calls SLA_CTF2D. Converts a time string (hh:mm:ss) to decimal days.
RETURN VALUES:
Returns the time in days, or -1 if an error occurred.
SIGNATURE:
RET_CODE atDayFromTime(char *string, float *days)
DESCRIPTION:
Calls SLA_DAF2R. Converts an angle string (dd:mm:ss) to decimal radians.
RETURN VALUES:
Returns the angle in radians, or -10 if an error occurred.
SIGNATURE:
double atRadFromDMS(char *string)
DESCRIPTION:
Calls SLA_DTF2R. Converts an angle string (hh:mm:ss) to decimal radians.
RETURN VALUES:
Returns the angle in radians, or -10 if an error occurred.
SIGNATURE:
double atRadFromHMS(char *string)
DESCRIPTION:
Calls SLA_DR2AF. Converts an angle in decimal radians to a string (dd:mm:ss).
The string must already be allocated.
RETURN VALUES:
Returns TCL_OK
SIGNATURE:
int atRadToDMS(double angle, char *string)
DESCRIPTION:
Calls SLA_DR2TF. Converts an angle in decimal radians to a string (hh:mm:ss).
The string must already be allocated.
RETURN VALUES:
Returns TCL_OK
SIGNATURE:
int atRadToHMS(double angle, char *string)
DESCRIPTION:
Calls SLA_DAF2R. Converts an angle string (dd:mm:ss) to decimal degrees.
RETURN VALUES:
Returns the angle in degrees, or -1000 if an error occurred.
SIGNATURE:
double atDMSToDeg(char *string)
DESCRIPTION:
Calls SLA_DTF2R. Converts an angle string (hh:mm:ss) to decimal degrees.
RETURN VALUES:
Returns the angle in degrees, or -1000 if an error occurred.
SIGNATURE:
double atHMSToDeg(char *string)
DESCRIPTION:
Calls SLA_DR2AF. Converts an angle in decimal degrees to a string (dd:mm:ss).
The string must already be allocated.
RETURN VALUES:
Returns TCL_OK
SIGNATURE:
int atDegToDMS(double angle, char *string)
DESCRIPTION:
Calls SLA_DR2TF. Converts an angle in decimal degrees to a string (hh:mm:ss).
The string must already be allocated.
RETURN VALUES:
Returns TCL_OK
SIGNATURE:
int atDegToHMS(double angle, char *string)
DESCRIPTION:
Make a new TSTAMP structure with the given values
RETURN VALUES:
address of the new TSTAMP
SIGNATURE:
TSTAMP *atTstampNew(
int year, /* year including century (1995, NOT 95) */
int month, /* month (1 through 12) */
int day, /* day (1 through 31) */
int hour, /* hour (0 through 23) */
int minute, /* minute (0 through 59) */
double second /* second (0.0 through 59.999999 */
)
DESCRIPTION:
Make a new TSTAMP structure with current gm time or tai time.
RETURN VALUES:
address of the new TSTAMP
SIGNATURE:
TSTAMP *atTstampNow(
char *timetype /* UT (default) or TAI*/
)
DESCRIPTION:
Delete a TSTAMP structure.
RETURN VALUES:
Always returns SH_SUCCESS
SIGNATURE:
RET_CODE atTstampDel(TSTAMP *tstamp)
DESCRIPTION:
Return the Modified Julian Date of the TSTAMP.
RETURN VALUES:
The Julian Date
SIGNATURE:
double atTstampToMJD(
TSTAMP *tstamp
)
DESCRIPTION:
Return a TSTAMP equivalent to the Modified Julian Date.
RETURN VALUES:
Address of a TSTAMP
SIGNATURE:
TSTAMP *atTstampFromMJD(
double mjd /* the Modified Julian Date */
)
DESCRIPTION:
Increment the TSTAMP by seconds
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atTstampIncr(
TSTAMP *tstamp, /* the TSTAMP to increment */
double seconds /* number of seconds to increment */
)
DESCRIPTION:
Copy the values from tstampSource to tstampDestination
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atTstampCopy(
TSTAMP *tstampDestination,
TSTAMP *tstampSource
)
DESCRIPTION:
Return the formatted date in the string. Note that the address must
have at least 11 char's allocated before calling this function.
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atTstampToDate(
TSTAMP *tstamp, /* the TSTAMP */
char *date /* char address at least 11 long */
)
DESCRIPTION:
Return the formatted time in the string. Note that the address must
have at least 14 char's allocated before calling this function.
RETURN VALUES:
SH_SUCCESS
SIGNATURE:
RET_CODE atTstampToTime(
TSTAMP *tstamp, /* the TSTAMP */
char *date /* char address at least 14 long */
)
DESCRIPTION:
Return the Local Sidereal Time in decimal degrees for an observatory
at an arbitrary WEST longitude
RETURN VALUES:
the LST in degrees as a double
SIGNATURE:
double atTstampToLst(
TSTAMP *tstamp, /* the TSTAMP */
double theLongitude, /* at_site_longitude, for exammple.
(degrees) */
char *timetype /* UT (default) or TAI*/
)
DESCRIPTION:
Step backward from the given tstamp to find the time
of the sunrise that started this night and forward to find
the time that will end this night.
If you get a short duration you input a tstamp when the sun
was already up.
RETURN VALUES:
The number of hours in this night
SH_SUCCESS
SIGNATURE:
double atTstampToTwilight(
TSTAMP *tstampNow, /* IN: any tstamp in night */
double degrees, /* number of degrees below horizon for darkness */
TSTAMP *tstampSunset, /* OUT: tstamp of sunset */
TSTAMP *tstampSunrise /* OUT: tstamp of sunrise */
)
Determines the Ra and Dec of the Sun, Moon, or Planet at a particular
time and date using slaRdplan, which gives positions for MJD+1. To
find times for a given night, give correct GMT int(MJD) for APO after
1am on said night.
RETURN VALUES:
None
SH_SUCCESS
SIGNATURE:
void atPlanetRaDec(
TSTAMP *tstampNow, /* IN: any tstamp in night */
int np, /* IN: number that indicates which planet Moon=3, Sun=10 */
double longitude, /* IN: longitude of obs. (west) */
double lat, /* IN: latitude of obs. */
double *ra, /* OUT: ra of planet */
double *dec /* OUT: dec of planet */
)
Determines the Ra and Dec of the Sun, Moon, or Planet at a particular
time and date using slaRdplan, which gives positions for MJD+1. To
find times for a given night, give correct GMT int(MJD) for APO after
1am on said night. From RA, DEC it figures out when that object will
rise or set that night, given a certain definition for the horizon,
using atMjdRiseSet. Time is given in hours from GMT.
RETURN VALUES:
None
SH_SUCCESS
SIGNATURE:
void atPlanetRiseSet(
TSTAMP *tstampNow, /* IN: any tstamp in night */
TSTAMP *tstampSet, /* OUT: tstamp of set */
TSTAMP *tstampRise, /* OUT: tstamp of rise */
int np, /* IN: number that indicates which planet Moon=3, Sun=10 */
double longitude, /* IN: longitude of obs. (west) */
double lat, /* IN: latitude of obs. */
int tz, /* IN: time zone, 0==GMT, always pos.*/
double zd /* IN: distance from zenith in degrees that defs horizon */
)
DESCRIPTION:
Calls the SLALIB function SLA_FITXY, with VECTOR's and TRANSs.
Only the affine terms are fit; the higher-order distortion and color terms
are set to 0.
RETURN VALUES:
Returns the jflag error flag:
0 = okay
1 = illegal itype
2 = insufficient data
3 = singular solution
SIGNATURE:
int atVFitxy(
VECTOR *vxe, /* expected x positions */
VECTOR *vye, /* expected y positions */
VECTOR *vxm, /* measured x positions */
VECTOR *vym, /* measured y positions */
VECTOR *vxee, /* error in vxe */
VECTOR *vyee, /* error in vye */
VECTOR *vxme, /* error in vxm */
VECTOR *vyme, /* error in vym */
VECTOR *mask, /* if mask!=NULL, use only pts set to 1 */
TRANS *trans, /* to get from measured to expected */
int itype /* 4 for solid; 6 allows shears */
)
DESCRIPTION:
Applies a TRANS to two VECTOR's containing the measured x and y positions.
Only the affine terms are applied; the higher-order distortion and color
terms are ignored.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atVTrans(TRANS *trans, VECTOR *vxm, VECTOR *vxme, VECTOR *vym, VECTOR *vyme)
DESCRIPTION:
Apply the aberration (annual plus diurnal) at time MJD for the mean position
alpha, delta), returning the apparent place.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atAberrationApply(
double mjd, /* modified Julian date */
double epoch, /* Julian epoch (eg 2000) or if
negative, use FK5 at mjd */
double *alpha, /* in: ra mean; out: ra apparent */
double *delta /* in: dec mean; out: dec apparent */
)
DESCRIPTION:
Apply the aberration at time MJD for the vectors of mean positions
alpha, delta), returning the apparent place.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atVAberrationApply(
double mjd, /* modified Julian date */
double epoch, /* Julian epoch (eg 2000) or if
negative, use FK5 at mjd */
VECTOR* alpha, /* in: ra mean; out: ra apparent */
VECTOR* delta /* in: dec mean; out: dec apparent */
)
DESCRIPTION:
Return the aberration for the input velocit at the position (alpha, delta), in
the sense that (dAlpha, dDelta) is the apparent place minus mean place.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atAberrationGet(
double vx, /* x, y, z velocities, in units of c */
double vy,
double vz,
double alpha, /* right ascension (radians) */
double delta, /* declination (radians) */
double *dela, /* change in alpha */
double *deld /* change in delta */
)
DESCRIPTION:
Fill in the values for the geocentric apparent velocity of the
telescope given the Tstamp.
RETURN VALUES:
Returns either SH_SUCCESS or SH_GENERIC_ERROR
SIGNATURE:
RET_CODE atVelocityFromTstamp(
TSTAMP* tstamp, /* input tstamp */
VECTOR* vel /* output: x, y, z, (in AU),
vx, vy, vz
(geodetic, apparent, in AU/sec */
)
DESCRIPTION:
Transform (alpha,delta) from mean place to geocentric apparent place,
assuming zero parallax and proper motion. No guarantees for stars closer
than 300 arcsec of the center of the Sun.
RETURN VALUES:
Returns SH_SUCCESS no matter what.
SIGNATURE:
RET_CODE atMeanToApparent(
double epoch, /* epoch of mean equinox (Julian) */
double mjd, /* modified Julian date */
double *r, /* mean->apparent ra (radians) */
double *d /* mean->apparent dec (radians) */
)