本文整理汇总了Python中ephemeris.Ephemeris.setGeographicPosition方法的典型用法代码示例。如果您正苦于以下问题:Python Ephemeris.setGeographicPosition方法的具体用法?Python Ephemeris.setGeographicPosition怎么用?Python Ephemeris.setGeographicPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ephemeris.Ephemeris
的用法示例。
在下文中一共展示了Ephemeris.setGeographicPosition方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getPlanetsForDatetimeAndTimezone
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [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: format
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
log.debug("prevTropLongitudeSpeed={}, currTropLongitudeSpeed={}".\
format(prevTropLongitudeSpeed, currTropLongitudeSpeed))
return rv
##############################################################################
if __name__ == "__main__":
# Initialize Ephemeris (required).
Ephemeris.initialize()
# Set the Location (required).
Ephemeris.setGeographicPosition(locationLongitude,
locationLatitude,
locationElevation)
# Dictionary of results computed.
results = {}
for planetName in geocentricPlanetNames:
log.info("Obtaining planet retrograde and direct information for " + \
"'{}' ...".format(planetName))
results[planetName] = \
getGeocentricPlanetDirectRetrogradeInfo(planetName)
# Print out results.
headerLine = \
"Planet Name," + \
"Julian Day," + \
示例3: getPlanetaryInfosForDatetime
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
def getPlanetaryInfosForDatetime(dt):
"""Helper function for getting a list of PlanetaryInfo objects
to display in the astrology chart.
"""
# Set the location again (required).
Ephemeris.setGeographicPosition(locationLongitude,
locationLatitude,
locationElevation)
# Get planetary info for all the planets.
planets = []
# Astrological house system for getting the house cusps.
houseSystem = Ephemeris.HouseSys['Porphyry']
planets.append(Ephemeris.getH1PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH2PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH3PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH4PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH5PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH6PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH7PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH8PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH9PlanetaryInfo(dt, houseSystem))
planets.append(Ephemeris.getH10PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH11PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getH12PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getARMCPlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getVertexPlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getEquatorialAscendantPlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getCoAscendant1PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getCoAscendant2PlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getPolarAscendantPlanetaryInfo(dt, houseSystem))
#planets.append(Ephemeris.getHoraLagnaPlanetaryInfo(dt))
#planets.append(Ephemeris.getGhatiLagnaPlanetaryInfo(dt))
#planets.append(Ephemeris.getMeanLunarApogeePlanetaryInfo(dt))
#planets.append(Ephemeris.getOsculatingLunarApogeePlanetaryInfo(dt))
#planets.append(Ephemeris.getInterpolatedLunarApogeePlanetaryInfo(dt))
#planets.append(Ephemeris.getInterpolatedLunarPerigeePlanetaryInfo(dt))
planets.append(Ephemeris.getSunPlanetaryInfo(dt))
planets.append(Ephemeris.getMoonPlanetaryInfo(dt))
planets.append(Ephemeris.getMercuryPlanetaryInfo(dt))
planets.append(Ephemeris.getVenusPlanetaryInfo(dt))
planets.append(Ephemeris.getEarthPlanetaryInfo(dt))
planets.append(Ephemeris.getMarsPlanetaryInfo(dt))
planets.append(Ephemeris.getJupiterPlanetaryInfo(dt))
planets.append(Ephemeris.getSaturnPlanetaryInfo(dt))
planets.append(Ephemeris.getUranusPlanetaryInfo(dt))
planets.append(Ephemeris.getNeptunePlanetaryInfo(dt))
planets.append(Ephemeris.getPlutoPlanetaryInfo(dt))
planets.append(Ephemeris.getMeanNorthNodePlanetaryInfo(dt))
#planets.append(Ephemeris.getTrueSouthNodePlanetaryInfo(dt))
planets.append(Ephemeris.getTrueNorthNodePlanetaryInfo(dt))
#planets.append(Ephemeris.getTrueSouthNodePlanetaryInfo(dt))
#planets.append(Ephemeris.getCeresPlanetaryInfo(dt))
#planets.append(Ephemeris.getPallasPlanetaryInfo(dt))
#planets.append(Ephemeris.getJunoPlanetaryInfo(dt))
#planets.append(Ephemeris.getVestaPlanetaryInfo(dt))
planets.append(Ephemeris.getIsisPlanetaryInfo(dt))
#planets.append(Ephemeris.getNibiruPlanetaryInfo(dt))
planets.append(Ephemeris.getChironPlanetaryInfo(dt))
#planets.append(Ephemeris.getGulikaPlanetaryInfo(dt))
#planets.append(Ephemeris.getMandiPlanetaryInfo(dt))
#planets.append(Ephemeris.getMeanOfFivePlanetaryInfo(dt))
#planets.append(Ephemeris.getCycleOfEightPlanetaryInfo(dt))
#planets.append(Ephemeris.getAvgMaJuSaUrNePlPlanetaryInfo(dt))
#planets.append(Ephemeris.getAvgJuSaUrNePlanetaryInfo(dt))
#planets.append(Ephemeris.getAvgJuSaPlanetaryInfo(dt))
return planets
示例4: getLongitudeAspectTimestamps
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
#.........这里部分代码省略.........
for planetTuple in planet1ParamsList + planet2ParamsList:
if len(planetTuple) != 3:
log.error("Input error: " + \
"Not enough values given in planet tuple.")
return None
planetName = planetTuple[0]
centricityType = planetTuple[1]
longitudeType = planetTuple[2]
loweredCentricityType = centricityType.lower()
if loweredCentricityType != "geocentric" and \
loweredCentricityType != "topocentric" and \
loweredCentricityType != "heliocentric":
log.error("Invalid input: Centricity type is invalid. " + \
"Value given was: {}".format(centricityType))
return None
# Check inputs for longitude type.
loweredLongitudeType = longitudeType.lower()
if loweredLongitudeType != "tropical" and \
loweredLongitudeType != "sidereal":
log.error("Invalid input: Longitude type is invalid. " + \
"Value given was: {}".format(longitudeType))
return None
# Field name we are getting.
fieldName = "longitude"
# Initialize the Ephemeris with the birth location.
log.debug("Setting ephemeris location ...")
Ephemeris.setGeographicPosition(locationLongitude,
locationLatitude,
locationElevation)
# Set the step size.
stepSizeTd = datetime.timedelta(days=1)
for planetTuple in planet1ParamsList + planet2ParamsList:
planetName = planetTuple[0]
if Ephemeris.isHouseCuspPlanetName(planetName) or \
Ephemeris.isAscmcPlanetName(planetName):
# House cusps and ascmc planets need a smaller step size.
stepSizeTd = datetime.timedelta(hours=1)
elif planetName == "Moon":
# Use a smaller step size for the moon so we can catch
# smaller aspect sizes.
stepSizeTd = datetime.timedelta(hours=3)
log.debug("Step size is: {}".format(stepSizeTd))
# Desired angles. We need to check for planets at these angles.
desiredAngleDegList = []
desiredAngleDeg1 = Util.toNormalizedAngle(degreeDifference)
desiredAngleDegList.append(desiredAngleDeg1)
if Util.fuzzyIsEqual(desiredAngleDeg1, 0):
desiredAngleDegList.append(360)
if uniDirectionalAspectsFlag == False:
desiredAngleDeg2 = \
360 - Util.toNormalizedAngle(degreeDifference)
if desiredAngleDeg2 not in desiredAngleDegList:
示例5: getLongitudeDiffBetweenDatetimes
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
def getLongitudeDiffBetweenDatetimes(planetName,
centricityType,
dt1,
loc1Tuple,
dt2,
loc2Tuple):
startTimestamp = dt1
endTimestamp = dt2
loc1Name = loc1Tuple[0]
loc1Longitude = loc1Tuple[1]
loc1Latitude = loc1Tuple[2]
loc1Elevation = loc1Tuple[3]
loc2Name = loc2Tuple[0]
loc2Longitude = loc2Tuple[1]
loc2Latitude = loc2Tuple[2]
loc2Elevation = loc2Tuple[3]
# maxErrorTd - datetime.timedelta object holding the maximum
# time difference between the exact planetary
# timestamp for the phenomena, and the one
# calculated. This would define the accuracy of
# the calculations.
#
maxErrorTd = datetime.timedelta(seconds=4)
# Size of a circle, in degrees.
#
# Here we define our own value instead of using the value in
# AstrologyUtils.degreesInCircle because it is possible we may
# want to test different sizes of a 'circle'.
circleSizeInDegrees = 360.0
# All references to longitude_speed need to
# be from tropical zodiac measurements! If I use
# sidereal zodiac measurements for getting the
# longitude_speed, then the measurements from the
# Swiss Ephemeris do not yield the correct values.
# I use the following variable in these locations.
zodiacTypeForLongitudeSpeed = "tropical"
tropicalZodiacFlag = True
# Text to set in the text item.
text = ""
# Total number of degrees elapsed.
totalDegrees = 0
Ephemeris.setGeographicPosition(loc1Longitude,
loc1Latitude,
loc1Elevation)
# List of PlanetaryInfo objects for this particular
# planet, sorted by timestamp.
planetData = []
# Step size to use in populating the data list with
# PlanetaryInfos.
#
# The step size should cause the planet to move less
# than 120 degrees in all cases, and idealy much less
# than this, that way we can easily narrow down when
# the planet passes the 0 degree or 360 degree
# threshold, and also so it is easier to narrow down
# when retrograde periods happen. If the step size is
# too large, it is possible that we would miss a whole
# time window of retrograde movement, so discretion
# has to be used in determining what to use for this value.
#
# 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
#.........这里部分代码省略.........
示例6: getOnePlanetLongitudeAspectTimestamps
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
#.........这里部分代码省略.........
format(planet1Params))
log.debug("fixedDegree passed in is: {}".\
format(fixedDegree))
# Check inputs of planet parameters.
planetName = planet1Params[0]
centricityType = planet1Params[1]
longitudeType = planet1Params[2]
# Check inputs for centricity type.
loweredCentricityType = centricityType.lower()
if loweredCentricityType != "geocentric" and \
loweredCentricityType != "topocentric" and \
loweredCentricityType != "heliocentric":
log.error("Invalid input: Centricity type is invalid. " + \
"Value given was: {}".format(centricityType))
return None
# Check inputs for longitude type.
loweredLongitudeType = longitudeType.lower()
if loweredLongitudeType != "tropical" and \
loweredLongitudeType != "sidereal":
log.error("Invalid input: Longitude type is invalid. " + \
"Value given was: {}".format(longitudeType))
return None
# Field name we are getting.
fieldName = "longitude"
# Initialize the Ephemeris with the birth location.
log.debug("Setting ephemeris location ...")
Ephemeris.setGeographicPosition(locationLongitude,
locationLatitude,
locationElevation)
# Set the step size.
stepSizeTd = datetime.timedelta(days=1)
planetName = planet1Params[0]
if Ephemeris.isHouseCuspPlanetName(planetName) or \
Ephemeris.isAscmcPlanetName(planetName):
# House cusps and ascmc planets need a smaller step size.
stepSizeTd = datetime.timedelta(hours=1)
elif planetName == "Moon":
# Use a smaller step size for the moon so we can catch
# smaller aspect sizes.
stepSizeTd = datetime.timedelta(hours=3)
log.debug("Step size is: {}".format(stepSizeTd))
# Desired angles. We need to check for planets at these angles.
desiredAngleDegList = []
desiredAngleDeg1 = Util.toNormalizedAngle(degreeDifference)
desiredAngleDegList.append(desiredAngleDeg1)
if Util.fuzzyIsEqual(desiredAngleDeg1, 0):
desiredAngleDegList.append(360)
if uniDirectionalAspectsFlag == False:
desiredAngleDeg2 = \
360 - Util.toNormalizedAngle(degreeDifference)
if desiredAngleDeg2 not in desiredAngleDegList:
示例7: Ephemeris
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import setGeographicPosition [as 别名]
from ephemeris import Ephemeris
# Initialize logging.
LOG_CONFIG_FILE = os.path.join(sys.path[0], "../conf/logging.conf")
logging.config.fileConfig(LOG_CONFIG_FILE)
#logging.disable(logging.CRITICAL)
# Initialize the Ephemeris (required).
Ephemeris.initialize()
# New York City:
lon = -74.0064
lat = 40.7142
# Set a default location (required).
Ephemeris.setGeographicPosition(lon, lat)
# Create the Qt application.
#app = QApplication(sys.argv)
# Various tests to run:
def runTests():
testLookbackMultipleParallel_speedTestParallel()
testLookbackMultipleParallel_speedTestSerial()
#startTime = time.time()
runTests()
#endTime = time.time()
#print("")