当前位置: 首页>>代码示例>>Python>>正文


Python ConfigurationDefinition.add_fixed方法代码示例

本文整理汇总了Python中pts.core.basics.configuration.ConfigurationDefinition.add_fixed方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigurationDefinition.add_fixed方法的具体用法?Python ConfigurationDefinition.add_fixed怎么用?Python ConfigurationDefinition.add_fixed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pts.core.basics.configuration.ConfigurationDefinition的用法示例。


在下文中一共展示了ConfigurationDefinition.add_fixed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: verify_modeling_cwd

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_fixed [as 别名]
# -----------------------------------------------------------------

modeling_path = verify_modeling_cwd()
runs = FittingRuns(modeling_path)

# -----------------------------------------------------------------

# Create configuration definition
definition = ConfigurationDefinition()

# -----------------------------------------------------------------

# FITTING RUN
if runs.empty: raise RuntimeError("No fitting runs are present (yet)")
elif runs.has_single: definition.add_fixed("fitting_run", "name of the fitting run", runs.single_name)
else: definition.add_required("fitting_run", "string", "name of the fitting run", choices=runs.names)

# Create the configuration
config = parse_arguments("check_populations", definition)

# -----------------------------------------------------------------

# Load populations table
populations = get_populations(modeling_path)
populations_run = populations[config.fitting_run]

# Load generation table
generations = get_generations_table(modeling_path, config.fitting_run)

# -----------------------------------------------------------------
开发者ID:SKIRT,项目名称:PTS,代码行数:32,代码来源:check_populations.py

示例2: load_modeling_environment_cwd

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_fixed [as 别名]
from pts.modeling.misc.examination import ModelExamination

# -----------------------------------------------------------------

# Determine the modeling path
environment = load_modeling_environment_cwd()
suite = environment.static_model_suite

# -----------------------------------------------------------------

# Create the configuration definition
definition = ConfigurationDefinition()

# Name of the model for which to create the representation
if suite.no_models: raise RuntimeError("No models found: first run build_model to create a new model")
elif suite.has_single_model: definition.add_fixed("model_name", "name of the model", suite.single_model_name)
else: definition.add_required("model_name", "string", "name of the model", choices=suite.model_names)

# Get configuration
config = parse_arguments("show_model", definition)

# -----------------------------------------------------------------

# Load the model
model = suite.get_model(config.model_name)

# -----------------------------------------------------------------

# Examination
examination = ModelExamination()
开发者ID:SKIRT,项目名称:PTS,代码行数:32,代码来源:show_model.py

示例3: find_host_ids

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_fixed [as 别名]
# -----------------------------------------------------------------

all_host_ids = find_host_ids()
all_hosts = find_hosts()
nhosts = len(all_hosts)
has_hosts = nhosts > 0

# -----------------------------------------------------------------

# Create the configuration definition
definition = ConfigurationDefinition()

# The remote hosts
if has_hosts: definition.add_positional_optional("hosts", "host_list", "remote hosts", choices=all_host_ids, default=all_hosts)
else: definition.add_fixed("hosts", "remote hosts", [])

# Add optional
definition.add_optional("pts_repo_name", "string", "PTS repository name to deploy remotely", "origin", choices=introspection.pts_git_remotes())
definition.add_optional("skirt_repo_name", "string", "SKIRT repository name to deploy remotely", "origin", choices=introspection.skirt_git_remotes())

# Add flags
definition.add_flag("local", "also deploy locally", True)
definition.add_flag("skirt", "deploy SKIRT", True)
definition.add_flag("pts", "deploy PTS", True)
definition.add_flag("check", "check versions after deployment", True)
definition.add_flag("one_attempt", "only perform one attempt at connecting to a remote")

# Also update the dependencies
definition.add_flag("update_dependencies", "update the dependencies if possible", False)
开发者ID:SKIRT,项目名称:PTS,代码行数:31,代码来源:deploy.py

示例4: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_fixed [as 别名]
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition
from pts.core.remote.host import find_host_ids

# -----------------------------------------------------------------

# Create definition
definition = ConfigurationDefinition(write_config=False)

# Number of frames
definition.add_optional("nframes", "positive_integer", "number of frames", 2)

# Size of frames
definition.add_optional("npixels", "positive_integer", "number of pixels of the frames", 500)

# Number of sources
definition.add_optional("nrandom_sources", "positive_integer", "number of point sources", 100)

# Flags
definition.add_flag("vary_fwhm", "vary the FWHM", False)

# PSF model
definition.add_fixed("psf_model", "psf model", "gaussian")

definition.add_optional("noise_stddev", "real", "stddev of noise", 5.)

# -----------------------------------------------------------------
开发者ID:SKIRT,项目名称:PTS,代码行数:32,代码来源:config.py


注:本文中的pts.core.basics.configuration.ConfigurationDefinition.add_fixed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。