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


Python ConfigurationDefinition.add_flag方法代码示例

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


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

示例1: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("host_id", "string", "update on a remote system")

# Add flags
definition.add_flag("dependencies", "also update the dependencies", False)

# Add flag
#definition.add_flag("all_remotes", "update on all remote hosts")

definition.add_flag("conda", "update conda", False)

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

示例2: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition
from pts.core.remote.host import find_host_ids

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_positional_optional("remote", "string", "name of the remote host", choices=find_host_ids())
definition.add_positional_optional("matching", "string", "only adapt settings with a name matching this string", suggestions=["remote"])
definition.add_positional_optional("ids", "integer_list", "simulation IDs")
definition.add_optional("names", "string_list", "simulation names")
definition.add_flag("from_directories", "use directory names as simulation names")

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

# Select certain properties
definition.add_optional("contains", "string", "only adapt properties containing this string in their name")
definition.add_optional("not_contains", "string", "don't adapt properties containing this string in their name")
definition.add_optional("exact_name", "string", "only adapt properties with this exact string as their name")
definition.add_optional("exact_not_name", "string", "don't adapt properties with this exact string as their name")
definition.add_optional("startswith", "string", "only adapt properties whose name starts with this string")
definition.add_optional("endswith", "string", "only adapt properties whose name starts with this string")

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

definition.add_flag("update", "update the analysis options", True)
开发者ID:SKIRT,项目名称:PTS,代码行数:31,代码来源:adapt_analysis_options.py

示例3: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.basics.log import log
from pts.magic.core.image import Image

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

# Create the configuration
definition = ConfigurationDefinition()
definition.add_required("add_to", "file_path", "add to this FITS file")
definition.add_required("add_from", "file_path", "add from this FITS file")
definition.add_flag("frames", "add frames", True)
definition.add_flag("masks", "add masks", True)
definition.add_flag("segments", "add segmentation maps", True)
definition.add_flag("replace", "replace planes", False)
definition.add_flag("replace_frames", "replace frames", False)
definition.add_flag("replace_masks", "replace masks", False)
definition.add_flag("replace_segments", "replace segmentation maps", False)
definition.add_flag("backup", "make backup", False)
config = parse_arguments("interpolate", definition)

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

if config.replace: config.replace_frames = config.replace_masks = config.replace_segments = True

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

示例4: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
from pts.core.plot.sed import plot_sed
from pts.core.plot.distribution import plot_distribution
from pts.core.tools import formatting as fmt
from pts.core.tools import sequences
from pts.core.tools.stringify import tostr
from pts.core.basics.structure import load_structure, filetypes, composite, table, dictionary, sed, distribution, regions

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

# Create configuration definition
definition = ConfigurationDefinition(write_config=False)
definition.add_required("filetype", "string", "type of file", choices=filetypes)
definition.add_required("filename", "file_path", "path of the dictionary file")

# As table?
definition.add_flag("table", "show as table")

# Displaying and formatting
definition.add_flag("interactive", "display tables interactively", False)
definition.add_flag("latex", "print as latex")

# Modyfying the table
definition.add_optional("columns", "string_list", "only show these columns")
definition.add_optional("sort", "string", "sort the entries on this column")

# Extra options
definition.add_flag("plot", "make a plot")
definition.add_optional("plot_path", "string", "plot output path")
definition.add_optional("plotting", "dictionary", "plotting options", dict())

# Formatting of the values
开发者ID:SKIRT,项目名称:PTS,代码行数:33,代码来源:show_file.py

示例5: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © 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 configuration definition
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("ski", "file_path", "ski file to be used (if not specified, all ski files in the current directory will be used)")

# Add flag
definition.add_flag("recursive", "look for ski files recursively")

# Add optional
definition.add_optional("remote", "string", "the remote host (no schedulers) on which to launch the simulations", choices=find_host_ids(schedulers=False))

# Add optional
definition.add_optional("nprocesses", "integer", "number of processes to use", 1)
definition.add_flag("data_parallel", "use data parallelization mode")

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

示例6:

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
definition.add_optional("center", "skycoordinate", "center coordinate")

# Spacing
definition.add_optional("spacing", "angle", "spacing of the ticks", "1 arcsec", convert_default=True)

# For saving plot file
definition.add_optional("dpi", "positive_integer", "dots per inch", 300)

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

