Esempio n. 1
0
def PosVelToPTW(pos, vel):
    """
	Converts position and velocity vectors to U, V, W vectors.
	The resulting vectors have the following meanings. 
	U vector: V x W 
	V vector: along velocity direction 
	W vector: pos x vel 
	
	:param float[3] pos: The position vector to be converted. (double[3])
	:param float[3] vel: The velocity vector to be converted. (double[3])
	:return:
		- **uVec** (*float[3]*) - The resulting U vector. (double[3])
		- **vVec** (*float[3]*) - The resulting V vector. (double[3])
		- **wVec** (*float[3]*) - The resulting W vector. (double[3])
	"""
    pos = settings.list_to_array(pos)
    vel = settings.list_to_array(vel)
    uVec = settings.double3()
    vVec = settings.double3()
    wVec = settings.double3()
    C_ASTRODLL.PosVelToPTW(pos, vel, uVec, vVec, wVec)
    uVec = settings.array_to_list(uVec)
    vVec = settings.array_to_list(vVec)
    wVec = settings.array_to_list(wVec)
    return (uVec, vVec, wVec)
Esempio n. 2
0
def ECIToTopoComps(theta, lat, senPos, satPos, satVel):
    """
	Converts satellite ECI position/velocity vectors and sensor location to topocentric components.
	
	:param float theta: Theta - local sidereal time(rad).
	:param float lat: Station's astronomical latitude (deg). (+N) (-S)
	:param float[3] senPos: Sensor position in ECI (km). (double[3])
	:param float[3] satPos: Satellite position in ECI (km). (double[3])
	:param float[3] satVel: Satellite velocity in ECI (km/s). (double[3])
	:return:
		**xa_topo** (*float[10]*) - An array that stores the resulting topocentric components. (double[10])

			- [0]: Resulting right ascension (RA) (deg) 
			- [1]: Declination (deg) 
			- [2]: Azimuth (deg) 
			- [3]: Elevation (deg) 
			- [4]: Range (km) 
			- [5]: RAdot (first derivative of right ascension) (deg/s) 
			- [6]: DecDot (first derivative of declination) (deg/s) 
			- [7]: AzDot (first derivative of azimuth) (deg/s) 
			- [8]: ElDot (first derivative of elevation) (deg/s) 
			- [9]: RangeDot (first derivative of range) (km/s) 
	"""
    theta = c.c_double(theta)
    lat = c.c_double(lat)
    senPos = settings.list_to_array(senPos)
    satPos = settings.list_to_array(satPos)
    satVel = settings.list_to_array(satVel)
    xa_topo = settings.double10()
    C_ASTRODLL.ECIToTopoComps(theta, lat, senPos, satPos, satVel, xa_topo)
    xa_topo = settings.array_to_list(xa_topo)
    return xa_topo
Esempio n. 3
0
def RotJ2KToDate(spectr, nutationTerms, ds50TAI, posDate, velDate):
    """
	Rotates position and velocity vectors from coordinates of date to J2000. 
	
	:param float spectr: Specifies whether to run in SPECTR compatibility mode. A value of 1 means Yes.
	:param float nutationTerms: Nutation terms (4-106, 4:less accurate, 106:most acurate).
	:param float ds50TAI: Time in days since 1950, TAI for which the coordinates of position and velocity vectors are currently expressed.
	:param float[3] posJ2K: The position vector from J2000. (double[3])
	:param float[3] velJ2K: The velocity vector from J2000. (double[3])
	:return:
		- **posDate** (*float[3]*) - The resulting position vector in coordinates of date, ds50TAI. (double[3])
		- **velDate** (*float[3]*) - The resulting velocity vector in coordinates of date, ds50TAI. (double[3])
	"""
    spectr = c.c_int32(spectr)
    nutationTerms = c.c_int32(nutationTerms)
    ds50TAI = c.c_double(ds50TAI)
    posJ2K = settings.list_to_array(posJ2K)
    velJ2K = settings.list_to_array(velJ2K)
    posDate = settings.double3()
    velDate = settings.double3()
    C_ASTRODLL.RotJ2KToDate(spectr, nutationTerms, ds50TAI, posJ2K, velJ2K,
                            posDate, velDate)
    posDate = settings.array_to_list(posDate)
    velDate = settings.array_to_list(velDate)
    return (posDate, velDate)
