cds.astro
Class Astropos

java.lang.Object
  extended by cds.astro.Coo
      extended by cds.astro.Astrocoo
          extended by cds.astro.Astropos
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Astropos
extends Astrocoo
implements java.io.Serializable

The class Astropos adds to Astrocoo the notions of mouvement (proper motions, velocity) and error ellipses.

The edition of the position in an Astropos can be done in a StringBuffer (edit methods) with options like sexagesimal or decimal edition, or as a String with one of the available toString methods. In string format, an astropos looks like:
longitude +/- latitude (epoch) [errorEllipse_mas (meanEpoch)] pm_lon pm_lat [errorEllipse_mas/yr ] parallax_mas [error] radialVelocity_km/s [error]

The values are expressed internally as cartesian components in the associated frame. Errors are expressed internally as a 6x6 covariance matrix, (multinormal error distribution is asumed), also aligned with the frame main axes. Errors in other frames are computed using the property that, if x is multinormal with covariance matrix V then Tx is multinormal with covariance matrix TVtT. For instance, the variation of the 6-vector (x,y,x,xd,yd,zd) with time is linear with the following T(t) matrix:

      1   0   0   t   0   0
      0   1   0   0   t   0
      0   0   1   0   0   t
      0   0   0   1   0   0
      0   0   0   0   1   0
      0   0   0   0   0   1
 
(notice that T-1(t) = T(-t) and T(t1) T(t2) = T(t1 + t2)) and the error propagations are easily computed by this method.

Conversions into other frames (convertTo(cds.astro.Astroframe) method) imply a change of all parameters (position, proper motions, errors). A change of the epoch is achieved with the toEpoch(double) method.

See Also:
Serialized Form

Field Summary
protected  double[][] cov
          Covariance matrix between all components (angles in mas, time in Jyr).
 double e_plx
          Mean error on parallax in mas
 double e_rv
          Mean error on radial Velocity in km/s
protected  double epocho
          The epoch of the position with minimal uncertainty (mean epoch).
 double plx
          Parallax in mas
 double rv
          Radial velocity in km/s
protected  double xd
          Derivative of x cartesian component (in Jyr-1)
protected  double yd
          Derivative of y cartesian component (in Jyr-1)
protected  double zd
          Derivative of z cartesian component (in Jyr-1)
 
Fields inherited from class cds.astro.Astrocoo
ARCMIN, ARCSEC, DEG, dlat, dlon, EDIT_2NUMBERS, EDIT_DEFAULT, EDIT_EPOCH, EDIT_FRAME, EDIT_FULL, EDIT_MEAN_EPOCH, editing, epoch, formRA, frame, MAS, NONE, precision
 
Fields inherited from class cds.astro.Coo
decimals, ed, lat, lon, Umatrix3, x, y, z
 
Constructor Summary
Astropos()
          Create the default (empty) Astropos (ICRS)
Astropos(Astrocoo coo)
          Create a Astropos object from an existing Astrocoo
Astropos(Astroframe frame)
          Create an empty Astropos.
Astropos(Astroframe frame, double lon, double lat)
          Create a Astropos object with just longitude + latitude
Astropos(Astroframe frame, double lon, double lat, double epoch, double[] eepos, double mu1, double mu2, double epocho, double[] eepm, double[] plx2, double[] rv2)
          Set a Astropos from position + proper motion.
Astropos(Astroframe frame, double lon, double lat, double epoch, double mu1, double mu2)
          Create a Astropos object: coordinates + proper motion.
Astropos(Astroframe frame, java.lang.String text)
          Create an Astropos object from a position (Epoch)
Astropos(java.lang.String text)
          Create an Astropos object from just a string.
 
