Beispiel #1
0
#!/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")

# -----------------------------------------------------------------
Beispiel #2
0
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition
from pts.magic.config.extract import definition as extraction_definition
from pts.magic.config.subtract_sky import definition as subtraction_definition
from pts.core.tools.parallelization import ncores

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

# Create the configuration
definition = ConfigurationDefinition()

# The dataset or image
definition.add_positional_optional("dataset", "file_path",
                                   "name of the dataset file or image file")

# The maximum FWHM (minimum resolution that has to be retained in the convolved frames)
definition.add_optional("max_fwhm", "quantity", "maximum FWHM for convolution")

# The minimum pixel size (minimum resolution that has to be retained in the rebinned frames)
definition.add_optional("max_pixelscale", "quantity",
                        "maximum pixelscale for rebinning")

# Add input section
#definition.add_section("input", "the names of the input files")
#definition.sections["input"].add_required("image", "image_path", "name of the input image")
#definition.sections["input"].add_optional("galaxy_region", "file_path", "file with galaxy regions", "galaxies.reg")
#definition.sections["input"].add_optional("star_region", "file_path", "file with star regions", "stars.reg")
#definition.sections["input"].add_optional("saturation_region", "file_path", "file with regions for saturated stars", "saturation.reg")
#definition.sections["input"].add_optional("other_region", "file_path", "file with regions for other contaminating sources", "other_sources.reg")
Beispiel #3
0
# Import the relevant PTS classes and modules
from pts.core.remote.host import find_host_ids
from pts.core.basics.configuration import ConfigurationDefinition
from pts.core.tools import introspection

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add optional
host_ids = find_host_ids()
if len(host_ids) > 0:
    definition.add_positional_optional("host_ids",
                                       "string_list",
                                       "remote host ids",
                                       choices=host_ids,
                                       default=host_ids)
else:
    definition.add_fixed("host_ids", "remote host_ids", [])

# 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",
Beispiel #4
0
#!/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.magic.maps.colour.colour import colour_strings

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

# Create the configuration
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("colours", "string_list", "colour maps to make", default=colour_strings, suggestions=colour_strings)

# -----------------------------------------------------------------
Beispiel #5
0
# -----------------------------------------------------------------

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import formatting as fmt
from pts.modeling.config.parameters import possible_parameter_types, possible_parameter_types_descriptions, default_units
from pts.core.units.stringify import represent_unit as ru
from pts.core.basics.configuration import ConfigurationDefinition

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

definition = ConfigurationDefinition()

definition.add_positional_optional("modeling_type", "string", "modeling type")

print("")

for parameter_types in possible_parameter_types:

    print(fmt.green + fmt.bold + parameter_types + fmt.reset)

    print("")
    print(
        " - Description: " +
        possible_parameter_types_descriptions[parameter_types].split(" (")[0])
    print(" - Default unit: " + ru(default_units[parameter_types]))
    print("")

# -----------------------------------------------------------------
Beispiel #6
0
# -----------------------------------------------------------------

# 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)

# Generations
definition.add_positional_optional(
    "generations", "string_list",
    "name of the generations for which to check the database")

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

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

# Load the fitting run
fitting_run = FittingRun.from_name(modeling_path, config.fitting_run)

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

# Get generation names
generations = config.generations if config.generations is not None else fitting_run.genetic_generations
Beispiel #7
0
#!/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.modeling.fitting.component import get_generation_names, get_last_finished_generation
from pts.core.tools import filesystem as fs

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Add settings
definition.add_positional_optional("features", "string_list", "features to be plotted")
definition.add_positional_optional("generation", "string", "generation for which to plot the features", choices=get_generation_names(fs.cwd()), default=get_last_finished_generation(fs.cwd()))

# -----------------------------------------------------------------
Beispiel #8
0
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

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

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

# Create definition
definition = ConfigurationDefinition()
definition.add_positional_optional("remotes",
                                   "string_list",
                                   "remote hosts on which to clear",
                                   choices=find_host_ids(),
                                   default=find_host_ids())

# Create setter
config = parse_arguments("clear_sessions_and_temp", definition)

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

# Loop over the remote hosts
for host_id in config.remotes:

    # Setup the remote
    remote = Remote()
    if not remote.setup(host_id):
        log.warning("Could not connect to remote host '" + host_id + "'")
Beispiel #9
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.host import find_host_ids
from pts.core.tools import formatting as fmt
from pts.core.tools import introspection
from pts.core.remote.remote import Remote
from pts.core.basics.log import log
from pts.core.remote.python import RemotePythonSession

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("host_id",
                                   "string",
                                   "remote host ID",
                                   choices=find_host_ids())

