本文整理汇总了Python中ephemeris.Ephemeris.getPlanetaryInfo方法的典型用法代码示例。如果您正苦于以下问题:Python Ephemeris.getPlanetaryInfo方法的具体用法?Python Ephemeris.getPlanetaryInfo怎么用?Python Ephemeris.getPlanetaryInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ephemeris.Ephemeris
的用法示例。
在下文中一共展示了Ephemeris.getPlanetaryInfo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPlanetsForDatetimeAndTimezone
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
def getPlanetsForDatetimeAndTimezone(dt, locTuple):
"""Returns a string with the planet longitude position for the given
datetime and timezone.
"""
locName = locTuple[0]
locLongitude = locTuple[1]
locLatitude = locTuple[2]
locElevation = locTuple[3]
# Set the Location (required).
Ephemeris.setGeographicPosition(locLongitude,
locLatitude,
locElevation)
longitudeType = "tropical"
fieldName = "longitude"
rv = "For datetime: " + Ephemeris.datetimeToDayStr(dt) + \
", location: " + locName + endl
for planetName in geocentricPlanetNames:
pi = Ephemeris.getPlanetaryInfo(planetName, dt)
longitude = pi.geocentric[longitudeType][fieldName]
# Format differently for lunation phase of G.MoSu.
if planetName == "MoSu":
rv += " {: <14}".format("G." + planetName + ": ") + \
"{:>.3f}".format(longitude) + \
" Phase (of max 30): {:.2f}".format(longitude / 12.0) + \
endl
else:
rv += " {: <14}".format("G." + planetName + ": ") + \
"{:>.3f}".format(longitude) + \
endl
rv += endl
for planetName in heliocentricPlanetNames:
pi = Ephemeris.getPlanetaryInfo(planetName, dt)
rv += " {: <14}".format("H." + planetName + ": ") + \
"{:>.3f}".format(pi.heliocentric[longitudeType][fieldName]) + \
endl
return rv
示例2: getFieldValue
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
def getFieldValue(dt, planetParams, fieldName):
"""Creates the PlanetaryInfo object for the given
planetParamsList and returns the value of the field
desired.
"""
log.debug("planetParams passed in is: {}".\
format(planetParams))
t = planetParams
planetName = t[0]
centricityType = t[1]
longitudeType = t[2]
pi = Ephemeris.getPlanetaryInfo(planetName, dt)
log.debug("Planet {} has geo sid longitude: {}".\
format(planetName,
pi.geocentric["sidereal"]["longitude"]))
fieldValue = None
if centricityType.lower() == "geocentric":
fieldValue = pi.geocentric[longitudeType][fieldName]
elif centricityType.lower() == "topocentric":
fieldValue = pi.topocentric[longitudeType][fieldName]
elif centricityType.lower() == "heliocentric":
fieldValue = pi.heliocentric[longitudeType][fieldName]
else:
log.error("Unknown centricity type: {}".\
format(centricityType))
fieldValue = None
return fieldValue
示例3: getGeocentricPlanetDirectRetrogradeInfo
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
def getGeocentricPlanetDirectRetrogradeInfo(planetName):
"""
Returns a list of tuples, each tuple containing:
(planetName,
julianDay,
datetime,
"R" or "D",
geoTropLongitudeOfPlanet,
geoSidLongitudeOfPlanet)
"""
# Return value.
rv = []
prevDt = None
currDt = copy.deepcopy(startDt)
prevTropLongitudeSpeed = None
currTropLongitudeSpeed = None
currTropLongitude = None
currSidLongitude = None
while currDt <= endDt:
dt = currDt
pi = Ephemeris.getPlanetaryInfo(planetName, dt)
log.debug("Just obtained planetaryInfo for planet '{}', timestamp: {}".\
format(planetName, Ephemeris.datetimeToStr(dt)))
# Get the geocentric longitude and geocentric longitude speed.
tropLongitudeSpeed = pi.geocentric['tropical']['longitude_speed']
tropLongitude = pi.geocentric['tropical']['longitude']
sidLongitude = pi.geocentric['sidereal']['longitude']
# Store new current planet values.
currTropLongitudeSpeed = tropLongitudeSpeed
currTropLongitude = tropLongitude
currSidLongitude = sidLongitude
log.debug("prevTropLongitudeSpeed={}, currTropLongitudeSpeed={}".\
format(prevTropLongitudeSpeed, currTropLongitudeSpeed))
# We need two data points to proceed.
if prevTropLongitudeSpeed != None and \
currTropLongitudeSpeed != None and \
prevDt != None:
# Check to see if we passed over 0 degrees.
if prevTropLongitudeSpeed < 0.0 and currTropLongitudeSpeed >= 0.0:
# Crossed over from negative to positive!
log.debug("Crossed over from negative to positive!")
# This is the upper-bound of the error timedelta.
t1 = prevDt
t2 = currDt
currErrorTd = t2 - t1
# Refine the timestamp until it is less than the
# desired threshold.
while currErrorTd > maxErrorTd:
log.debug("Refining between {} and {}".\
format(Ephemeris.datetimeToStr(t1),
Ephemeris.datetimeToStr(t2)))
# Check the timestamp between.
diffTd = t2 - t1
halfDiffTd = \
datetime.\
timedelta(days=(diffTd.days / 2.0),
seconds=(diffTd.seconds / 2.0),
microseconds=(diffTd.microseconds / 2.0))
testDt = t1 + halfDiffTd
pi = Ephemeris.getPlanetaryInfo(planetName, testDt)
testTropLongitudeSpeed = \
pi.geocentric['tropical']['longitude_speed']
testTropLongitude = pi.geocentric['tropical']['longitude']
testSidLongitude = pi.geocentric['sidereal']['longitude']
if testTropLongitudeSpeed >= 0.0:
t2 = testDt
# Update the curr values as the later boundary.
currDt = t2
currTropLongitudeSpeed = testTropLongitudeSpeed
currTropLongitude = testTropLongitude
currSidLongitude = testSidLongitude
else:
t1 = testDt
currErrorTd = t2 - t1
# Broke out of while loop, meaning we have a timestamp
# within our threshold.
# Create a tuple to add to our list.
tup = (planetName,
#.........这里部分代码省略.........
示例4: format
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
currDt = startDt
prevDt = None
while currDt < endDt:
# See if this is a new month.
if prevDt == None or prevDt.month != currDt.month:
log.info("Processing: {} {}".\
format(Util.monthNumberToAbbrev(currDt.month), currDt.year))
# Add the text for a new table.
text += getTableHeaderText(currDt)
planetaryInfosDict = {}
for planetName in planetNames:
pi = Ephemeris.getPlanetaryInfo(planetName, currDt)
planetaryInfosDict[planetName] = pi
dateStr = formatToDateStr(currDt)
# Add text for a row in the table.
text += convertPlanetaryInfosToLine(dateStr, planetaryInfosDict)
# Prepare currDt for the next iteration.
prevDt = currDt
currDt = copy.deepcopy(currDt) + datetime.timedelta(days=1)
currDt = currDt.replace(hour=hourOfDay, minute=minuteOfHour)
if prevDt.month != currDt.month:
# Month passed. Close the table.
text += getTableFooterText()
示例5:
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
# - planetName1TropicalLongitude_ZodiacSignFormat
# - planetName2TropicalLongitude_ZodiacSignFormat
# - planetName1TropicalLongitudeLongitudeSpeed
# - planetName2TropicalLongitudeLongitudeSpeed
# - planetName1SiderealLongitude_Degrees
# - planetName2SiderealLongitude_Degrees
# - planetName1SiderealLongitude_ZodiacSignFormat
# - planetName2SiderealLongitude_ZodiacSignFormat
# - planetName1SiderealLongitudeLongitudeSpeed
# - planetName2SiderealLongitudeLongitudeSpeed
resultList = []
# Create a tuple for each timestamp that was found
# that was a conjunction.
for dt in conjunctionTimestamps:
pi1 = Ephemeris.getPlanetaryInfo(planetName1, dt)
pi2 = Ephemeris.getPlanetaryInfo(planetName2, dt)
tup = (comboPlanetName,
Ephemeris.datetimeToJulianDay(dt),
dt,
desiredAspectDegree,
pi1.heliocentric["tropical"]["longitude"],
pi2.heliocentric["tropical"]["longitude"],
pi1.heliocentric["tropical"]["longitude_speed"],
pi2.heliocentric["tropical"]["longitude_speed"],
pi1.heliocentric["sidereal"]["longitude"],
pi2.heliocentric["sidereal"]["longitude"],
pi1.heliocentric["sidereal"]["longitude_speed"],
pi2.heliocentric["sidereal"]["longitude_speed"])
示例6: getLongitudeDiffBetweenDatetimes
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import getPlanetaryInfo [as 别名]
#.........这里部分代码省略.........
#
# Here we will set it to 1 day for the default case,
# but if the planet name is a house cusp then shrink
# the step size so we will get the correct resolution.
# Also, if the planet name is an outer planet with a
# large period, we can increase the step size slightly
# to improve performance.
stepSizeTd = datetime.timedelta(days=1)
if Ephemeris.isHouseCuspPlanetName(planetName) or \
Ephemeris.isAscmcPlanetName(planetName):
stepSizeTd = datetime.timedelta(hours=1)
elif planetName == "Jupiter" or \
planetName == "Saturn" or \
planetName == "Neptune" or \
planetName == "Uranus" or \
planetName == "Pluto":
stepSizeTd = datetime.timedelta(days=5)
log.debug("Stepping through from {} to {} ...".\
format(Ephemeris.datetimeToStr(startTimestamp),
Ephemeris.datetimeToStr(endTimestamp)))
# Current datetime as we step through all the
# timestamps between the start and end timestamp.
currDt = copy.deepcopy(startTimestamp)
# Step through the timestamps, calculating the planet positions.
while currDt < endTimestamp:
p = Ephemeris.getPlanetaryInfo(planetName, currDt)
planetData.append(p)
# Increment step size.
currDt += stepSizeTd
# We must also append the planet calculation for the end timestamp.
Ephemeris.setGeographicPosition(loc2Longitude,
loc2Latitude,
loc2Elevation)
p = Ephemeris.getPlanetaryInfo(planetName, endTimestamp)
planetData.append(p)
# Geocentric measurement.
if centricityType == "geocentric":
# Get the PlanetaryInfos for the timestamps of the
# planet at the moment right after the
# longitude_speed polarity changes.
additionalPlanetaryInfos = []
prevLongitudeSpeed = None
for i in range(len(planetData)):
currLongitudeSpeed = \
planetData[i].geocentric[zodiacTypeForLongitudeSpeed]['longitude_speed']
if prevLongitudeSpeed != None and \
((prevLongitudeSpeed < 0 and currLongitudeSpeed >= 0) or \
(prevLongitudeSpeed >= 0 and currLongitudeSpeed < 0)):
# Polarity changed.
# Try to narrow down the exact moment in