Method Summary
 java.lang.Object clone()
          Clone the Coo object
 void convertTo(Astroframe new_frame)
          Transform the position into another frame.
 boolean copyErrorEllipse(double[] ee3)
          Get the Error Ellipse of the position
 boolean copyParallax(double[] valerr)
          Get the Parallax
 boolean copyProperMotion(double[] pm)
          Get the proper motions (2 components)
 boolean copyProperMotionErrorEllipse(double[] ee3)
          Get the Error Ellipse of the Proper Motion
 boolean copyVelocity(double[] valerr)
          Get the Velocity
 void dump(java.lang.String title)
          Dump the contents of an Astropos
 boolean equals(java.lang.Object o)
          Compare 2 coordinates.
static void errorEllipseToVariance(double[] ee3, double[] var)
          Convert an error ellipse (a, b, posAngle) into a variance matrix (var(x), var(y), cov(x,y)).
 double getProperMotionLat()
          Get the Latitude proper motion (mas/yr)
 double getProperMotionLon()
          Get the Longitude proper motion (mas/yr)
 double normalize()
          Renormalize the vectors
 int parse(java.lang.String txt, int offset)
          Parsing method: interpret a String.
static boolean parseErrorEllipse(Parsing txt, double[] ee3)
          Interpret an error ellipse written [ a b theta ].
 boolean parsing(Parsing txt)
          Interpret the string and convert to Coo + Epoch.
 void rotate(double[][] R)
          Rotate an Astropos.
 void set()
          Reset position to unknown.
 void set(Astrocoo coo)
          Set position from another Astrocoo
 void set(Coo coo)
          New position from a Coo
 void set(Coo coo, double epoch)
          Set position from Coordinate and Epoch.
 void set(double lon, double lat)
          Set position from RA + Dec.
 void set(double lon, double lat, double epoch)
          Set position from RA + Dec and epoch
 void set(double lon, double lat, double epoch, double[] eepos, double mu1, double mu2, double epocho, double[] eepm, double[] plx2, double[] rv2)
          Set a Astropos from position + proper motion.
 void set(double lon, double lat, double epoch, double mu1, double mu2)
          Set position from RA + Dec.
 void set(java.lang.String text)
          Set a particuliar set of positions in the Astropos.
 void set(java.lang.String text, boolean equatorial)
          Overload Coo method (see set(String text) )
 void setDefaultMeanEpoch(double epocho)
          Set a Default Mean Epoch.
 boolean setEpoch(double epoch)
          Set the Epoch of the position.
 boolean setErrorEllipse(double e_maj, double e_min, double pa)
          Set the Error Ellipse.
 boolean setErrorEllipse(double e_maj, double e_min, double pa, double epocho)
          Set the Error Ellipse, with the epoch of this error (epocho, mean epoch)
 boolean setErrorProperMotion(double e_mu1, double e_mu2)
          Set the Error on Proper Motion
 boolean setErrorProperMotion(double e_maj, double e_min, double pa)
          Set the Error on Proper Motions
 void setFrameEpoch()
          Set the default epoch of the frame to current epoch
 boolean setParallax(double plx, double err)
          Set the Parallax
 boolean setProperMotion(double mu1, double mu2)
          Set the Proper Motion
 boolean setRadialVelocity(double rv, double err)
          Set the Radial Velocity
 double sigmaLat()
          Get the mean error on Latitude ({sigma}(Dec))
 double sigmaLon()
          Get the mean error on Longitude ({sigma}RA*cos(Dec))
 double sigmaProperMotionLat()
          Get the mean error on Latitude proper motion ({sigma}(Dec))
 double sigmaProperMotionLon()
          Get the mean error on Longitude proper motion ({sigma}pmRA*cos(Dec))
 void toEpoch(double Jyr)
          Change the epoch of the position (in the same frame)
 java.lang.String toString()
          Default edition: use what's stored
 java.lang.String toString(int opt)
          Default edition: use what's stored
static void varianceToErrorEllipse(double[] var, double[] ee3)
          Convert a variance matrix (var(x), var(y), cov(x,y)) into an error ellipse (a, b, posAngle).
 