Esempio n. 4
0
def Sgp4PosVelToKep(yr, day, pos, vel):
    """
	Converts osculating position and velocity vectors to a set of mean Keplerian SGP4 elements.
	
	The new position and velocity vectors are the results of using SGP4 propagator to propagate the computed sgp4MeanKep to the time specified in year and day of epoch time. They should be closely matched with the input osculating position and velocity vectors. 

	The mean Keplerian elements are SGP4's Brouwer mean motion not SGP's Kozai mean motion. 

	:param int yr: 2 or 4 digit year of the epoch time
	:param float day: Day of year of the epoch time.
	:param float[3] pos: Input osculating position vector (km). (double[3])
	:param float[3] vel: Input osculating velocity vector (km/s). (double[3])
	:return:
		- **retcode** (*int*) - 0 if the conversion is successful, non-0 if there is an error.
		- **posNew** (*float[3]*) - Resulting position vector (km) propagated from the sgp4MeanKep. (double[3])
		- **velNew** (*float[3]*) - Resulting velocity vector (km/s) propagated from the sgp4MeanKep. (double[3])
		- **sgp4MeanKep** (*float[6]*) - Resulting set of Sgp4 mean Keplerian elements. (double[6])
	"""
    yr = c.c_int32(yr)
    day = c.c_double(day)
    pos = settings.list_to_array(pos)
    vel = settings.list_to_array(vel)
    posNew = settings.double3()
    velNew = settings.double3()
    sgp4MeanKep = settings.double6()
    retcode = C_SGP4DLL.Sgp4PosVelToKep(yr, day, pos, vel, posNew, velNew,
                                        sgp4MeanKep)
    posNew = settings.array_to_list(posNew)
    velNew = settings.array_to_list(velNew)
    return (retcode, posNew, velNew, sgp4MeanKep)
Esempio n. 5
0
def PosVelToEqnx(pos, vel):
    """
	Converts position and velocity vectors to a set of equinoctial elements. 
	
	:param float[3] pos: The position vector to be converted. (double[3])
	:param float[3] vel: The velocity vector to be converted. (double[3])
	:return:
		 **metricEqnx** (*float[6]*) - The resulting set of equinoctial elements. (double[6])
	"""
    pos = settings.list_to_array(pos)
    vel = settings.list_to_array(vel)
    metricEqnx = settings.double6()
    C_ASTRODLL.PosVelToEqnx(pos, vel, metricEqnx)
    metricEqnx = settings.array_to_list(metricEqnx)
    return metricEqnx
Esempio n. 6
0
def PosVelToKep(pos, vel):
    """
	Converts osculating position and velocity vectors to a set of osculating Keplerian elements. 
	
	:param float[3] pos: The position vector to be converted. (double[3])
	:param float[3] vel: The velocity vector to be converted. (double[3])
	:return:
		**metricKep** (*float[6]*) - The resulting set of Keplerian elements. (double[6])
	"""
    pos = settings.list_to_array(pos)
    vel = settings.list_to_array(vel)
    metricKep = settings.double6()
    C_ASTRODLL.PosVelToKep(pos, vel, metricKep)
    metricKep = settings.array_to_list(metricKep)
    return metricKep