# Read the command line arguments
config = parse_arguments(
    "python",
    definition,
    description=
    "Open a python session with PTS modules loaded, and with remote capabilities if requested."
)

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


class PTSConsole(InteractiveConsole):
    """
default_color = "jet"
default_mask_color = "black"

scales = ["log", "sqrt"]
default_colour = "jet"
default_interval = "pts"

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")
definition.add_flag("show", "show the page", False)

# Sigma levels
definition.add_positional_optional(
    "sigma_levels", "real_list",
    "different sigma levels for which to generate significance masks",
    sigma_levels)
definition.add_optional("default_level", "real", "default sigma level",
                        default_sigma_level)

# Flags
definition.add_flag(
    "replot", "replot already existing figures",
    False)  # default False because prep data doesn't really change (normally)

# ADVANCED
definition.add_optional(
    "nopen_files", "positive_integer",
    "number of open files necessary to make the script work", 1024)

# Image
Beispiel #11
0
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", runs.names)

# Generation
definition.add_positional_optional("generations", "string_list", "name of the generations for which to show the recurrence")

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

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

# Load the modeling environment
environment = GalaxyModelingEnvironment(modeling_path)

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

# Load the fitting run
fitting_run = FittingRun.from_name(modeling_path, config.fitting_run)

# -----------------------------------------------------------------
Beispiel #12
0
#!/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.magic.maps.ssfr.colours import ssfr_colours

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

# Create the configuration
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("colours",
                                   "string_list",
                                   "colours to use",
                                   default=ssfr_colours,
                                   choices=ssfr_colours)

# -----------------------------------------------------------------
Beispiel #13
0
#!/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.tools import filesystem as fs
from pts.core.remote.host import find_host_ids

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

# Create the configuration
definition = ConfigurationDefinition()

# Add required arguments
definition.add_required("ski", "file_path", "name/path of the ski file")
definition.add_required("fski", "file_path", "name/path of the fski file")

# Input and output
definition.add_optional("input", "directory_path", "input directory for the simulation(s)", letter="i")
definition.add_optional("output", "directory_path", "output directory for the simulation(s)", fs.cwd(), letter="o", convert_default=True)

# Add positional arguments
definition.add_positional_optional("remote", "string", "the remote host on which to run the simulation (if none is specified, the simulation is run locally", choices=find_host_ids())

# -----------------------------------------------------------------
Beispiel #14
0
from pts.core.remote.host import find_host_ids
from pts.magic.config.find_sources import definition as sources_definition
from pts.modeling.component.component import get_cache_host_id
from pts.modeling.core.environment import verify_modeling_cwd

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

modeling_path = verify_modeling_cwd()

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

# Create the configuration definition
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Add optional arguments
definition.add_positional_optional("image", "string", "the name of the image for which to run the initialization")

# Add flags
definition.add_flag("visualise", "make visualisations")

# Remote source detection
definition.add_optional("remote", "string", "remote host on which to run the source finder", choices=find_host_ids())
definition.add_flag("attached", "run remotely in attached mode")

# Add section for the source finder
definition.import_section("sources", "options for the source finder", sources_definition)

# Flags
default_catalogs = ["II/246"]
definition.add_optional("catalogs", "string_list", "catalogs for point sources", default_catalogs)
definition.add_flag("catalog_overlapping", "only fetch catalog data in the area where all images are overlapping", True)
Beispiel #15
0
from pts.modeling.core.environment import GalaxyModelingEnvironment
from pts.magic.plot.imagegrid import StandardImageGridPlotter
from pts.modeling.core.environment import map_sub_names
from pts.modeling.maps.component import get_maps_sub_name
from pts.modeling.component.component import load_modeling_history
from pts.modeling.core.environment import verify_modeling_cwd

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add settings
definition.add_required("sub_name", "string", "maps sub name for plotting",
                        map_sub_names)
definition.add_positional_optional("method", "string", "method for plotting")

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

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

modeling_path = verify_modeling_cwd()

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

# Load the modeling environment
environment = GalaxyModelingEnvironment(modeling_path)

# -----------------------------------------------------------------
Beispiel #16
0
#!/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
definition = ConfigurationDefinition()

# Add required
definition.add_required("name", "string", "name of the simulation queue")
definition.add_required("walltime", "duration", "walltime for the jobs")
definition.add_positional_optional("runid",
                                   "integer",
                                   "start with this run ID",
                                   default=0)

# -----------------------------------------------------------------
Beispiel #17
0
# Import the relevant PTS classes and modules
from pts.core.tools import filesystem as fs
from pts.core.tools import introspection
from pts.core.tools import time
from pts.evolve.optimize.stepwise import StepWiseOptimizer
from pts.evolve.optimize.optimizer import show_best
from pts.evolve.tests.TravelingSalesman.test import settings_optimize, input_optimize, eval_func
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.basics.log import setup_log

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

# Create configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("ngenerations", "positive_integer", "number of generations (steps)", 10)

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

# Set logging
log = setup_log("DEBUG")

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

evaluator_kwargs = input_optimize["evaluator_kwargs"]

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

# Determine temporary directory
path = introspection.create_temp_dir(time.unique_name("optimize"))
Beispiel #18
0
# -----------------------------------------------------------------

modeling_path = verify_modeling_cwd()
suite = ModelSuite.from_modeling_path(modeling_path)

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Add settings
model_names = suite.model_names
if len(model_names) == 0:
    definition.add_positional_optional("name",
                                       "string",
                                       "name for the model",
                                       default="standard")
else:
    definition.add_required("name",
                            "string",
                            "name for the model",
                            forbidden=model_names)

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

# Force overwrite
definition.add_flag("overwrite",
                    "overwrite possibly existing model with this name", False)

# -----------------------------------------------------------------
Beispiel #19
0
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import introspection
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.host import find_host_ids
from pts.core.remote.remote import Remote
from pts.core.tools import time

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

# Create definition
definition = ConfigurationDefinition()
definition.add_positional_optional("remote", "string", "remote host on which to clear the temporary directory", choices=find_host_ids())
definition.add_optional("names", "string_list", "remove temporary directories matching these names (e.g. 'installation' matches 'installation_2017-05-03--08-45-44-410', 'installation_2017-05-03--13-52-28-371', etc. and also exact matches")

# Create setter
config = parse_arguments("clear_temp", definition)

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

# Remote
if config.remote is not None:

    # Create the remote
    remote = Remote(host_id=config.remote)

    # Check whether names are given
    if config.names is not None:
Beispiel #20
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.basics.log import log
from pts.core.tools import filesystem as fs
from pts.core.remote.host import find_host_ids
from pts.core.remote.remote import Remote

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Remote
definition.add_positional_optional("remote", "string", "remote host ID", choices=find_host_ids())
definition.add_positional_optional("remote_path", "string", "path of remote directory (absolute or relative w.r.t. home directory)")

# Add optional settings
definition.add_optional("contains", "string", "a string that should be contained in the file names")
definition.add_optional("not_contains", "string", "a string that should not be contained in the file names")
definition.add_optional("extension", "string", "the file extension")
definition.add_optional("exact_name", "string", "exact filename (for recursive search)")
definition.add_optional("exact_not_name", "string", "not files with exactly this name")
definition.add_optional("directory_not_contains", "string_list", "directory_not_contains")
definition.add_optional("directory_exact_not_name", "string_list", "directory_exact_not_name")

# Add flags
definition.add_flag("recursive", "search recursively", False)
definition.add_flag("full", "show the full paths", False)
definition.add_flag("remove", "remove the found files", False)
Beispiel #21
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.host import find_host_ids
from pts.core.tools import introspection
from pts.core.tools import filesystem as fs
from pts.core.simulation.simulation import RemoteSimulation
from pts.core.remote.remote import Remote
from pts.core.basics.log import log

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add settings
definition.add_positional_optional("remotes", "string_list", "the IDs of the remote hosts for which to clear the simulations", choices=find_host_ids(), default=find_host_ids())
definition.add_positional_optional("ids", "integer_list", "the IDs of the simulations to clear")
definition.add_flag("full", "fully clear the simulations, also remove remote simulation directories")

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

# Parse the arguments into a configuration
config = parse_arguments("clear_tasks", definition, description="Clear PTS tasks for a certain remote host")

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

# Loop over the remote hosts
for host_id in config.remotes:

    # Check whether the remote is available
    if config.full:
Beispiel #22
0
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# TODO: work on this further

# Create the configuration
definition = ConfigurationDefinition()

# Add required arguments
definition.add_required("filename", "absolute_path",
                        "the name/path of the ski file")

# Add positional arguments
definition.add_positional_optional(
    "remote", str,
    "the remote host on which to run the simulation (if none is specified, the simulation is run locally"
)
definition.add_optional("input",
                        "absolute_path",
                        "the simulation input directory",
                        letter="i")
definition.add_optional("output",
                        "absolute_path",
                        "the simulation output directory",
                        letter="o")
definition.add_optional("cluster", str, "the name of the cluster", letter="c")
definition.add_optional("parallel",
                        "int_tuple",
                        "the parallelization scheme (processes, threads)",
                        letter="p")
definition.add_optional(
Beispiel #23
0
# Create the configuration definition
definition = ConfigurationDefinition()

# Required arguments
definition.add_required(
    "ski_path", "file_path",
    "the name of the ski file to be used for the scaling test")
definition.add_required("remote", "string", "the name of the remote host")
definition.add_required("mode",
                        "string",
                        "the parallelization mode for the scaling test",
                        choices=["mpi", "hybrid", "threads"])

# Optional arguments
definition.add_positional_optional("maxnodes", "real",
                                   "the maximum number of nodes", 1)
definition.add_positional_optional(
    "minnodes", "real",
    "the minimum number of nodes. In hybrid mode, this also defines the number of threads per process",
    0)
definition.add_optional("cluster", "string", "the name of the cluster", None)
definition.add_optional("wavelengths", "real",
                        "boost the number of wavelengths by a certain factor",
                        None)
definition.add_optional(
    "packages", "real",
    "boost the number of photon packages by a certain factor", None)

# Flags
definition.add_flag("manual", "launch and inspect job scripts manually")
definition.add_flag(
Beispiel #24
0
# -----------------------------------------------------------------

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import formatting as fmt
from pts.modeling.config.parameters import possible_parameter_types, possible_parameter_types_descriptions, default_units
from pts.core.units.stringify import represent_unit as ru
from pts.core.basics.configuration import ConfigurationDefinition

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

definition = ConfigurationDefinition()

definition.add_positional_optional("modeling_type", "string", "modeling type")

print("")

for parameter_types in possible_parameter_types:

    print(fmt.green + fmt.bold + parameter_types + fmt.reset)

    print("")
    print(" - Description: " + possible_parameter_types_descriptions[parameter_types].split(" (")[0])
    print(" - Default unit: " + ru(default_units[parameter_types]))
    print("")

# -----------------------------------------------------------------
Beispiel #25
0
from __future__ import absolute_import, division, print_function

# Import standard modules
import StringIO

# Import the relevant PTS classes and modules
from pts.core.prep.smile import SKIRTSmileSchema
from pts.core.tools import formatting as fmt
from pts.core.tools import stringify
from pts.core.basics.configuration import ConfigurationDefinition, write_definition, parse_arguments

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

# Create the configuration
definition = ConfigurationDefinition()
definition.add_positional_optional("match", "string", "only show types with names that contain this string")
definition.add_flag("definitions", "format the properties for each item as a configuration definition")

# Parse
config = parse_arguments("skirt_items", definition)

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

# Create the SKIRT smile schema
smile = SKIRTSmileSchema()

print("")

# Loop over the concrete types
for name in smile.concrete_types:
Beispiel #26
0
# *****************************************************************
# **       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.test.pts import subprojects_with_tests

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("subprojects", "string_list", "update on a remote system", subprojects_with_tests(), choices=subprojects_with_tests())
definition.add_positional_optional("tests", "string_list", "test(s) to perform (when one subproject is specified)")

# Flags
definition.add_flag("check_imports", "check import statements", True)
definition.add_flag("check_commands", "check commands", True)
definition.add_flag("check_configurations", "check configurations", True)
definition.add_flag("check_packages", "check package definitions", True)
definition.add_flag("only_checks", "only performs checks, no actual test cases", False)
definition.add_flag("only_tests", "only perform the test cases, not internal checks", False)

# Add flags
definition.add_flag("keep", "keep the output")
definition.add_flag("show", "show results")
definition.add_flag("write", "write results")
definition.add_flag("open_output", "open the output directory after each test for manual inspection")
Beispiel #27
0
#!/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 the configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_required("remote", "string", "name of the remote host", choices=find_host_ids())
definition.add_positional_optional("id", "positive_integer", "simulation ID")
definition.add_optional("name", "string", "simulation name")

# Additional relative error
definition.add_optional("additional_error", "percentage", "additional percentual error for the observed flux points")

# Flags
definition.add_flag("write", "write the results", True)

# -----------------------------------------------------------------
Beispiel #28
0
# -----------------------------------------------------------------

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.simulation.simulation import createsimulations
from pts.core.plot.grids import plotgrids
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments

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

# Create configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("simulation", "string", "simulation specification", default="")
definition.add_optional("linewidth", "positive_real", "line width", 0.1)
definition.add_optional("maxlevel", "positive_integer", "maximum tree level")

# Read the command line arguments
config = parse_arguments("plotgrids", definition, description="Unmount a remote mounted with PTS")

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

print("Starting plotgrids...")

# construct the list of simulation objects and make the plots
for simulation in createsimulations(config.simulation): plotgrids(simulation, linewidth=config.linewidth, maxlevel=config.maxlevel)

print("Finished plotgrids")
Beispiel #29
0
                        "string",
                        "remote host on which to make the observed images",
                        default_other_host_id,
                        choices=other_host_ids)
definition.add_flag("attached", "launch remote executions in attached mode",
                    True)
definition.add_flag("debug_output",
                    "show all simulation output when in debugging mode", False)

# ANALYSIS RUN
if runs.empty: raise RuntimeError("No analysis runs are present (yet)")
elif runs.has_single:
    definition.add_fixed("run", "name of the analysis run", runs.single_name)
else:
    definition.add_positional_optional("run", "string",
                                       "name of the analysis run",
                                       runs.last_name, runs.names)

# Parallelization options
#definition.add_optional("nnodes", "integer", "number of nodes to use for the simulations (for scheduler)", 4)
#definition.add_optional("cores_per_process", "integer", "number of cores per process (for non-scheduler)", 10)
#definition.add_flag("data_parallel", "data parallelization mode", False)

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

# Simulation options
definition.add_optional("npackages", "real",
                        "the number of photon packages per wavelength", 1e7)
definition.add_flag("selfabsorption", "dust self-absorption", True)
definition.add_flag("transient_heating", "transient (non-LTE) dust heating",
                    True)
Beispiel #30
0
#!/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.modeling.analysis.run import AnalysisRuns
from pts.modeling.core.environment import verify_modeling_cwd

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

modeling_path = verify_modeling_cwd()
runs = AnalysisRuns(modeling_path)

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Positional optional
if runs.empty: raise ValueError("No analysis runs present (yet)")
elif runs.has_single: definition.add_fixed("run", "name of the analysis run", runs.single_name)
else: definition.add_positional_optional("run", "string", "name of the analysis run for which to launch the heating simulations", runs.last_name, runs.names)

# -----------------------------------------------------------------
Beispiel #31
0
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.load import show_status
from pts.core.basics.log import log, setup_log

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

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")

# -----------------------------------------------------------------
Beispiel #32
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.mounter import RemoteMounter
from pts.core.remote.host import all_host_ids
from pts.core.tools import filesystem as fs

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_required("remote",
                        "string",
                        "remote host to mount",
                        choices=all_host_ids())
definition.add_positional_optional(
    "path", "directory_path",
    "path of directory in which to create the mount point")

# Read the command line arguments
config = parse_arguments(
    "mount",
    definition,
    description="Mount a remote configured in PTS into the local filesystem")

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

# Create the mounter
mounter = RemoteMounter()

# Mount and get the mount path
path = mounter.mount(config.remote, config.path)
Beispiel #33
0
from pts.core.basics.configuration import ConfigurationDefinition
from pts.core.remote.host import find_host_ids
from pts.core.launch.analyser import all_steps
from pts.core.config.analyse_simulation import definition as analysis_definition

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

host_ids = find_host_ids()

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Assignment file
definition.add_positional_optional("assignment", "file_path", "path of assignment file")

# Status file
definition.add_optional("status", "file_path", "path of status file")

# Remotes for which to find corresponding simulations
definition.add_optional("remotes", "string_list", "remote hosts for which to look for matching simulations (not necessary when assignment is specified)", default=host_ids, choices=host_ids)

# To specify the simulations
definition.add_optional("simulation_names", "string_list", "names of the simulations to look for")
definition.add_optional("simulation_ids", "integer_list", "IDs of the simulations (only if one remote host is specified)")
definition.add_flag("from_directories", "use directory names as simulation names")

# Timing and memory table
definition.add_optional("timing", "file_path", "timing table path")
definition.add_optional("memory", "file_path", "memory table path")
Beispiel #34
0
# *****************************************************************
# **       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 the configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("host_ids",
                                   "string_list",
                                   "remote host(s)",
                                   choices=find_host_ids(),
                                   default=find_host_ids())

# Add optional
definition.add_optional("not_remotes",
                        "string_list",
                        "skip these remote hosts",
                        choices=find_host_ids())

# Add flag
definition.add_flag("show", "show the versions on the terminal", True)
definition.add_flag("one_attempt",
                    "only perform one attempt at connecting to a remote")

# -----------------------------------------------------------------
Beispiel #35
0
# **       © 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
from pts.core.config.analyse_basic import definition as basic_definition
from pts.core.config.analyse_batch import definition as batch_definition

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_positional_optional("remote", "string", "ID of the remote host", choices=find_host_ids())
definition.add_positional_optional("id", "integer", "ID of the simulation")

# Add flags
definition.add_flag("ignore_missing_data", "ignore missing data when analysing the simulations", False)

# Analyse
definition.add_flag("do_basic", "do basic analysis", True)
definition.add_flag("do_batch", "do batch analysis", True)
definition.add_flag("do_scaling", "do scaling analysis", True)
definition.add_flag("do_extra", "do extra analysis", True)

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

# Import settings for basic, batch analysis
definition.import_section("basic", "basic analysis options", basic_definition)
Beispiel #36
0
#!/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
definition = ConfigurationDefinition()

# Positional optional
definition.add_positional_optional("directories", "directorypath_list",
                                   "input directories to search in")

# Flags
definition.add_flag("recursive",
                    "look for simulations in directories recursively", True)
definition.add_flag("list", "list the found simulations", True)

# NEW
definition.add_flag("output", "list the simulation output", False)

# -----------------------------------------------------------------
Beispiel #37
0
#!/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.modeling.plotting.preparation import PreparationPlotter

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Add settings
definition.add_positional_optional("features", "string_list", "features to be plotted", choices=PreparationPlotter.features())

# -----------------------------------------------------------------
Beispiel #38
0
#!/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.magic.config.extract import definition as extraction_definition
from pts.magic.config.subtract_sky import definition as subtraction_definition
from pts.core.tools.parallelization import ncores

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

# Create the configuration
definition = ConfigurationDefinition()

# The dataset or image
definition.add_positional_optional("dataset", "file_path", "name of the dataset file or image file")

# -----------------------------------------------------------------
Beispiel #39
0
# **       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
from pts.core.config.analyse_simulation import definition as analysis_definition

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

# Create the configuration
definition = ConfigurationDefinition(write_config=False)

# Add positional optional
definition.add_positional_optional("host_ids", "string_list", "name of the remote host(s) for which to show/retrieve simulations and tasks", choices=find_host_ids())
definition.add_positional_optional("ids", "string_integer_list_dictionary", "simulation IDs for the different remote hosts")

# Add flag
definition.add_flag("show_progress", "show the progress of the simulation that is still running (only if there is just one)", False)
definition.add_flag("debug_output", "show all simulation output in debug mode")

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

definition.add_flag("retrieve", "retrieve finished simulations", True)
definition.add_flag("analyse", "analyse retrieved simulations", True)

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

# Crashed
definition.add_flag("check_crashed", "check whether crashed simulations have the necessary output, if so, retrieve them")
Beispiel #40
0
default_instruments_loc = "lower center"
default_observations_loc = "upper left"
default_models_loc = "upper right"

# Locations
locations = sequences.get_lists_combinations(["upper", "center", "lower"], ["left", "center", "right"], combine=lambda x: " ".join(x) if x[0] != x[1] else x[0])

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

# Create configuration definition
definition = ConfigurationDefinition()

#definition.add_flag("old", "old plotting methods", False)

# SEDs from file
definition.add_positional_optional("seds", "filepath_list_or_string_filepath_dictionary", "SED files to be plotted")
definition.add_flag("multi", "look for multiple SEDs per file", False)
definition.add_optional("wavelength_unit_file", "length_unit", "wavelength unit in SED file")
definition.add_optional("unit_file", "photometric_unit", "photometric unit in SED file")
definition.add_optional("distance", "length_quantity", "object distance (for flux <> luminosity unit conversion")

# Add plotting options
definition.import_section("plot", "plotting options", plot_definition)

# Add optional
definition.add_optional("output", "string", "output directory")
definition.add_optional("format", "string", "plotting format", default=default_format, choices=formats)

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

# The unit in which to plot
Beispiel #41
0
# -*- 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 arguments
definition.add_positional_optional("host_id", "string", "install SKIRT/PTS remotely")
definition.add_optional("repository", "string", "repository name from which to clone (only possible when installing remotely and SKIRT/PTS is already installed locally)")

# Add flags
definition.add_flag("private", "use the private SKIRT/PTS repository")

# Advanced
definition.add_flag("force", "force re-installation when already present", letter="f")
definition.add_flag("force_conda", "force installation of conda and creation of a conda environment even when it is already present")

definition.add_flag("finish", "finish previously initiated installation")

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

# For PTS:
Beispiel #42
0
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.services.attenuation import GalacticAttenuation
from pts.core.basics.plot import MPLFigure
from pts.core.filter.broad import categorize_filters, categorized_filters_sorted_labels, get_filters_for_regimes
from pts.magic.basics.coordinatesystem import CoordinateSystem

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("galaxy_name", "string", "galaxy name")
definition.add_optional("image", "file_path", "image path")

# Get the configuration
config = parse_arguments("attenuation", definition)

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

# Create attenuation object
if config.image is not None:
    wcs = CoordinateSystem.from_file(config.image)
    attenuation = GalacticAttenuation(wcs.bounding_box.center)
    # or attenuation = GalacticAttenuation(wcs.center_sky)
else:
    attenuation = GalacticAttenuation(config.galaxy_name)
Beispiel #43
0
from pts.core.config.plot import definition as plot_definition
from pts.core.basics.plot import plotting_libraries, mpl

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

formats = ["pdf", "png"]
default_format = "pdf"
normalizations = ["max", "sum"]

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

# Create configuration definition
definition = ConfigurationDefinition()

# Distributions
definition.add_positional_optional("distributions", "filepath_list", "distribution files to be plotted")
definition.add_flag("panels", "plot the distributions in separate panels")
definition.add_flag("recursive", "search distribution files recursively in the working directory")
definition.add_optional("normalize", "string", "normalize all distributions by a certain method", choices=normalizations)
definition.add_optional("normalization_value", "real", "value for normalization", 1.)

# Add plotting options
definition.import_section("plot", "plotting options", plot_definition)
definition.sections["plot"].optional["xsize"].default = 8
definition.sections["plot"].optional["ysize"].default = 4
definition.add_flag("logscale", "use value log scale")
definition.add_flag("logfrequency", "use log scale for frequency")
definition.add_optional("bar_width", "positive_real", "relative width of the bars (1 means edges touch)", 1.)
definition.add_flag("use_name_xlabel", "use the distribution name(s) for the x labels of the panels")
definition.add_flag("colours_per_panel", "reuse the same colours for each panel")
Beispiel #44
0
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.data.sun import Sun
from pts.core.tools import filesystem as fs
from pts.core.data.sed import SED
from pts.core.simulation.wavelengthgrid import WavelengthGrid

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

# Create definition
definition = ConfigurationDefinition()

# Filter
definition.add_required("filter", "filter", "filter in which to calculate the luminosity")

# SFR
definition.add_positional_optional("sfr", "quantity", "star formation rate", "1. Msun/yr", convert_default=True)

# MAPPINGS parameters
definition.add_optional("metallicity", "positive_real", "metallicity", 0.02)
definition.add_optional("compactness", "positive_real", "compactness", 6)
definition.add_optional("pressure", "quantity", "pressure", 1e12 * u("K/m3"))
definition.add_optional("covering_factor", "positive_real", "covering factor", 0.2) # fPDR

# Flags
definition.add_flag("plot", "plot the SEDs", False)
definition.add_flag("skirt", "use SKIRT", True)
definition.add_flag("pts", "use PTS", True)
definition.add_flag("sampled", "use SKIRT luminosities already sampled on a wavelength grid", True)
definition.add_flag("only_skirt", "only SKIRT", False)
definition.add_flag("only_pts", "only PTS", False)
definition.add_flag("only_sampled", "only sampled", False)
Beispiel #45
0
# *****************************************************************

## \package pts.do.core.mount Mount a remote configured in PTS into a local directory.

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

# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.mounter import mount_and_open
from pts.core.remote.host import all_host_ids

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_required("remote", "string", "remote host to mount", choices=all_host_ids())
definition.add_positional_optional("path", "directory_path", "path of directory in which to create the mount point")

# Read the command line arguments
config = parse_arguments("mount", definition, description="Mount a remote configured in PTS into the local filesystem")

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

# Mount and open
mount_and_open(config.remote, path=config.path)

# -----------------------------------------------------------------
Beispiel #46
0
#!/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)

# -----------------------------------------------------------------
Beispiel #47
0
from pts.core.remote.host import find_host_ids
from pts.core.tools import introspection
from pts.core.tools import filesystem as fs
from pts.core.simulation.simulation import RemoteSimulation
from pts.core.remote.remote import Remote
from pts.core.basics.log import log

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add settings
definition.add_positional_optional(
    "remotes",
    "string_list",
    "the IDs of the remote hosts for which to clear the simulations",
    choices=find_host_ids(),
    default=find_host_ids())
definition.add_positional_optional("ids", "integer_list",
                                   "the IDs of the simulations to clear")
definition.add_flag(
    "full",
    "fully clear the simulations, also remove remote simulation directories")

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

# Parse the arguments into a configuration
config = parse_arguments(
    "clear_tasks",
    definition,
    description="Clear PTS tasks for a certain remote host")
Beispiel #48
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
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)
Beispiel #49
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.remote.host import all_host_ids
from pts.core.simulation.remote import get_simulation_for_host
from pts.core.launch.analyser import reanalyse_simulation, all_steps
from pts.core.basics.log import log

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_required("remote", "string", "remote host to mount", choices=all_host_ids())
definition.add_required("ids", "integer_list", "simulation IDs")
definition.add_positional_optional("steps", "string_list", "re-analyse only certain steps", choices=all_steps, default=all_steps)
definition.add_positional_optional("features", "string_list", "re-analyse only certain features (if a single step is defined)")
definition.add_optional("not_steps", "string_list", "don't analyse these steps", choices=all_steps)
definition.add_optional("not_features", "string_list", "don't analyse these features (if a single not_step is defined)")

# Read the command line arguments
config = parse_arguments("reanalyse", definition, description="Re-analyse a certain simulation")

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

# Loop over the simulations
for simulation_id in config.ids:

    # Load the simulation
    simulation = get_simulation_for_host(config.remote, config.id)
Beispiel #50
0
# -*- 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()

# 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")

# -----------------------------------------------------------------
Beispiel #51
0
#!/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")

# -----------------------------------------------------------------
Beispiel #52
0
#!/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.dustpedia.data.images import instruments

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

# Configuration
definition = ConfigurationDefinition()

# Galaxy name
definition.add_required("galaxy_name", "string", "the name of the galaxy")

# Database
definition.add_section("database", "DustPedia database credentials")
definition.add_optional("username", "string", "username")
definition.add_optional("password", "string", "password")

# Other options
definition.add_positional_optional("instruments", "string_list", "instruments for which to download the images", choices=instruments, default=instruments)

# -----------------------------------------------------------------
Beispiel #53
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.tools import introspection
from pts.core.prep.update import PTSUpdater

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

# Configuration definition
definition = ConfigurationDefinition()

# Required parameters
definition.add_required("message", "string", "the commit message")

# Optional parameters
definition.add_positional_optional("git_remotes",
                                   "string_list",
                                   "the remote(s) to commit to",
                                   default="origin")
definition.add_optional("remote", "string",
                        "the remote on which to pull the changes")

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

# Get the configuration
config = parse_arguments(
    "push_pts",
    definition,
    description=
    "Add all, commit and push to remote repositories, and pull again on remote systems"
)

# -----------------------------------------------------------------
Beispiel #54
0
#!/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.modeling.plotting.photometry import PhotometryPlotter

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

# Create the configuration
definition = ConfigurationDefinition(log_path="log", config_path="config")

# Add settings
definition.add_positional_optional("features",
                                   "string_list",
                                   "features to be plotted",
                                   choices=PhotometryPlotter.features())

# -----------------------------------------------------------------
Beispiel #55
0
# *****************************************************************
# **       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 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")
Beispiel #56
0
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

# 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
Beispiel #57
0
# *****************************************************************
# **       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 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")
definition.add_positional_optional("ids", "integer_list", "simulation IDs (if none specified, all simulation IDs will be used)")
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")
Beispiel #58
0
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add optional
definition.add_positional_optional("subprojects",
                                   "string_list",
                                   "update on a remote system",
                                   subprojects_with_tests(),
                                   choices=subprojects_with_tests())
definition.add_positional_optional(
    "tests", "string_list",
    "test(s) to perform (when one subproject is specified)")

# Flags
definition.add_flag("check_imports", "check import statements", True)
definition.add_flag("check_commands", "check commands", True)
definition.add_flag("check_configurations", "check configurations", True)
definition.add_flag("check_packages", "check package definitions", True)
definition.add_flag("only_checks",
                    "only performs checks, no actual test cases", False)
definition.add_flag("only_tests",
                    "only perform the test cases, not internal checks", False)