Methods inherited from class cds.astro.Astrocoo
convert, edit, editEpoch, editingOptions, explain, getEditing, getEpoch, getFrame, getLatPrec, getLonPrec, getPrecision, parseIAU, setEditing, setEditing, setIAU, setPrecision, setPrecision, toIAU, toString
 
Methods inherited from class cds.astro.Coo
add, add, angle, copyAngles, copyUvector, dist2, dist2, dist2, distance, distance, distc, dotprod, dotprod, dotprod, editCoo, eulerMatrix, getLat, getLon, localMatrix, localMatrix, localMatrix, moveMatrix, norm2, normalize, perpendicular, posAngle, rotate_1, rotateVector_1, rotateVector, setDecimals, setUvec, sub, sub, toString, toString, toString, vecprod, vecprod, vecprod
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

xd

protected double xd
Derivative of x cartesian component (in Jyr-1)


yd

protected double yd
Derivative of y cartesian component (in Jyr-1)


zd

protected double zd
Derivative of z cartesian component (in Jyr-1)


epocho

protected double epocho
The epoch of the position with minimal uncertainty (mean epoch). Unit = Jyr


plx

public double plx
Parallax in mas


rv

public double rv
Radial velocity in km/s


e_plx

public double e_plx
Mean error on parallax in mas


e_rv

public double e_rv
Mean error on radial Velocity in km/s


cov

protected double[][] cov
Covariance matrix between all components (angles in mas, time in Jyr). it includes errors as well as correlations between position and proper motions.

Constructor Detail

Astropos

public Astropos()
Create the default (empty) Astropos (ICRS)


Astropos

public Astropos(Astroframe frame)
Create an empty Astropos.

Parameters:
frame - in which frame

Astropos

public Astropos(Astroframe frame,
                double lon,
                double lat)
Create a Astropos object with just longitude + latitude

Parameters:
lon - longitude (RA), degrees
lat - latitude (Dec), degrees

Astropos

public Astropos(Astroframe frame,
                double lon,
                double lat,
                double epoch,
                double mu1,
                double mu2)
Create a Astropos object: coordinates + proper motion.

Parameters:
lon - longitude (RA), degrees
lat - latitude (Dec), degrees
epoch - epoch of the longitude/latitude, year
mu1 - proper motion along longitude, mas/yr
mu2 - proper motion along latitude, mas/yr

Astropos

public Astropos(Astrocoo coo)
Create a Astropos object from an existing Astrocoo

Parameters:
coo - Astrocoo object

Astropos

public Astropos(Astroframe frame,
                java.lang.String text)
         throws java.text.ParseException
Create an Astropos object from a position (Epoch)

Parameters:
frame - one of the possible Astroframes
text - Text with position, possibly followed by an epoch
Throws:
java.text.ParseException

Astropos

public Astropos(java.lang.String text)
         throws java.text.ParseException
Create an Astropos object from just a string.

Parameters:
text - Text with frame, position, possibly followed by an epoch
Throws:
java.text.ParseException

Astropos

public Astropos(Astroframe frame,
                double lon,
                double lat,
                double epoch,
                double[] eepos,
                double mu1,
                double mu2,
                double epocho,
                double[] eepm,
                double[] plx2,
                double[] rv2)
Set a Astropos from position + proper motion.

Parameters:
frame - one of the possible Astroframes
lon - longitude (RA), degrees
lat - latitude (Dec), degrees
eepos - error ellipse, mas
epoch - epoch of the longitude/latitude, Julian year
mu1 - proper motion along longitude, mas/yr
mu2 - proper motion along latitude, mas/yr
eepm - error ellipse of proper motion, mas/yr
epocho - epoch of position error (minimal error), Jyr
plx2 - parallax + its error (mas)
rv2 - radial velocity + its error (km/s)
Method Detail

normalize

public double normalize()
Renormalize the vectors

Overrides:
normalize in class Coo
Returns:
the norm of the 3-D vector

rotate

