PyTPM wraps many of the C structures in TPM as Python classes, using Cython extension types or cdef classes.
Note that these are only useful in the context of their usage in PyTPM. Defining these structures make it easy to call the various TPM C functions from within Python. They are neither complete nor should be used in general handling of dates, times and vectors.
Contents
There are two classes for storing angles. DMS for degrees, arc-minutes and arc-seconds, and HMS for hours, minutes and seconds. Objects of these classes can be initialized by passing scalar value of the angle in any of the three formats for representing angles: radians, hours, and degrees.
Angle in degrees, arc-minutes and arc-seconds.
A class to represent angle in degrees, arc-minutes and arc-seconds. It can be initialized using angle in other units and can be converted into other units. It can be initialized with angle in radians, r, angle in hours, h, and also using degrees, arc-minutes and arc-seconds of the angle, dd, mm and ss, respectively. If r is given then its value is used, and others are ignored. If h is present, then it is preferred over dd, mm and ss. All of dd, mm and ss are used, if they are present.
Warning
In this class, the negative sign is used for each part of the angle separately. This is different from the usual case in sexagesimal notation where the sign applies to the whole angle. Also, after calling the normalize method the sign gets assigned to the degrees part. Hence this class is not recommended for use outside PyTPM.
Parameters : | r : float, optional
h : float, optional
dd : float, int, optional
mm : float, int, optional
ss : float, int, optional
|
---|
Attributes
dd | Degrees. |
mm | Minutes of arc. |
ss | Seconds of arc. |
Degrees.
Minutes of arc.
Normalize components.
Normalizes the arc-minutes and arc-seconds of the angle into the proper range. Note that after normalize the sign of the angle applies to the degrees part alone, and not to the whole angle.
Don’t use this class outside of PyTPM.
Examples
>>> from pytpm import tpm
>>> dms = tpm.DMS(dd=-1.23)
>>> dms.dd, dms.mm, dms.ss
(-1.23, 0.0, 0.0)
>>> print dms
-01D 13' 47.999"
>>> dms.normalize()
>>> dms.dd, dms.mm, dms.ss
(-2.0, 46.0, 12.00000000000017)
Note that in the above case if we were to do dms.dd=-1.0, dms.mm=13 and dms.ss=48, we would get different results.
>>> dms.dd = -1
>>> dms.mm = 46.0
>>> dms.ss = 12.0
>>> print dms
--> print(dms)
-00D 13' 48.000"
Seconds of arc.
Return angle in decimal degrees.
Angle in degrees, arc-minutes and arc-seconds is converted into decimal degrees.
Returns : | dd : float
|
---|
Convert to an HMS object.
Returns a tpm.HMS class containing the angle in this instance converted into hours, minutes and seconds.
Returns : | hms : tpm.HMS
|
---|
Return angle in decimal hours.
Angle in degrees, arc-minutes and arc-seconds is converted into hours.
Returns : | hh : float
|
---|
Return angle in radians.
Angle in degrees, arc-minutes and arc-seconds is converted into radians.
Returns : | r : float
|
---|
Angle (or time) in hours, minutes and seconds.
This can be initialized using angles in radians, r, degrees dd, and directly providing hours, hh, minutes mm and seconds ss. The keyword used in initialization is the first keyword in the following order of precedence: r, dd and then zero or more of hh, mm and ss.
Parameters : | r : float, optional
dd : float, optional
hh : float, int, optional
mm : float, int, optional
ss : float, int, optional
|
---|
Attributes
hh | Hours. |
mm | Minutes. |
ss | Seconds. |
Hours.
Minutes.
Normalize components.
Normalizes the angle so that hours and minutes part are integer valued and the fractional part gets assigned to seconds. Similar to the case of DMS, the negative sign gets assigned to the hours part.
Examples
>>> from pytpm import tpm
>>> h = tpm.HMS()
>>> h.hh = 12.34
>>> h.mm = 1.3
>>> h.ss = 61.4
>>> h
{'mm': 1.3, 'ss': 61.399999999999999, 'hh': 12.34}
>>> h.normalize()
>>> h
{'mm': 22.0, 'ss': 43.400000000001455, 'hh': 12.0}
>>> h.hh = -12.34
>>> h
{'mm': 22.0, 'ss': 43.400000000001455, 'hh': -12.34}
>>> h.normalize()
>>> h
{'mm': 2.0, 'ss': 19.400000000001967, 'hh': -12.0}
Seconds.
Convert HMS into decimal degrees.
Angle in hours, minutes and seconds is converted into degrees.
Returns : | d : float
|
---|
Convert to a DMS object.
Returns a tpm.DMS class containing the angle/time in this instance converted into degrees, arc-minutes, and arc-seconds.
Returns : | dms : tpm.DMS
|
---|
Convert time into hours.
Angle in hours, minutes and seconds is converted into hours.
Returns : | h : float
|
---|
Convert HMS into radians.
Angle in hours, minutes and seconds is converted into radians.
Returns : | r : float
|
---|
The class YMD can be used to store a Gregorian calendar date and time, where as the class JD can be used to store a Julian date. As noted before the HMS structure can be used to store time in hours, minutes and seconds.
Class for representing data-time.
Date and time is represented using (year, month, day, hours, minutes and seconds) in the Gregorian calendar. This can be initialized in several ways. If j is present then other are ignored. If j is not present then preference is given to year, and jdd in that order. If none of these are present then zero or more of the remaining arguments are used.
Parameters : | j : float, optional
year : float, optional
ydd : 2-element tuple of floats, optional
y : int, optional
m : int, optional
dd : float, optional
hh : float, optional
mm : float, optional
ss : float, optional
|
---|
Attributes
y | Year as an integer. |
m | Month as an integer. |
dd | Day as a float. |
hh | Hours as a float. |
mm | Minutes as a float. |
ss | Seconds as a float. |
Day as a float.
Day of the year corresponding to the date-time.
Returns : | doy : float
|
---|
Examples
>>> tpm.YMD(y=2000,m=1,dd=1,hh=12.0).doy()
1.5
>>> tpm.YMD(y=2000,m=1,dd=1,hh=12.5).doy()
1.5208333334885538
Hours as a float.
Month as an integer.
Minutes as a float.
Normalize YMD.
The components y, m, dd, hh, mm and ss are normalized into their proper ranges.
Examples
>>> ymd = tpm.YMD(y=2010,m=3,dd=12.5,hh=12.25)
>>> ymd
{'mm': 0.0, 'dd': 12.5, 'm': 3, 'ss': 0.0, 'hh': 12.25, 'y': 2010}
>>> ymd.normalize()
>>> ymd
{'mm': 14.0, 'dd': 13.0, 'm': 3, 'ss': 59.999986588954926, 'hh': 0.0, 'y': 2010}
A string representation in the ‘raw’ format.
Returns : | s : str
|
---|
Examples
>>> tpm.YMD(y=2000,m=1,dd=1,hh=12.0).raw_str()
'2000 1 1 12 0 0'
>>> tpm.YMD(y=2000,m=6,dd=1.34,hh=12.0,mm=12.678).raw_str()
'2000 6 1.34 12 12.678 0'
Printing or converting to str gives a nicely formatted string representation.
>>> ymd = tpm.YMD(y=2000,m=1,dd=1,hh=12.0)
>>> print ymd
--> print(ymd)
Sat Jan 1 12:00:00.000 2000
>>> str(ymd)
'Sat Jan 1 12:00:00.000 2000'
Seconds as a float.
Convert YMD into scalar Julian date.
Returns : | jd : float
|
---|
Examples
>>> tpm.YMD(y=2000,m=1,dd=1,hh=12.0).to_j()
2451545.0
Convert into a tpm.JD object.
Returns : | jd : tpm.JD
|
---|
Examples
>>> j = tpm.YMD(y=2000,m=1,dd=1,hh=12.0).to_jd()
>>> j
{'mm': 0.0, 'ss': 0.0, 'dd': 2451545.0, 'hh': 0.0}
Convert date-time into a year number.
Returns : | year : float
|
---|
Examples
>>> tpm.YMD(y=2000,m=1,dd=1).to_year()
2000.0027322404371
>>> 2000+(1/366.0)
2000.0027322404371
>>> tpm.YMD(y=2000,m=1,dd=1,hh=12.0).to_year()
2000.0040983606557
>>> 2000+(1/366.0+12/(24.0*366.0))
2000.0040983606557
Year as an integer.
Class for Julian dates, with hours, minutes and seconds.
This class represents a Julian date using a day part and hours, minutes and seconds. This can be initialized using several parameters. If multiple keyword arguments are given then one that gets used is based on this order: j, year and then zero or more of dd, hh, mm and ss.
Parameters : | j : float, optional
year : float, optional.
dd : float, optional
hh : float, optional
mm : float, optional
ss : float, optional
|
---|
Attributes
dd | Day as a float. |
hh | Hours. |
mm | Minutes. |
ss | Seconds. |
Day as a float.
Hours.
Minutes.
Normalize the JD structure.
Normalize the components into their proper ranges and carry the fractional part of the date into seconds.
Examples
>>> j = tpm.JD(j=2451545.1234467)
>>> j
{'mm': 0.0, 'ss': 0.0, 'dd': 2451545.1234467002, 'hh': 0.0}
>>> j.normalize()
>>> j
{'mm': 57.0, 'ss': 45.794894099235535, 'dd': 2451545.0, 'hh': 2.0}
Seconds.
Convert JD to a scalar Julian date.
Returns : | j : float
|
---|
Examples
>>> jd = tpm.JD(dd=2451545.0, hh=12.0)
>>> jd.to_j()
2451545.5
Convert JD into year (Gregorian calendar).
Returns : | y : float
|
---|
Examples
>>> jd = tpm.JD(dd=2451545.0, hh=12.0)
>>> jd.to_year()
2000.0054644808743
>>> 2000+(2/366.0)
2000.0054644808743
Convert to YMD (Gregorian calendar).
Returns : | ymd : tpm.YMD
|
---|
Examples
>>> jd = tpm.JD(dd=2451545.0, hh=12.0)
>>> ymd = jd.to_ymd()
>>> ymd
{'mm': 0.0, 'dd': 1.5, 'm': 1, 'ss': 0.0, 'hh': 12.0, 'y': 2000}
TPM stores and manipulates positions of objects using full length vectors. All calculations are carried out using Cartesian vectors with units of AU for length and AU/day for velocities. In addition to vectors with three components TPM uses, “6-vectors” that store the three position components and the three velocity components. TPM uses spherical vectors while handling user input coordinates, for example positions and proper motions from catalog. Here the units are radians and radians/day.
In PyTPM, these data structures are provided as Python classes; Cython extension types. These are not meant to provide a complete implementation of vectors, but only have those features needed for their use in PyTPM. Just like the classes for angles and dates described above, they should only be used within the context of PyTPM.
There are four vector classes: V3CP, V3SP, V6C and V6S. For the general use of PyTPM, only V6C and V6S are required.
Classes V3CP and V3SP are used for representing a position vector in Cartesian and spherical coordinates, respectively. Both of these are derived from the class V3, which by itself is not very useful.
The class V6C is used for representing a Cartesian 6-vector, and the class V6S is used for representing a spherical 6-vector. Both of these are derived from the class V6, which by itself is not very useful.
There is no class for representing a velocity vector on its own, since I didn’t find any need for it. In fact, the V3CP and V3SP are also not needed, but I have them implemented anyway.
A V3 Cartesian position vector.
Parameters : | x : float
y : float
z : float
|
---|
Attributes
x | X coordinate. |
y | Y coordinate. |
z | Z coordinate. |
Convert Cartesian position vector into spherical vector.
Returns : | v3 : tpm.V3SP
|
---|
Return the cross product of two V3CP vectors.
Returns : | x : tpm.V3CP
|
---|
Return the dot product of two V3CP vectors.
Returns : | d : float
|
---|
Return modulus (length) of the V3CP vector.
Returns : | x : float
|
---|
Return unit V3CP vector.
Returns : | x : tpm.V3CP
|
---|
X coordinate.
Y coordinate.
Z coordinate.
A V3 spherical position vector.
Parameters : | r : float
alpha : float
delta : float
|
---|
Notes
The following attributes are also present:
nalpha : alpha normalized to [0, 2π). ndelta : delta normalized to [-π/2, π/2].
Attributes
r | Radial coordinate. |
alpha | Longitudinal coordinate. |
delta | Latitudinal coordinate. |
Longitudinal coordinate.
Return the cross product of two V3SP vectors.
Cross product is calculated after converting to Cartesian coordinates.
Returns : | v : tpm.V3SP
|
---|
Latitudinal coordinate.
Return the dot product of two V3SP vectors.
Dot product is calculated after converting to Cartesian coordinates.
Returns : | d : float
|
---|
Return magnitude of radial component R.
Returns : | m : float
|
---|
alpha normalized to [0, 2π).
delta normalized to [-π/2, π/2].
Radial coordinate.
Convert spherical position vector into Cartesian vector.
Returns : | v : tpm.V3CP
|
---|
As mentioned above, these are used for representing a position vector in Cartesian and spherical coordinates respectively.
An instance of the V3CP class has the attributes x, y and z which stores the three components. The V3SP class stores the components in r, alpha and delta; alpha is the RA like angle and delta is the DE like angle. It also has attributes nalpha and ndelta that store the angles alpha and delta respectively, scaled to [0 - 2π] and [-π/2 - π/2], respectively.
The values for these components can be supplied at creation time, and can be modified later on.
>>> v3cp = tpm.V3CP(x=1.0)
>>> v3cp.x, v3cp.y, v3cp.z
(1.0, 0.0, 0.0)
>>> v3cp.y=1
>>> v3cp.x, v3cp.y, v3cp.z
(1.0, 1.0, 0.0)
>>> v3sp = tpm.V3SP(r=10.0)
>>> v3sp.r, v3sp.alpha, v3sp.delta
(10.0, 0.0, 0.0)
>>> v3sp.delta = 2.3
>>> v3sp.r, v3sp.alpha, v3sp.delta
(10.0, 0.0, 2.2999999999999998)
Both these types can be can be converted into a string representation by passing it to str() or unicode(). These will be converted into strings if they are used with the print statement.
>>> print v3sp
--> print(v3sp)
1.000000000000000e+01 0.000000000000000e+00 2.300000000000000e+00
>>> print v3cp
--> print(v3cp)
1.000000000000000e+00 1.000000000000000e+00 0.000000000000000e+00
Two V3CP vectors can be added together, subtracted from each other. The method unit() returns the unit vector, where as mod() returns the length of the vector. The method cross() returns the cross product between two V3CP vectors, and the method dot returns the dot product between two V3CP vectors. A V3CP method can also be multiplied with a scalar; all components will get multiplied with the scalar and a new V3CP vector will be returned.
>>> v3cp = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v3cp1 = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v = v3cp + v3cp1
>>> v.x, v.y, v.z
(2.0, 2.0, 2.0)
>>> v = v3cp - v3cp1
>>> v.x, v.y, v.z
(0.0, 0.0, 0.0)
>>> v3cp = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v3cp.mod()
1.7320508075688772
>>> v = v3cp.unit()
>>> v.x, v.y, v.z
(0.57735026918962584, 0.57735026918962584, 0.57735026918962584)
>>> v3cp = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v3cp1 = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v = v3cp.cross(v3cp1)
>>> v.x, v.y, v.z
(0.0, 0.0, 0.0)
>>> v3cp.dot(v3cp1)
3.0
>>> v = v3cp * 3
>>> v.x, v.y, v.z
(3.0, 3.0, 3.0)
The method c2s() will convert the Cartesian components into spherical and return the results as a V3SP object.
>>> v3cp = tpm.V3CP(x=1.0,y=1.0,z=1.0)
>>> v3sp = v3cp.c2s()
>>> v3sp.r, v3sp.alpha, v3sp.delta
(1.7320508075688772, 0.78539816339744828, 0.61547970867038726)
A V3SP object, has most of methods as a V3CP object. Most operations are done by first converting into Cartesian and then converting the result back into spherical. It has the s2c() method that will convert the vector into Cartesian coordinates and returns the results as a V3CP object.
Class for Cartesian V6 vector.
Parameters : | x : float
y : float
z : float
xdot : float
ydot : float
zdot : float
|
---|
Attributes
x | X coordinate. |
y | Y coordinate. |
z | Z coordinate. |
xdot | Rate of change of X coordinate. |
ydot | Rate of change of Y coordinate. |
zdot | Rate of change of Z coordinate. |
Cartesian to spherical conversion.
Returns : | v : tpm.V6S
|
---|
Cross product of the position components.
The velocity component of the resulting V6 vector is set to 0.
Returns : | v : tpm.V6C
|
---|
Dot product of the position components.
Returns : | x : float
|
---|
Return modulus of position component of V6C vector.
Returns : | x : float
|
---|
The position component.
Return V6C with components scaled by the given factor.
Returns : | v : tpm.V6C
|
---|
Return V6C with unit position and scaled velocity components.
The velocity component is scaled by inverse of length of the position component.
Returns : | v : tpm.V6C
|
---|
Convert V6C into V3CP by addding space motion.
The positon component is increment by the product of space motion and given number of days, dt.
Returns : | v : tpm.V6CP
|
---|
X coordinate.
Rate of change of X coordinate.
Y coordinate.
Rate of change of Y coordinate.
Z coordinate.
Rate of change of Z coordinate.
This class is used for representing a Cartesian 6-vector and has 6 important attributes: x, y, z, xdot, ydot and zdot. Each of these stand for the position and velocity components. These can be assigned values at creation time by passing keyword arguments. Their values can be modified after creation.
>>> v6c = tpm.V6C(x=1.0)
>>> v6c.x
1.0
>>> v6c.y
0.0
>>> v6c.z=100.0
>>> v6c.ydot=-10.94
>>> v6c.x, v6c.y, v6c.z, v6c.xdot, v6c.ydot, v6c.zdot
(1.0, 0.0, 100.0, 0.0, -10.94, 0.0)
We can add and subtract two V6C vectors: the corresponding coordinate components are added and subtracted.
>>> v6c1 = tpm.V6C(x=10,y=9,z=8,xdot=-1.0,ydot=3.0,zdot=-12.345)
>>> v6c2 = tpm.V6C(x=10,y=7,z=3,xdot=-6.0,ydot=-3.0,zdot=1)
>>> v6c = v6c1 + v6c2
>>> v6c.x, v6c.y, v6c.z, v6c.xdot, v6c.ydot, v6c.zdot
(20.0, 16.0, 11.0, -7.0, 0.0, -11.345000000000001)
>>> v6c = v6c1 - v6c2
>>> v6c.x, v6c.y, v6c.z, v6c.xdot, v6c.ydot, v6c.zdot
(0.0, 2.0, 5.0, 5.0, 6.0, -13.345000000000001)
The length of the position component in a V6C vector can be calculated using the mod() method.
>>> v6c = tpm.V6C(x=3.0,y=3.0,z=3.0)
>>> v6c.mod()
5.196152422706632
>>> v6c.mod()**2
27.0
The method unit() will return another V6C vector, containing the unit vector of the position component and with the velocity components scaled with reciprocal of length of the position component.
>>> v6c = tpm.V6C(x=3.0,y=3.0,z=3.0,xdot=1.0,ydot=1.0,zdot=1.0)
>>> v6cu = v6c.unit()
>>> v6cu.x, v6cu.y, v6cu.z, v6cu.xdot, v6cu.ydot, v6cu.zdot
(0.57735026918962573,
0.57735026918962573,
0.57735026918962573,
0.19245008972987526,
0.19245008972987526,
0.19245008972987526)
>>> 1.0/v6c.mod()
0.19245008972987526
>>> 3.0/v6c.mod()
0.57735026918962573
The method scale() will multiply all components with the given number and return a new V6C vector with the components set to the results.
>>> v6c = tpm.V6C(x=3.0,y=3.0,z=3.0,xdot=1.0,ydot=1.0,zdot=1.0)
>>> v6c = v6c.scale(10.0)
>>> v6c.x, v6c.y, v6c.z, v6c.xdot, v6c.ydot, v6c.zdot
(30.0, 30.0, 30.0, 10.0, 10.0, 10.0)
The method v62v3(), multiply the velocity components with the given scalar, adds them to the corresponding position component and returns the result as a V3CP vector. That is, it applies space motion to the given V6C position component.
>>> v6c = tpm.V6C(x=3.0,y=3.0,z=3.0,xdot=1.0,ydot=1.0,zdot=1.0)
>>> v3cp = v6c.v62v3(2.0)
>>> v3cp.x, v3cp.y, v3cp.z
(5.0, 5.0, 5.0)
The methods dot() and cross() perform scalar and vector product between the two vectors. In the latter case, the velocity components of the resulting vector is set to 0.0
>>> v6c1 = tpm.V6C(x=10,y=9,z=8,xdot=-1.0,ydot=3.0,zdot=-12.345)
>>> v6c2 = tpm.V6C(x=10,y=7,z=3,xdot=-6.0,ydot=-3.0,zdot=1)
>>> v6c1.dot(v6c2)
187.0
>>> v6c = v6c1.cross(v6c2)
>>> v6c.x, v6c.y, v6c.z, v6c.xdot, v6c.ydot, v6c.zdot
(-29.0, 50.0, -20.0, 0.0, 0.0, 0.0)
The method c2s() converts the 6-vector into spherical coordinates and returns the result as a V6S vector. This is the method that will be used often, while using the PyTPM library. All calculations in PyTPM are done in Cartesian coordinates but the final result is most often needed in spherical coordinates, for example RA and DE.
>>> v6c = tpm.V6C(x=1.0,y=1.0,z=1.0,xdot=1,ydot=1,zdot=1.0)
>>> v6s = v6c.c2s()
>>> v6s.r, v6s.alpha, v6s.delta, v6s.rdot, v6s.alphadot, v6s.deltadot
(1.7320508075688772,
0.78539816339744828,
0.61547970867038726,
1.7320508075688774,
0.0,
-8.739772475095232e-18)
Class for spherical V6 vector.
Parameters : | r : float
alpha : float
delta : float
rdot : float
alphadot : float
deltadot : float
|
---|
Notes
The following attributes are also present:
nalpha : alpha normalized to [0, 2π). ndelta : delta normalized to [-π/2, π/2].
Attributes
r | R coordinate. |
alpha | ALPHA coordinate. |
delta | DELTA coordinate. |
rdot | Rate of change of R coordinate. |
alphadot | Rate of change of ALPHA coordinate. |
deltadot | Rate of change of DELTA coordinate. |
ALPHA coordinate.
Rate of change of ALPHA coordinate.
DELTA coordinate.
Rate of change of DELTA coordinate.
alpha normalized to [0, 2π).
delta normalized to [-π/2, π/2].
R coordinate.
Rate of change of R coordinate.
Spherical to Cartesian.
Returns : | v : tpm.V6C
|
---|
The V6S class holds a 6-vector in spherical coordinates. The components are stored in the attributes r, alpha, delta, rdot, alphadot, and deltadot. Here alpha is the RA like angle and delta is the DE like angle. These properties can be set at creation time and can be modified later on. The angles are in radians.
>>> v6s = tpm.V6S(r=1e9,alpha=2.3, delta=3.5)
>>> v6s.r, v6s.alpha, v6s.delta, v6s.rdot, v6s.alphadot, v6s.deltadot
(1000000000.0, 2.2999999999999998, 3.5, 0.0, 0.0, 0.0)
>>> v6s.r = 1.0
>>> v6s.r, v6s.alpha, v6s.delta, v6s.rdot, v6s.alphadot, v6s.deltadot
(1.0, 2.2999999999999998, 3.5, 0.0, 0.0, 0.0)
The attributes nalpha and ndelta gives normalized values of alpha and delta respectively. The first gives a value between 0 and 2π, while the latter gives a value between -π/2 and π/2.
>>> tpm.M_PI
3.1415926535897931
>>> v6s.alpha = tpm.M_PI*3
>>> v6s.nalpha
3.1415926535897931
>>> v6s.delta = -tpm.M_PI
>>> v6s.ndelta
0.0
Since a V6S vector is only used for converting catalog data into Cartesian coordinates, and vice-versa, this vector has only one method: s2c. The method converts the vector into Cartesian coordinates and returns a V6C vector.
>>> tpm.M_PI
3.1415926535897931
>>> v6s = tpm.V6S(r=1.0,alpha=tpm.M_PI/4.0,delta=tpm.M_PI/3.0)
>>> v6c = v6s.s2c()
>>> v6c.x, v6c.y, v6c.z
(0.35355339059327384, 0.35355339059327379, 0.8660254037844386)
>>> v6c.xdot, v6c.ydot, v6c.zdot
(0.0, 0.0, 0.0)
Class corresponding to TPM TSTATE structure.
The class stores all 30 quantities needed to define a state in TPM. These quantities are accessible as attributes of an object. The 12 independent attributes are read-write and the 18 dependent attributes are read-only.
Parameters : | utc : float
delta_at : float
delta_ut : float
lon : float
lat : float
alt : float
xpole : float
ypole : float
T : float
P : float
H : float
wavelength : float
|
---|
Attributes
utc | UTC as JD. Defines NOW, i.e., current time. |
delta_at | DELTA_AT = TAI - UTC (s) |
delta_ut | DELTA_UT = UT1 - UTC (s) |
lon | East longitude in radians. |
lat | Latitude in radians. |
alt | Altitude above geoid in meters. |
xpole | Polar motion in radians. |
ypole | Polar motion in radians. |
T | Ambient temperature in Kelvins. |
P | Ambient pressure in millibars. |
H | Ambient humidity (0-1). |
wavelength | Observing wavelength in microns. |
tai | International Atomic Time. |
tdt | Terrestrial Dynamic Time (Terrestrial Time). |
tdb | Barycentric Dynamic Time. |
obliquity | Obliquity of the Ecliptic. |
nut_lon | Nutation in longitude. |
nut_obl | Nutation in obliquity. |
nm | Nutation matrix for NOW. |
pm | Precession matrix from J2000 to NOW. |
ut1 | Universal time. |
gmst | Greewich Mean Sidereal Time. |
gast | Greewich Apparent Sidereal Time. |
last | Local Apparent Sidereal Time. |
eb | Barycentric Earth state vector. |
eh | Heliocentric Earth state vector. |
obs_m | Geocentric Earth-fixed mean state vector. |
obs_t | Geocentric Earth-fixed true state vector. |
obs_s | Geocentric space-fixed true state vector. |
refa | Refraction coefficient. |
refb | Refraction coefficient. |
Ambient humidity (0-1).
Ambient pressure in millibars.
Ambient temperature in Kelvins.
Altitude above geoid in meters.
DELTA_AT = TAI - UTC (s)
DELTA_UT = UT1 - UTC (s)
Barycentric Earth state vector.
Heliocentric Earth state vector.
Greewich Apparent Sidereal Time.
Greewich Mean Sidereal Time.
Local Apparent Sidereal Time.
Latitude in radians.
East longitude in radians.
Nutation matrix for NOW.
Nutation in longitude.
Nutation in obliquity.
Obliquity of the Ecliptic.
Geocentric Earth-fixed mean state vector.
Geocentric space-fixed true state vector.
Geocentric Earth-fixed true state vector.
Precession matrix from J2000 to NOW.
Refraction coefficient.
Refraction coefficient.
International Atomic Time.
Barycentric Dynamic Time.
Terrestrial Dynamic Time (Terrestrial Time).
Universal time.
UTC as JD. Defines NOW, i.e., current time.
Observing wavelength in microns.
Polar motion in radians.
Polar motion in radians.
A TSTATE object is used to store the “state data” in PyTPM. This is equivalent to the TPM_TSTATE structure in TPM. The reason I implemented this class was so that I can call the tpm_data() and tpm() functions from within Python. This object does not have any useful methods, but only has attributes corresponding to the 32 parameters that define a state. Of these the independent parameters are read-write, where as the dependent parameters are read only. The latter can be calculated, as in TPM, by passing the object to tpm_data() along with the type of calculation.
Class for holding N_TPM_STATES element array of V6 vectors.
This is a list like object with valid indexes from 0 to 21. Each index represents the state having the same number. Each index location stores a V6C vector corresponding to that state.
TPM needs an array of V6 structures, where it will store the initial, intermediate and final results, while performing coordinate transformations. In PyTPM, I have decided to implement a class that can be treated as an array of V6CP object. This is much more flexible and robust than dealing with a simple list of V6CP objects. This object can be passed, along with other information, to tpm() when performing coordinate transformations.
An index location corresponds to the appropriate TPM state. For example, the index location 6, i.e., pvec[6], corresponds to the state TPM_S06, and pvec[4] corresponds to TPM_S04.
So while performing FK5 epoch and equinox J2000 to Galactic conversion, we would insert our input V6CP vector at index location 6 and retrieve the result from index location 4.
A full example is shown here.