Esempio n. 7
0
def RAEToECI(theta, astroLat, xa_rae):
    """
	Converts full state RAE (range, az, el, and their rates) to full state ECI (position and velocity)

	:param float theta: Theta - local sidereal time(rad).
	:param float astroLat: Astronomical latitude (ded).
	:param float[6] xa_rae: An array contains input data. The data at each index is listed below. (double[6])

		- [0]: Range (km) 
		- [1]: Azimuth (deg) 
		- [2]: Elevation (deg) 
		- [3]: Range Dot (km/s) 
		- [4]: Azimuth Dot (deg/s) 
		- [5]: Elevation Dot (deg/s) 
	
	:return:
		- **senPos** (*float[3]*) - Sensor position in ECI (km). (double[3])
		- **satPos** (*float[3]*) - Satellite position in ECI (km). (double[3])
		- **satVel** (*float[3]*) - Satellite velocity in ECI (km/s). (double[3])
	"""
    theta = c.c_double(theta)
    astroLat = c.c_double(astroLat)
    xa_rae = settings.list_to_array(xa_rae)
    senPos = settings.double3()
    satPos = settings.double3()
    satVel = settings.double3()
    C_ASTRODLL.RAEToECI(theta, astroLat, xa_rae, senPos, satPos, satVel)
    senPos = settings.array_to_list(senPos)
    satPos = settings.array_to_list(satPos)
    satVel = settings.array_to_list(satVel)
    return (senPos, satPos, satVel)
Esempio n. 8
0
def SolveKepEqtn(metricKep):
    """
	Solves Kepler's equation (M = E - e sin(E)) for the eccentric anomaly, E, by iteration. 
	
	:param float[6] metricKep: The set of Keplerian elements for which to solve the equation. (double[6])
	:return:
		**E** (*float*) - The eccentric anomaly "E"
	"""
    metricKep = settings.list_to_array(metricKep)
    E = C_ASTRODLL.SolveKepEqtn(metricKep)
    return E
Esempio n. 9
0
def EFGToECI(thetaG, posEFG, velEFG):
    """
	Converts EFG position and velocity vectors to ECI position and velocity vectors. 
	
	:param float thetaG: Theta - Greenwich mean sidereal time (rad).
	:param float[3] posEFG: The EFG position vector (km) to be converted. (double[3])
	:param float[3] velEFG: The EFG velocity vector (km/s) to be converted. (double[3])
	:return:
		- **posECI** (*float[3]*) - The resulting ECI (TEME of Date) position vector (km). (double[3])
		- **velECI** (*float[3]*) - The resulting ECI (TEME of Date) velocity vector (km/s). (double[3])
	"""
    thetaG = c.c_double(thetaG)
    posEFG = settings.list_to_array(posEFG)
    velEFG = settings.list_to_array(velEFG)
    posECI = settings.double3()
    velECI = settings.double3()
    C_ASTRODLL.EFGToECI(thetaG, posEFG, velEFG, posECI, velECI)
    posECI = settings.array_to_list(posECI)
    velECI = settings.array_to_list(velECI)
    return (posECI, velECI)
Esempio n. 10
0
def CompTrueAnomaly(metricKep):
    """
	Computes true anomaly from a set of Keplerian elements. 

	:param float[6] metricKep: The set of Keplerian elements for which to compute true anomaly. (double[6])
	:return:
		**true_anomaly** (*float*) - The true anomaly in degrees.
	"""
    metricKep = settings.list_to_array(metricKep)
    true_anomaly = C_ASTRODLL.CompTrueAnomaly(metricKep)
    return true_anomaly
Esempio n. 11
0
def LLHToEFGPos(metricLLH):
    """
	Converts geodetic latitude, longitude, and height to an EFG position vector.
	
	:param float[3] metricLLH: An Array containing the geodetic north latitude (degree), east longitude (degree), and height (km) to be converted. (double[3])
	:return:
		**posEFG** (*float[3]*) - The resulting EFG position vector (km). (double[3])
	"""
    metricLLH = settings.list_to_array(metricLLH)
    posEFG = settings.double3()
    C_ASTRODLL.LLHToEFGPos(metricLLH, posEFG)
    posEFG = settings.array_to_list(posEFG)
    return posEFG
Esempio n. 12
0
def KepToEqnx(metricKep):
    """
	Converts a set of Keplerian elements to a set of equinoctial elements. 
	
	:param float[6] metricKep: The set of Keplerian elements to be converted. (double[6])
	:return:
		**metricEqnx** (*float[6]*) - The resulting set of equinoctial elements. (double[6])
	"""
    metricKep = settings.list_to_array(metricKep)
    metricEqnx = settings.double6()
    C_ASTRODLL.KepToEqnx(metricKep, metricEqnx)
    metricEqnx = settings.array_to_list(metricEqnx)
    return metricEqnx