public final void rotate(double[][] R)
Rotate an Astropos. Its changes position, proper motions and errors

Overrides:
rotate in class Coo
Parameters:
R - [3][3] matrix

varianceToErrorEllipse

public static final void varianceToErrorEllipse(double[] var,
                                                double[] ee3)
Convert a variance matrix (var(x), var(y), cov(x,y)) into an error ellipse (a, b, posAngle). The axises of the error ellipse are the squared eigenvalues of variance matrix, i.e.
(var(x)-a)(var(y)-a) = cov(x,y)
(var(x)-b)(var(y)-b) = cov(x,y)
a2 and b2 are solutions of a simple 2nd order equation. The posAngle defines the eigenvector of the largest eigenvalue

Parameters:
var - Vector {var(x) var(y) cov(x,y) }
ee3 - Vector { a b theta } axises+PA of ellipse The relation

errorEllipseToVariance

public static final void errorEllipseToVariance(double[] ee3,
                                                double[] var)
Convert an error ellipse (a, b, posAngle) into a variance matrix (var(x), var(y), cov(x,y)). X = sin(theta)*x - cos(theta)*y = st*x - ct*y
Y = cos(theta)*x + sin(theta)*y = ct*x + st*y
the covariances of (X,Y) are:
var(X) = st2*var(x) + ct2*var(y)
var(Y) = ct2*var(x) + st2*var(y)
cov(X,Y) = ct*st*(var(x)-var(y))

Parameters:
ee3 - Vector { a b theta} axises+PA of ellipse
var - Vector {var(x) var(y) cov(x,y)} The relation

parseErrorEllipse

public static boolean parseErrorEllipse(Parsing txt,
                                        double[] ee3)
Interpret an error ellipse written [ a b theta ]. If theta is missing, its value is defaulted to 90° (i.e. a and b represent the mean errors on RA*cos(Dec) and Dec). If a single number is found, it's assumed to be the error circle.

Parameters:
txt - Text to interpret
ee3 - Vector ( a b theta) axises+PA of ellipse
Returns:
true if error ellipse could be parsed.

clone

public java.lang.Object clone()
Description copied from class: Coo
Clone the Coo object

Overrides:
clone in class Astrocoo

dump

public void dump(java.lang.String title)
Dump the contents of an Astropos

Overrides:
dump in class Astrocoo
Parameters:
title - title line

parsing

public boolean parsing(Parsing txt)
Interpret the string and convert to Coo + Epoch. Called from set and parse routines. Interprets until mismatch.

Overrides:
parsing in class Astrocoo
Parameters:
txt - to interpret as a Parsing object e.g. "12 34.5 -72 54 [30 20 65 (J1991.25)] J2000.0 +125.2 -35.2 [3.9 2.5 45] 123[4]km/s 10[5]"
Returns:
true if OK.

parse

public int parse(java.lang.String txt,
                 int offset)
Parsing method: interpret a String.

Overrides:
parse in class Astrocoo
Parameters:
txt - to interpret.
offset - starting position in text
Returns:
new position.

set

public void set()
Reset position to unknown.

Overrides:
set in class Coo

set

public void set(Coo coo)
New position from a Coo

Overrides:
set in class Coo
Parameters:
coo - A coordinate

set

public void set(Astrocoo coo)
Set position from another Astrocoo

Overrides:
set in class Astrocoo
Parameters:
coo - A coordinate

set

public void set(Coo coo,
                double epoch)
Set position from Coordinate and Epoch.

Overrides:
set in class Astrocoo
Parameters:
coo - A coordinate
epoch - Epoch of position

set

public void set(double lon,
                double lat)
Set position from RA + Dec.

Overrides:
set in class Coo
Parameters:
lon - longitude in degrees
lat - latitude angle in degrees

set

public void set(double lon,
                double lat,
                double epoch)
Set position from RA + Dec and epoch

