Package astLib :: Module astCoords
[hide private]
[frames] | no frames]

Module astCoords

source code

module for coordinate manipulation (conversions, calculations etc.)

(c) 2007-2012 Matt Hilton

(c) 2013-2014 Matt Hilton & Steven Boada

http://astlib.sourceforge.net

Functions [hide private]
float
hms2decimal(RAString, delimiter)
Converts a delimited string of Hours:Minutes:Seconds format into decimal degrees.
source code
float
dms2decimal(decString, delimiter)
Converts a delimited string of Degrees:Minutes:Seconds format into decimal degrees.
source code
string
decimal2hms(RADeg, delimiter)
Converts decimal degrees to string in Hours:Minutes:Seconds format with user specified delimiter.
source code
string
decimal2dms(decDeg, delimiter)
Converts decimal degrees to string in Degrees:Minutes:Seconds format with user specified delimiter.
source code
float or numpy array, depending upon type of RADeg2, decDeg2
calcAngSepDeg(RADeg1, decDeg1, RADeg2, decDeg2)
Calculates the angular separation of two positions on the sky (specified in decimal degrees) in decimal degrees, assuming a tangent plane projection (so separation has to be <90 deg).
source code
float [newRA, newDec]
shiftRADec(ra1, dec1, deltaRA, deltaDec)
Computes new right ascension and declination shifted from the original by some delta RA and delta DEC.
source code
list
convertCoords(inputSystem, outputSystem, coordX, coordY, epoch)
Converts specified coordinates (given in decimal degrees) between J2000, B1950, and Galactic.
source code
list
calcRADecSearchBox(RADeg, decDeg, radiusSkyDeg)
Calculates minimum and maximum RA, dec coords needed to define a box enclosing a circle of radius radiusSkyDeg around the given RADeg, decDeg coordinates.
source code
Function Details [hide private]

hms2decimal(RAString, delimiter)

source code 

Converts a delimited string of Hours:Minutes:Seconds format into decimal degrees.

Parameters:
  • RAString (string) - coordinate string in H:M:S format
  • delimiter (string) - delimiter character in RAString
Returns: float
coordinate in decimal degrees

dms2decimal(decString, delimiter)

source code 

Converts a delimited string of Degrees:Minutes:Seconds format into decimal degrees.

Parameters:
  • decString (string) - coordinate string in D:M:S format
  • delimiter (string) - delimiter character in decString
Returns: float
coordinate in decimal degrees

decimal2hms(RADeg, delimiter)

source code 

Converts decimal degrees to string in Hours:Minutes:Seconds format with user specified delimiter.

Parameters:
  • RADeg (float) - coordinate in decimal degrees
  • delimiter (string) - delimiter character in returned string
Returns: string
coordinate string in H:M:S format

decimal2dms(decDeg, delimiter)

source code 

Converts decimal degrees to string in Degrees:Minutes:Seconds format with user specified delimiter.

Parameters:
  • decDeg (float) - coordinate in decimal degrees
  • delimiter (string) - delimiter character in returned string
Returns: string
coordinate string in D:M:S format

calcAngSepDeg(RADeg1, decDeg1, RADeg2, decDeg2)

source code 

Calculates the angular separation of two positions on the sky (specified in decimal degrees) in decimal degrees, assuming a tangent plane projection (so separation has to be <90 deg). Note that RADeg2, decDeg2 can be numpy arrays.

Parameters:
  • RADeg1 (float) - R.A. in decimal degrees for position 1
  • decDeg1 (float) - dec. in decimal degrees for position 1
  • RADeg2 (float or numpy array) - R.A. in decimal degrees for position 2
  • decDeg2 (float or numpy array) - dec. in decimal degrees for position 2
Returns: float or numpy array, depending upon type of RADeg2, decDeg2
angular separation in decimal degrees

shiftRADec(ra1, dec1, deltaRA, deltaDec)

source code 

Computes new right ascension and declination shifted from the original by some delta RA and delta DEC. Input position is decimal degrees. Shifts (deltaRA, deltaDec) are arcseconds, and output is decimal degrees. Based on an IDL routine of the same name.

Parameters:
  • ra1 (R.A. in decimal degrees) - float
  • dec1 (dec. in decimal degrees) - float
  • deltaRA (shift in R.A. in arcseconds) - float
  • deltaDec (shift in dec. in arcseconds) - float
Returns: float [newRA, newDec]
shifted R.A. and dec.

convertCoords(inputSystem, outputSystem, coordX, coordY, epoch)

source code 

Converts specified coordinates (given in decimal degrees) between J2000, B1950, and Galactic.

Parameters:
  • inputSystem (string) - system of the input coordinates (either "J2000", "B1950" or "GALACTIC")
  • outputSystem (string) - system of the returned coordinates (either "J2000", "B1950" or "GALACTIC")
  • coordX (float) - longitude coordinate in decimal degrees, e.g. R. A.
  • coordY (float) - latitude coordinate in decimal degrees, e.g. dec.
  • epoch (float) - epoch of the input coordinates
Returns: list
coordinates in decimal degrees in requested output system

calcRADecSearchBox(RADeg, decDeg, radiusSkyDeg)

source code 

Calculates minimum and maximum RA, dec coords needed to define a box enclosing a circle of radius radiusSkyDeg around the given RADeg, decDeg coordinates. Useful for freeform queries of e.g. SDSS, UKIDSS etc.. Uses calcAngSepDeg, so has the same limitations.

Parameters:
  • RADeg (float) - RA coordinate of centre of search region
  • decDeg (float) - dec coordinate of centre of search region
  • radiusSkyDeg (float) - radius in degrees on the sky used to define search region
Returns: list
[RAMin, RAMax, decMin, decMax] - coordinates in decimal degrees defining search box