Esempio n. 13
0
def KepOscToMean(metricOscKep):
    """
	Converts a set of osculating Keplerian elements to a set of mean Keplerian elements using method 9 algorithm. 
	
	:param float[6] metricOscKep: The set of osculating Keplerian elements to be converted. (double[6])
	:return:
		**metricMeanKep** (*float[6]*) - The resulting set of mean Keplerian elements. (double[6])
	"""
    metricOscKep = settings.list_to_array(metricOscKep)
    metricMeanKep = settings.double6()
    C_ASTRODLL.KepOscToMean(metricOscKep, metricMeanKep)
    metricMeanKep = settings.array_to_list(metricMeanKep)
    return metricMeanKep
Esempio n. 14
0
def EFGToECR(polarX, polarY, posEFG, velEFG):
    """
	Converts EFG position and velocity vectors to ECR position and velocity vectors.

	:param float polarX: Polar motion X (arc-sec).
	:param float polarY: Polar motion Y (arc-sec).
	:param float[3] posEFG: The EFG position vector (km) to be converted. (double[3])
	:param float[3] velEFG: The EFG velocity vector (km/s) to be converted. (double[3])
	:return:
		- **posECR** (*float[3]*) - The resulting ECR position vector (km). (double[3])
		- **velECR** (*float[3]*) - The resulting ECR velocity vector (km/s). (double[3])
	"""
    polarX = c.c_double(polarX)
    polarY = c.c_double(polarY)
    posEFG = settings.list_to_array(posEFG)
    velEFG = settings.list_to_array(velEFG)
    posECR = settings.double3()
    velECR = settings.double3()
    C_ASTRODLL.EFGToECR(polarX, polarY, posEFG, velEFG, posECR, velECR)
    posECR = settings.array_to_list(posECR)
    velECR = settings.array_to_list(velECR)
    return (posECR, velECR)
Esempio n. 15
0
def EFGPosToLLH(posEFG):
    """
	Converts an EFG position vector to geodetic latitude, longitude, and height. 
	
	:param float[3] posEFG: The EFG position vector (km) to be converted. (double[3])
	:return:
		**metricLLH** (*float[3]*) - The resulting geodetic north latitude (degree), east longitude (degree), and height (km). (double[3])
	"""
    posEFG = settings.list_to_array(posEFG)
    metricLLH = settings.double3()
    C_ASTRODLL.EFGPosToLLH(posEFG, metricLLH)
    metricLLH = settings.array_to_list(metricLLH)
    return metricLLH
Esempio n. 16
0
def EqnxToKep(metricEqnx):
    """
	Converts a set of equinoctial elements to a set of classical elements
	
	TODO: Determine and document vector sequence
	
	:param float[6] metricEqnx: The set of equinoctial elements to be converted. (double[6])
	:return:
		**metricClass** (*float[6]*) - The resulting set of classical elements. (double[6])
	"""
    metricEqnx = settings.list_to_array(metricEqnx)
    metricKep = settings.double6()
    C_ASTRODLL.EqnxToKep(metricEqnx, metricKep)
    metricKep = settings.array_to_list(metricKep)
    return metricKep
Esempio n. 17
0
def LLHToXYZ(thetaG, metricLLH):
    """
	Converts geodetic latitude, longitude, and height to an ECI position vector XYZ. 
	
	:param float thetaG: Theta - Greenwich mean sidereal time (rad).
	:param float[3] metric LLH: An array containing geodetic north latitude (degree), east longitude (degree), and height (km) to be converted. (double[3])
	:return:
		**metricXYZ** (*float[3]*) - The resulting ECI (TEME of Date) position vector (km). (double[3])
	"""
    thetaG = c.c_double(thetaG)
    metricLLH = settings.list_to_array(metricLLH)
    metricXYZ = settings.double3()
    C_ASTRODLL.LLHToXYZ(thetaG, metricLLH, metricXYZ)
    metricXYZ = settings.array_to_list(metricXYZ)
    return metricXYZ