Overrides:
set in class Coo
Parameters:
lon - x item in unit vector (direction cosines)
lat - y item in unit vector (direction cosines)
epoch - z item in unit vector (direction cosines)

set

public void set(double lon,
                double lat,
                double epoch,
                double mu1,
                double mu2)
Set position from RA + Dec.


set

public void set(double lon,
                double lat,
                double epoch,
                double[] eepos,
                double mu1,
                double mu2,
                double epocho,
                double[] eepm,
                double[] plx2,
                double[] rv2)
Set a Astropos from position + proper motion. To remove ?

Parameters:
lon - longitude (RA), degrees
lat - latitude (Dec), degrees
epoch - epoch of the longitude/latitude, year
eepos - error ellipse, mas
mu1 - proper motion along longitude, mas/yr
mu2 - proper motion along latitude, mas/yr
epocho - epoch of proper motion (minimal position error)
eepm - error ellipse of proper motion, mas/yr
plx2 - parallax + its error (mas)
rv2 - radial velocity + its error (km/s)

set

public void set(java.lang.String text)
         throws java.text.ParseException
Set a particuliar set of positions in the Astropos. The precision is adapted to the number of significant digits existing in the input text string.

Overrides:
set in class Astrocoo
Parameters:
text - Longitude + latitude in text
Throws:
java.text.ParseException - when the text can't br fully interpreted.

set

public void set(java.lang.String text,
                boolean equatorial)
         throws java.text.ParseException
Overload Coo method (see set(String text) )

Throws:
java.text.ParseException

setFrameEpoch

public void setFrameEpoch()
Set the default epoch of the frame to current epoch


setDefaultMeanEpoch

public void setDefaultMeanEpoch(double epocho)
Set a Default Mean Epoch. (e.g. 1991.25 for Hipparcos data)

Parameters:
epocho - The default mean epoch, in Julian years. An NaNvalue remove the default mean epoch.

setEpoch

public boolean setEpoch(double epoch)
Set the Epoch of the position.

Overrides:
setEpoch in class Astrocoo
Parameters:
epoch - The epoch of the positions. An NaNvalue remove the default mean epoch.
Returns:
true when parameter OK, false if ignored.

setErrorEllipse

public boolean setErrorEllipse(double e_maj,
                               double e_min,
                               double pa)
Set the Error Ellipse. Note that the position MUST have been set before, otherwise this parameter is ignored...