# Vmin and vmax?
definition.add_optional("vmin", "real", "vmin")
definition.add_optional("vmax", "real", "vmax")

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

# Showing
definition.add_flag("show", "show", True)

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

# Writing
definition.add_flag("write", "do writing", True)

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

definition.add_optional("major_tick_length", "positive_integer", "length of major ticks", 7)
definition.add_optional("minor_tick_length", "positive_integer", "length of minor ticks", 4)

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

示例7: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# Import standard modules
import numpy as np

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.core.image import Image
from pts.core.tools import filesystem as fs
from pts.core.basics.log import log

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

# Create the configuration
definition = ConfigurationDefinition()
definition.add_required("file_path", "file_path", "path of the image")
definition.add_required("factor", "real", "multiplication factor")
definition.add_flag("backup", "make a backup of each image that is multiplied", False)
config = parse_arguments("multiply", definition)

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

# BACKUP FIRST
if config.backup:

    # Inform the user
    log.info("Making a backup of the original image ...")

    # Determine new filepath and copy
    new_filepath = fs.appended_filepath(config.filepath, "_backup")
    fs.copy_file(config.filepath, new_filepath)

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

示例8:

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
definition.add_optional("height", "length_quantity", "maximum height above/below midplane for the faceon projection")
definition.add_optional("width", "length_quantity", "maximum width before/behind center vertical plane for the edgeon projection")

# Output directory
definition.add_optional("output", "directory_path", "output directory")

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

# Spacing of the maps
definition.add_optional("spacing", "string", "method of determining the grid cell spacing", default_spacing_measure, choices=spacing_measures)
definition.add_optional("spacing_factor", "positive_real", "factor by which to multiply the grid cells spacing measure to become the actual map spacing", default_spacing_factor)

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

# Do interpolation on the maps
definition.add_flag("interpolate", "do interpolation", False)

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

# Do plot
definition.add_flag("plot", "do plotting", True)

# Plotting sections
definition.add_section("plotting", "plotting options")
definition.sections["plotting"].add_optional("interval", "string", "interval", "minmax")
definition.sections["plotting"].add_flag("contours", "show contours", False)
definition.sections["plotting"].add_optional("ncontours", "positive_integer", "number of contour levels", 5)
definition.sections["plotting"].add_optional("contours_color", "string", "color for the contour lines", "white")
definition.sections["plotting"].add_optional("minmax", "real_pair", "plotting minimum and maximum value")

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

示例9: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# -*- coding: utf8 -*-
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © 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)

definition.add_flag("plot", "do plotting", False)

definition.add_flag("rotate", "rotation", True)

definition.add_optional("nrandom_sources", "positive_integer", "number of random sources", 100)

definition.add_flag("vary_fwhm", "vary the FWHM slightly for each star", True)

definition.add_flag("add_catalogued_sources", "add catalogued sources", False)

definition.add_optional("point_source_catalogs", "string_list", "point source catalogs", ["II/246"])

definition.add_optional("nfilters_stars", "positive_integer", "number of filters to use where stars are visible", 4)
definition.add_optional("nfilters_extra", "positive_integer", "number of filters to use where stars are not visible", 2)

definition.add_optional("psf_model", "string", "model to use for the PSF", "airydisk", choices=["gaussian", "airydisk"])
开发者ID:SKIRT,项目名称:PTS,代码行数:33,代码来源:config.py

示例10: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © 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()

# Add optional settings
definition.add_positional_optional("remote", "string", "remote host on which to uninstall", choices=find_host_ids())
definition.add_positional_optional("skirt_and_or_pts", "string_list", "SKIRT and/or PTS", default=["skirt", "pts"], choices=["skirt", "pts"])

# Add flags
definition.add_flag("conda", "also remove conda installation")
definition.add_flag("qt", "also remove Qt installation")

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

示例11: find_host_ids

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

all_host_ids = find_host_ids()
all_hosts = find_hosts()

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

# Create configuration definition
definition = ConfigurationDefinition()

# Remote hosts
definition.add_positional_optional("hosts", "host_list", "remote hosts", default=all_hosts, choices=all_host_ids)

# Flags
definition.add_flag("clusters", "show the clusters")

# Create the configuration
config = parse_arguments("remotes", definition, "Check the status of the remotes")

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

# Set log level in a special way
if config.debug: setup_log("DEBUG")
else: setup_log("ERROR")

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

