本文整理汇总了Python中ephemeris.Ephemeris.initialize方法的典型用法代码示例。如果您正苦于以下问题:Python Ephemeris.initialize方法的具体用法?Python Ephemeris.initialize怎么用?Python Ephemeris.initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ephemeris.Ephemeris
的用法示例。
在下文中一共展示了Ephemeris.initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shutdown
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import initialize [as 别名]
shutdown(1)
else:
log.debug("options.outputPcdFile == {}".format(options.outputPcdFile))
outputPcdFile = os.path.abspath(options.outputPcdFile)
log.debug("outputPcdFile == {}".format(outputPcdFile))
if os.path.exists(outputPcdFile) and os.path.isfile(outputPcdFile):
log.debug("The outputPcdFile path exists, and it is a file.")
else:
log.error("The output PCD file either does not exist or is not a file.")
shutdown(1)
##############################################################################
# Initialize Ephemeris (required).
Ephemeris.initialize()
# Set application details so the we can use QSettings default
# constructor later.
appAuthor = "Ryan Luu"
appName = "PriceChartingTool"
QCoreApplication.setOrganizationName(appAuthor)
QCoreApplication.setApplicationName(appName)
# Create the Qt application.
app = QApplication(sys.argv)
app.setApplicationName(appName)
# Open the input PriceChartDocument files.
log.info("Loading input template PriceChartDocument '{}' ...".\
format(inputTemplatePcdFile))
示例2: main
# 需要导入模块: from ephemeris import Ephemeris [as 别名]
# 或者: from ephemeris.Ephemeris import initialize [as 别名]
def main():
# Create the parser
parser = OptionParser()
# Specify all valid options.
parser.add_option("-v", "--version",
action="store_true",
dest="version",
default=False,
help="Display script version info and author contact.")
parser.add_option("--pcd-file",
action="store",
type="str",
dest="pcdFile",
default=None,
help="Specify the PriceChartDocument (.pcd) file " + \
"to modify.",
metavar="<FILE>")
parser.add_option("--print",
action="store_true",
dest="printFlag",
default=False,
help="Print the swing file's contents.")
parser.add_option("--output-file",
action="store",
type="str",
dest="outputFile",
default=None,
help="Specify an output filename for the swing file." + \
" The swing file data is pickled to this file.",
metavar="<FILE>")
# Parse the arguments into options.
(options, args) = parser.parse_args()
# Print version information if the flag was used.
if (options.version == True):
print(os.path.basename(sys.argv[0]) + " (Version " + VERSION + ")")
print("By Ryan Luu, [email protected]")
shutdown(0)
# Get the pcd filename.
if (options.pcdFile == None):
log.error("Please specify a PriceChartDocument (.pcd) file with " +
"the --pcd-file option.")
shutdown(1)
else:
log.debug("options.pcdFile == {}".format(options.pcdFile))
pcdFile = os.path.abspath(options.pcdFile)
log.debug("pcdFile == {}".format(pcdFile))
# Get the print flag.
printFlag = options.printFlag
log.debug("printFlag == {}".format(printFlag))
# Get the output filename.
if (options.outputFile != None):
log.debug("options.outputFile == {}".format(options.outputFile))
outputFile = os.path.abspath(options.outputFile)
else:
log.debug("outputFile was not specified.")
outputFile = ""
# Check to make sure either --print or --pcd-file was specified.
if outputFile == "" and printFlag == False:
log.error("Please specify either the --print option or " +
"the --pcd-file option.")
shutdown(1)
######################################
# Initialize Ephemeris (required).
Ephemeris.initialize()
# Set application details so the we can use QSettings default
# constructor later.
appAuthor = "Ryan Luu"
appName = "PriceChartingTool"
QCoreApplication.setOrganizationName(appAuthor)
QCoreApplication.setApplicationName(appName)
# Create the Qt application.
app = QApplication(sys.argv)
app.setApplicationName(appName)
# Open the PriceChartDocument file.
log.info("Loading PriceChartDocument '{}' ...".format(pcdFile))
priceChartDocumentData = unpicklePriceChartDocumentDataFromFile(pcdFile)
if priceChartDocumentData == None:
# Retrieval failed. An error message should have been logged.
shutdown(1)
log.info("Creating a new SwingFileData object ...")
# Create SwingFileData object.
swingFileData = SwingFileData()
#.........这里部分代码省略.........