Parameters:
e_maj - Major axis of error ellipse (mas)
e_min - Minor axis of error ellipse (mas
pa - Position angle of error ellipse (deg)
Returns:
true when parameter OK, false if positions not known.

setErrorEllipse

public boolean setErrorEllipse(double e_maj,
                               double e_min,
                               double pa,
                               double epocho)
Set the Error Ellipse, with the epoch of this error (epocho, mean epoch)

Parameters:
e_maj - Major axis of error ellipse (mas)
e_min - Minor axis of error ellipse (mas
pa - Position angle of error ellipse (deg)
epocho - Mean epoch (epoch of the error)
Returns:
true when parameter OK, false if positions not known.

setProperMotion

public boolean setProperMotion(double mu1,
                               double mu2)
Set the Proper Motion

Parameters:
mu1 - Proper motion along longitude or Right Ascension (mas/yr)
mu2 - Proper motion along latitude or Declination (mas/yr)
Returns:
true when parameter OK, false if positions not known.

setErrorProperMotion

public boolean setErrorProperMotion(double e_mu1,
                                    double e_mu2)
Set the Error on Proper Motion

Parameters:
e_mu1 - Error on longitude or Right Ascension (mas/yr)
e_mu2 - Error on latitude or Declination (mas/yr)
Returns:
true when parameter OK, false if positions not known.

setErrorProperMotion

public boolean setErrorProperMotion(double e_maj,
                                    double e_min,
                                    double pa)
Set the Error on Proper Motions

Parameters:
e_maj - Major axis of error ellipse (mas)
e_min - Minor axis of error ellipse (mas
pa - Position angle of error ellipse (deg)
Returns:
true when parameter OK, false if positions not known.

setRadialVelocity

public boolean setRadialVelocity(double rv,
                                 double err)
Set the Radial Velocity

Parameters:
rv - Radial velocity in km/s
err - Error on radial velocity in km/s
Returns:
true when parameter OK, false if position not known, or NaN

setParallax

public boolean setParallax(double plx,
                           double err)
Set the Parallax

Parameters:
plx - Parallax, in mas (kpc-1)
err - Error on parallax (mas)
Returns:
true when parameter OK, false if positions not known, or NaN

copyErrorEllipse

public boolean copyErrorEllipse(double[] ee3)
Get the Error Ellipse of the position

Parameters:
ee3 - Vector of 3 components (a, b, posAngle) (a and b in mas, posAngle in degrees)
Returns:
true for actual error ellipse, false for estimated one.

sigmaLon

public double sigmaLon()
Get the mean error on Longitude ({sigma}RA*cos(Dec))

Returns:
The mean error (estimated or actual) in mas

sigmaLat

public double sigmaLat()
Get the mean error on Latitude ({sigma}(Dec))

Returns:
The mean error (estimated or actual) in mas

copyProperMotion

public boolean copyProperMotion(double[] pm)
Get the proper motions (2 components)

Parameters:
pm - Vector of 2 components (pmRA*cos(Dec), pmDec)
Returns:
true for actual proper motion, false for estimated one.

getProperMotionLon

public double getProperMotionLon()
Get the Longitude proper motion (mas/yr)

Returns:
Proper motion in Longitude (RA), in mas/yr

getProperMotionLat

public double getProperMotionLat()
Get the Latitude proper motion (mas/yr)

Returns:
Proper motion in Latitude (Dec), in mas/yr

copyProperMotionErrorEllipse

public boolean copyProperMotionErrorEllipse(double[] ee3)
Get the Error Ellipse of the Proper Motion

Parameters:
ee3 - Vector of 3 components (a, b, posAngle) (a and b in mas/Jyr, posAngle in degrees)
Returns:
true for actual error ellipse, false for estimated one.

sigmaProperMotionLon

public double sigmaProperMotionLon()
Get the mean error on Longitude proper motion ({sigma}pmRA*cos(Dec))

Returns:
The mean error (estimated or actual) in mas/yr

sigmaProperMotionLat

public double sigmaProperMotionLat()
Get the mean error on Latitude proper motion ({sigma}(Dec))

Returns:
The mean error (estimated or actual) in mas

copyParallax

public boolean copyParallax(double[] valerr)
Get the Parallax

Parameters:
valerr - Vector of 2 components (plx, e_plx) (mas)
Returns:
true for actual parallax, false for estimated one.

copyVelocity

public boolean copyVelocity(double[] valerr)
Get the Velocity

Parameters:
valerr - Vector of 2 components (Rvel, e_Rvel) (mas)
Returns:
true for actual parallax, false for estimated one.

equals

public boolean equals(java.lang.Object o)
Compare 2 coordinates.

Overrides:
equals in class Astrocoo
Parameters:
o - Objet a comparer.
Returns:
Vrai si o est identique a this.

toString

public java.lang.String toString()
Default edition: use what's stored

Overrides:
toString in class Astrocoo
Returns:
the edited string

toString

public java.lang.String toString(int opt)
Default edition: use what's stored

Overrides:
toString in class Astrocoo
Parameters:
opt - Option, as in Astrocoo
Returns:
the edited string

toEpoch

public void toEpoch(double Jyr)
Change the epoch of the position (in the same frame)

Parameters:
Jyr - the new epoch

convertTo

public void convertTo(Astroframe new_frame)
Transform the position into another frame. On return, all astrometric components are converted into the new frame specified, at the default epoch of new_frame.

Overrides:
convertTo in class Astrocoo
Parameters:
new_frame - The frame of the resulting position.