# Loop over the hosts
print("")
for host in config.hosts:
开发者ID:SKIRT,项目名称:PTS,代码行数:32,代码来源:remotes.py

示例12: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# Import the relevant PTS classes and modules
from pts.core.prep.uninstaller import Uninstaller
from pts.core.remote.host import find_host_ids
from pts.core.basics.log import log
from pts.core.remote.remote import Remote
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments

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

# Create definition
definition = ConfigurationDefinition()
definition.add_positional_optional("skirt_and_or_pts", "string_list", "SKIRT and/or PTS", default=["skirt", "pts"], choices=["skirt", "pts"])

# Add flags
definition.add_flag("conda", "also remove conda installation")
definition.add_flag("qt", "also remove Qt installation")
definition.add_flag("one_attempt", "only perform one attempt at connecting to a remote")

# Get the config
config = parse_arguments("deinstall_all", definition)

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

# Loop over the remote hosts
for host_id in find_host_ids():

    # Setup
    remote = Remote()
    if not remote.setup(host_id, one_attempt=config.one_attempt):
        log.warning("Remote host '" + host_id + "' is offline")
开发者ID:SKIRT,项目名称:PTS,代码行数:32,代码来源:deinstall_all.py

示例13: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create configuration definition
definition = ConfigurationDefinition()

# Commands to be run
definition.add_positional_optional("commands", "string_list", "commands to be run in interactive mode")

# Interactive mode
definition.add_flag("interactive", "use interactive mode", True)

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

# Caching
definition.add_optional("cache_volume", "string", "name of the volume to be used for caching")

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

# Set plotting backend
definition.add_optional("mpl_backend", "string", "set the matplotlib backend")

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

示例14: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
from pts.magic.tools.wavelengths import all_regimes, regimes_in_range, wavelength_range_for_regime
from pts.magic.tools.wavelengths import physical_regimes, physical_ranges, physical_regimes_in_range
from pts.core.tools import formatting as fmt
from pts.core.filter.broad import get_filters as get_broad_band_filters
from pts.core.tools.stringify import tostr, stringify_list_fancy

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

# Create the definition
definition = ConfigurationDefinition()

# Wavelength range
definition.add_positional_optional("wavelength_range", "quantity_range", "wavelength range")

# Flags
definition.add_flag("filters", "show filters in regimes", False)
definition.add_flag("physical", "use physical regimes (star formation, stellar emission, aromatic features, dust thermal emission, microwave)", False)

# Parse the command line arguments
config = parse_arguments("regimes", definition)

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

# Physical
if config.physical:

    # Get the list of regimes
    if config.wavelength_range is not None: regimes = physical_regimes_in_range(config.wavelength_range)
    else: regimes = physical_regimes

    print("")
开发者ID:SKIRT,项目名称:PTS,代码行数:33,代码来源:regimes.py

示例15: ConfigurationDefinition

# 需要导入模块: from pts.core.basics.configuration import ConfigurationDefinition [as 别名]
# 或者: from pts.core.basics.configuration.ConfigurationDefinition import add_flag [as 别名]
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# **       PTS -- Python Toolkit for working with SKIRT          **
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create the configuration
definition = ConfigurationDefinition()

# Add optional arguments
definition.add_section("wavelengths")
definition.sections["wavelengths"].add_optional("unit", str, "the unit of the wavelengths", "micron")
definition.sections["wavelengths"].add_optional("min", float, "the minimum wavelength", 0.09)
definition.sections["wavelengths"].add_optional("max", float, "the maximum wavelength", 2000)
definition.sections["wavelengths"].add_optional("npoints", int, "the number of wavelength points", 100)
definition.sections["wavelengths"].add_optional("min_zoom", float, "the minimum wavelength of the zoomed-in grid", 1)
definition.sections["wavelengths"].add_optional("max_zoom", float, "the maximum wavelength of the zoomed-in grid", 30)
definition.sections["wavelengths"].add_optional("npoints_zoom", int, "the number of wavelength points in the zoomed-in grid", 100)

definition.add_optional("packages", float, "the number of photon packages per wavelength", 2e5)
definition.add_flag("selfabsorption", "enable dust self-absorption")
definition.add_optional("dust_grid", str, "the type of dust grid to use (bintree, octtree or cartesian)", "bintree")

# -----------------------------------------------------------------
开发者ID:Stargrazer82301,项目名称:CAAPR,代码行数:32,代码来源:initialize_fit.py


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