Esempio n. 18
0
def XYZToLLH(thetaG, metricPos):
    """
	Converts an ECI position vector XYZ to geodetic latitude, longitude, and height. 
	
	:param float thetaG: ThetaG - Greenwich mean sidereal time (rad).
	:param float[3] metricPos: The ECI (TEME of Date) position vector (km) to be converted. (double[3])
	:return:
		**metricLLH** (*float[3]*) - The resulting geodetic north latitude (degree), east longitude(degree), and height (km). (double[3])
	"""
    thetaG = c.c_double(thetaG)
    metricPos = settings.list_to_array(metricPos)
    metricLLH = settings.double3()
    C_ASTRODLL.XYZToLLH(thetaG, metricPos, metricLLH)
    metricLLH = settings.array_to_list(metricLLH)
    return metricLLH
Esempio n. 19
0
def KepToPosVel(metricKep):
    """
	Converts a set of osculating Keplerian elements to osculating position and velocity vectors. 
	
	:param float[6] metricKep: The set of Keplerian elements to be converted. (double[6])
	:return:
		- **pos** (*float[3]*) - The resulting position vector. (double[3])
		- **vel** (*float[3]*) - The resulting velocity vector. (double[3])
	"""
    metricKep = settings.list_to_array(metricKep)
    pos = settings.double3()
    vel = settings.double3()
    C_ASTRODLL.KepToPosVel(metricKep, pos, vel)
    pos = settings.array_to_list(pos)
    vel = settings.array_to_list(vel)
    return (pos, vel)
Esempio n. 20
0
def IsPointSunlit(ds50ET, ptEci):
    """
	Determines if a point in space is sunlit at the input time ds50ET 
	
	:param float ds50ET: The number of days since 1950, ET for which to determine if the point is sunlit.
	:param float ptEci: a position in ECI (km). (double[3])
	:return:
		**retcode** (*int*) - 0 if unlit, 1 if lit, possibly other values on error (undocumented)
	"""
    raise exceptions.KnownFault(
        "IsPointSunlit method always returns 1, whether that is correct or not. This issue is under investigation but will not be resolved soon."
    )
    ds50ET = c.c_double(ds50ET)
    ptEci = settings.list_to_array(ptEci)
    retcode = C_ASTRODLL.IsPointSunlit(ds50ET, ptEci)
    return retcode
Esempio n. 21
0
def EqnxToPosVel(metricEqnx):
    """
	Converts a set of equinoctial elements to position and velocity vectors. 
	
	:param float[6] metricEqnx: The set of equinoctial elements to be converted. (double[6])
	:return:
		- **pos** (*float[3]*) - The resulting position vector. (double[3])
		- **vel** (*float[3]*) - The resulting velocity vector. (double[3])
	"""
    metricEqnx = settings.list_to_array(metricEqnx)
    pos = settings.double3()
    vel = settings.double3()
    C_ASTRODLL.EqnxToPosVel(metricEqnx, pos, vel)
    pos = settings.array_to_list(pos)
    vel = settings.array_to_list(vel)
    return (pos, vel)
Esempio n. 22
0
def KepToUVW(metricKep):
    """
	Converts a set of Keplerian elements to Ubar, Vbar, and Wbar vectors. 
	
	:param float[6] metricKep: The set of Keplerian elements to be converted. (double[6])
	:return:
		- **uBar** (*float[3]*) - The resulting ubar vector. (double[3])
		- **vBar** (*float[3]*) - The resulting vbar vector. (double[3])
		- **wBar** (*float[3]*) - The resulting wbar vector. (double[3])
	"""
    metricKep = settings.list_to_array(metricKep)
    uBar = settings.double3()
    vBar = settings.double3()
    wBar = settings.double3()
    C_ASTRODLL.KepToUVW(metricKep, uBar, vBar, wBar)
    uBar = settings.array_to_list(uBar)
    vBar = settings.array_to_list(vBar)
    wBar = settings.array_to_list(wBar)
    return (uBar, vBar, wBar)
Esempio n. 23
0
 def test_list_to_array(self):
     li1 = [1.1, 2.2, 3.3]
     ar1 = settings.list_to_array(li1)
     li2 = [1, 2, 3]
     ar2 = settings.list_to_array(li2, c.c_int)