Beispiel #1
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.basics.plot import normal_colormaps
from pts.magic.plot.imagegrid import default_cmap, light_theme, themes

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

# From directory
definition.add_optional("from_directory", "directory_path", "load images from directory")

# Colormap
definition.add_optional("cmap", "string", "colormap", default_cmap, choices=normal_colormaps)

# Options
definition.add_optional("axes_label_size", "positive_integer", "axes label size", 14)
definition.add_optional("ticks_label_size", "positive_integer", "ticks label size", 8)
definition.add_optional("legend_fontsize", "positive_integer", "legend fontsize", 14)
definition.add_optional("legend_markers_cale", "positive_integer", "legend marker scale", 0)
definition.add_optional("lines_marker_size", "positive_real", "lines marker size", 2.5)
definition.add_optional("linewidth", "positive_integer", "linewidth", 1)

# Dark or light theme?
definition.add_optional("theme", "string", "theme for the plot", light_theme, choices=themes)
Beispiel #2
0
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
definition.add_optional("wavelength_unit", "length_unit", "unit of wavelength", "micron", convert_default=True)
definition.add_optional("unit", "photometric_unit", "photometric unit", "Jy", convert_default=True)
Beispiel #3
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 = 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")

# -----------------------------------------------------------------
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.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 #5
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.simulation.skifile import SkiFile
from pts.core.simulation.skifile import show_normalizations

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Ski path
definition.add_required("ski", "file_path", "path of the ski file")

# Optional
definition.add_optional("flux", "photometric_unit", "also show flux in a particular unit")

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

# Parse the arguments into a configuration
config = parse_arguments("normalizations", definition, "Show the normalizations of stellar components in a ski file")

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

# Load the ski file
ski = SkiFile(config.ski)

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

show_normalizations(ski, flux_unit=config.flux)
Beispiel #6
0
from pts.core.basics.configuration import ConfigurationDefinition
from pts.magic.core.cutout import interpolation_methods

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

default_method = "pts"
default_interpolation_method = "pts"

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

# Create the configuration
definition = ConfigurationDefinition()
definition.add_required("image", "string", "name of the input image")
definition.add_required("regions", "string", "name of the regions file over which to interpolate")
definition.add_flag("write_mask", "write out the mask")
definition.add_optional("color", "string", "only interpolate over the shapes with this color")
definition.add_optional("ignore_color", "string", "ignore shapes with this particular color")
definition.add_optional("shapes", "string_list", "only interpolate over these kinds of shapes")
definition.add_optional("input", "string", "name of the input directory", letter="i")
definition.add_optional("output", "string", "name of the output directory", letter="o")
definition.add_optional("method", "string", "interpolation method to use", default=default_method)
definition.add_optional("interpolation_method", "string", "interpolation method", default_interpolation_method, choices=interpolation_methods)
definition.add_flag("sigma_clip", "apply sigma clipping before interpolation", True)
definition.add_optional("source_outer_factor", "real", "outer factor", 1.4)
definition.add_flag("plot", "plot after interpolation", False)
definition.add_flag("replace", "allow the original image to be replaced", False)
definition.add_flag("backup", "backup if replaced", True)
definition.add_optional("backup_suffix", "string", "backup suffix", "backup")

# -----------------------------------------------------------------
Beispiel #7
0
# -----------------------------------------------------------------

# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.core.list import NamedFrameList
from pts.core.tools import filesystem as fs
from pts.magic.basics.coordinatesystem import CoordinateSystem

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

# Create the definition
definition = ConfigurationDefinition()

# Select files
definition.add_optional("contains", "string_list",
                        "only files whose name contain one of these strings")

# Options
definition.add_optional("name", "string", "rebin to this name")
definition.add_optional("wcs", "file_path",
                        "path to the file from which to take the WCS")

# Flags
definition.add_flag("backup", "make backups", True)

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

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

# Load frame list
Beispiel #8
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

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

# 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 #9
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 #10
0
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)

# Output path
definition.add_optional("output", "directory_path", "output path")
Beispiel #11
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.modeling.preparation.initialization import PreparationInitializer
from pts.core.tools import logging, time, tables
from pts.core.tools import filesystem as fs
from pts.magic.core.frame import Frame
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add optional arguments
definition.add_optional(
    "image", str, "the name of the image for which to run the initialization")
definition.add_flag("visualise", "make visualisations")

# Get configuration
reader = ConfigurationReader("initialize_preparation")
config = reader.read(definition)

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

# Determine the log file path
logfile_path = fs.join(fs.cwd(), "log",
                       time.unique_name("log") +
                       ".txt") if config.report else None

# Determine the log level
level = "DEBUG" if config.debug else "INFO"
Beispiel #12
0
# Ensure Python 3 compatibility
from __future__ import absolute_import, division, print_function

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

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

definition = ConfigurationDefinition()
definition.add_optional("remotes",
                        "string_list",
                        "remote host ID",
                        choices=find_host_ids(),
                        default=find_host_ids())
config = parse_arguments("sessions", definition)

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

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

    # Create and setup the remote
    remote = Remote()
    if not remote.setup(host_id):
        raise RuntimeError("The remote host '" + host_id +
                           "' is not available at the moment")
Beispiel #13
0
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments, prompt_yn
from pts.core.tools.stringify import tostr
from pts.core.units.parsing import is_photometric_unit, is_photometric_quantity, parse_unit, parse_quantity
from pts.core.units.parsing import possible_physical_types, possible_density_flags, possible_brightness_flags

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

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

# Quantity to convert and unit to convert to
definition.add_required("quantity", "string", "quantity to convert to another unit")
definition.add_required("unit", "string", "unit to convert the quantity to")

# Extra information
definition.add_optional("distance", "length_quantity", "distance")
definition.add_optional("wavelength", "length_quantity", "wavelength")
definition.add_optional("frequency", "frequency_quantity", "frequency")
definition.add_optional("pixelscale", "pixelscale", "pixelscale")
definition.add_optional("solid_angle", "solid_angle", "solid angle")
definition.add_optional("filter", "filter", "filter")

# Create the configuration
config = parse_arguments("convert", definition, "Convert a quantity from one unit to another")

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

# Check quantity
if is_photometric_quantity(config.quantity):

    #physical_types = possible_physical_types(config.quantity)
Beispiel #14
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 #15
0
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_required("ski", "file_path", "path to the ski file")

# Add optional
definition.add_optional("input", "directory_path", "path to the input directory")

# Add optional
definition.add_optional("nwavelengths", "integer", "the number of wavelengths (useful for when a file wavelength grid is used and the file is not present)")
definition.add_optional("ncells", "integer", "number of dust cells (useful only when the ski file includes a tree dust grid)")

# Add flag
definition.add_flag("probe", "probe the number of cells (or memory usage) by launching a dry-run of the simulation, if necessary (tree dust grid and ncells not specified)", True)

# Add optional
definition.add_optional("nprocesses", "integer_list", "number of processes", [1, 2, 4, 8, 12, 20])

# Add flag
#definition.add_flag("data_parallel", "with data parallelization mode")

# Flags
Beispiel #16
0
from pts.magic.view.html import scales, colormaps, zooms

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

default_scale = "log"
default_colormap = "viridis"
default_zoom = "toFit"

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

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

# Filters
definition.add_optional("filters", "filter_list", "filters")

# Preload
definition.add_flag("preload_all", "preload all images", False)
definition.add_optional("preload", "filter_list",
                        "filters for which to preload the image")

# View settings
definition.add_optional("scale",
                        "string",
                        "scale",
                        default_scale,
                        choices=scales)
definition.add_optional("colormap",
                        "string",
                        "color map",
Beispiel #17
0
from pts.core.tools import filesystem as fs
from pts.dustpedia.core.database import DustPediaDatabase, get_account
from pts.dustpedia.core.sample import DustPediaSample
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.services.s4g import get_galaxy_names, has_galaxy
from pts.core.basics.map import Map
from pts.core.basics.log import log
from pts.core.basics.table import SmartTable

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

# Create the configuration
definition = ConfigurationDefinition()

#
definition.add_optional("ngalaxies", "positive_integer", "max number of galaxies")

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

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

# Create the database instance
database = DustPediaDatabase()
#username, password = get_account()
#database.login(username, password)

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

sample = DustPediaSample()
galaxy_names = sample.get_names()
Beispiel #18
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

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

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

definition.add_optional("fwhm", "positive_real", "FWHM in pixels", 5.)
definition.add_optional("shape", "integer_tuple", "shape", (300, 500))

definition.add_optional("nsources", "positive_integer", "number of sources",
                        100)
definition.add_optional("flux_range",
                        "real_range",
                        "range of flux of sources",
                        "500>1000",
                        convert_default=True)

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

definition.add_optional("constant_sky", "real", "constant sky value", 5.)

definition.add_flag("rotate", "rotate", True)
Beispiel #19
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()

# Optional
definition.add_optional("default_fwhm",
                        "quantity",
                        "default FWHM",
                        "2.0 arcsec",
                        convert_default=True)
definition.add_optional("sigma_level", "real", "sigma level", 4.0)

# -----------------------------------------------------------------
Beispiel #20
0
origins = ["model", "fitting_run"]
dust_grid_types = ["cartesian", "bintree", "octtree"]
default_dust_grid_type = "bintree"

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

definition.add_required("origin",
                        "string",
                        "origin of the analysis model",
                        choices=origins)

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

# Give the analysis run a custom name
definition.add_optional("name",
                        "string",
                        "name for the analysis run",
                        forbidden=run_names)

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

# Settings for the wavelength grid generation
definition.add_section("wg", "settings for the wavelength grids")
definition.sections["wg"].add_optional("npoints", "positive_integer",
                                       "range of the wavelength grid size",
                                       450)
definition.sections["wg"].add_flag(
    "add_emission_lines", "add emission lines to the wavelength grids", True)
definition.sections["wg"].add_optional("range",
                                       "quantity_range",
                                       "range of wavelengths",
                                       "0.1 micron > 2000 micron",
Beispiel #21
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 definition
definition = ConfigurationDefinition(write_config=False)

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

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

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

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

# PSF model
definition.add_fixed("psf_model", "psf model", "gaussian")
Beispiel #22
0
# Create the configuration definition
definition = ConfigurationDefinition()

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

# 3D data file
definition.add_required("filename", "file_path", "path of the 3D data file")

# Orientations
definition.add_required("orientations", "string_list", "orientations from which to project the data", choices=orientations)

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

# Width/height
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)
Beispiel #23
0
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"
)

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

# Get the path to the PTS repository
pts_repo_path = introspection.pts_package_dir
Beispiel #24
0
# *****************************************************************

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

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

definition.add_flag("only_local", "only evaluate PSFs locally", True)
Beispiel #25
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()

# Optional
definition.add_optional("default_fwhm", "quantity", "default FWHM", "2.0 arcsec", convert_default=True)
definition.add_optional("sigma_level", "real", "sigma level", 4.0)

# -----------------------------------------------------------------
Beispiel #26
0
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")

# Commands to be run
definition.add_optional("commands", "string_list", "commands to be run in interactive mode")
Beispiel #27
0
from pts.core.basics.animation import Animation
from pts.core.basics.apng import APNG
from pts.core.basics.numpngw import write_apng

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

formats = ["avi", "gif", "apng"]
default_format = "gif"

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

# Create the definition
definition = ConfigurationDefinition()

# File format
definition.add_optional("format", "string", "output format", default_format, choices=formats)
definition.add_optional("fps", "positive_integer", "frames per second", 10)

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

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

# Add the frames
paths = fs.files_in_cwd(extension="png", sort=int)

# Determine path
path = "animation." + config.format

# APNG
if config.format == "apng":
Beispiel #28
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.basics.table import SmartTable
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.core.tools import filesystem as fs
from pts.core.tools import sequences

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

# Create configuration
definition = ConfigurationDefinition(write_config=False)
definition.add_required("filename", "file_path", "table file")
definition.add_required("old_name", "string", "original column name")
definition.add_required("new_name", "string", "new column name")
definition.add_optional("method", "string", "table reading method", "lines")
config = parse_arguments("remove_columns", definition)

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

# Load the table
table = SmartTable.from_file(config.filename, method=config.method)

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

# Rename
table.rename_column(config.old_name, config.new_name)

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

# Save
Beispiel #29
0
# -----------------------------------------------------------------

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

# Add features
definition.add_flag("smooth", "add smooth curves to plot")
definition.add_flag("statistics", "add statistics to plot")
Beispiel #30
0
environment = load_modeling_environment_cwd()
suite = environment.static_model_suite

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

dust_grid_types = ["cartesian", "bintree", "octtree"]
default_dust_grid_type = "bintree"

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

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

# Name of the representation
if suite.has_representations: definition.add_required("name", "string", "name for the representation", forbidden=suite.representation_names)
else: definition.add_optional("name", "string", "name for the representation", default="highres")

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

# Dust grid properties
definition.add_section("dg", "settings for the dust grid")
definition.sections["dg"].add_optional("grid_type", "string", "type of dust grid", default_dust_grid_type, choices=dust_grid_types)
definition.sections["dg"].add_optional("scale", "real", "number of image pixels to take as the minimum scale in the model (can also be a certain fraction of a pixel)", 0.5)
definition.sections["dg"].add_optional("bintree_min_level", "integer", "minimum depth level for binary trees", 9)
definition.sections["dg"].add_optional("octtree_min_level", "integer", "minimum depth level for octrees", 3)
definition.sections["dg"].add_optional("max_mass_fraction", "real", "maximum mass fraction in each cell", 0.5e-6)
definition.sections["dg"].add_optional("scale_heights", "real", "number of times to take the dust scale height as the vertical radius of the dust grid", 10.)
Beispiel #31
0
# Create the configuration
definition = ConfigurationDefinition()

# Add flags
definition.add_flag("check_hosts",
                    "check the availability of the remote hosts", True)
definition.add_flag("deploy", "deploy SKIRT and PTS where necessary", False)
definition.add_flag("check_versions",
                    "check versions of SKIRT and PTS where necessary", True)
definition.add_flag("update_dependencies", "update PTS dependencies", False)

# Advanced settings
definition.add_flag("local", "keep computationaly heavy computations local")
definition.add_optional(
    "remotes",
    "string_list",
    "remote hosts for computationally heavy computations (overrule the modeling configuration)",
    choices=find_host_ids())
definition.add_flag(
    "fitting_local",
    "launch the simulations as part of the fitting locally (overrule the modeling configuration"
)
definition.add_optional(
    "fitting_remotes",
    "string_list",
    "remote hosts for the fitting (overrule the modeling configuration)",
    choices=find_host_ids())
definition.add_flag("attached", "run remote computations in attached mode")
definition.add_flag("fitting_attached",
                    "run the simulations remotely in attached mode")
Beispiel #32
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
from pts.evolve.solve.extremizer import genetic_definition

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

# Settings
#definition.add_optional("nruns", "positive_integer", "number of runs", 2)
definition.add_optional("ngenerations", "positive_integer",
                        "number of generations", 10)
definition.add_optional("nindividuals", "even_integer",
                        "number of individuals per generation", 100)

# Genetic settings
definition.import_section("genetic", "genetic algorithm settings",
                          genetic_definition)

# Flags
definition.add_flag("plot", "plot", True)

# -----------------------------------------------------------------
Beispiel #33
0
# *****************************************************************

# 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",
Beispiel #34
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()

# The galaxy name
definition.add_required("galaxy_name", "string", "galaxy name")

# Flags
definition.add_flag("write", "write the components and properties", False)
definition.add_flag("show", "show the parameters", True)

# The output directory
definition.add_optional("output", "directory_path", "output directory", letter="o")

# -----------------------------------------------------------------
Beispiel #35
0
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(
    "keep", "keep the output generated by the different SKIRT simulations")

# -----------------------------------------------------------------
Beispiel #36
0
# Import the relevant PTS classes and modules
from pts.core.basics.configuration import ConfigurationDefinition, parse_arguments
from pts.magic.tools.segments import segments_to_regions
from pts.magic.core.segmentationmap import SegmentationMap

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

# Initialize definition
definition = ConfigurationDefinition()

# Add options
definition.add_required("segments", "file_path", "segmentation map")
definition.add_required("regions", "string", "path of the output regions file")

# Add optional
definition.add_optional("mask", "string", "path to an output mask file")
definition.add_optional(
    "offset", "real",
    "offset to make the regions larger or smaller, in pixels")

#definition.add_optional("", )
# parser.add_argument("--xc", nargs='?', const=1, help="Optional: If you don't want to mask the galaxy with the given x-coordinate of the center",type=str, default=None)
# parser.add_argument("--yc", nargs='?', const=1, help="Optional: If you don't want to mask the galaxy with the given y-coordinate of the center",type=str, default=None)

# parser.add_argument("--fits_slice", nargs='?', const=1, help="Optional: Fits slice in the segmentation map to be used. Default 0.",type=str, default='0')

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

# -----------------------------------------------------------------
Beispiel #37
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.modeling.core.environment import find_modeling_environment_up_cwd
from pts.magic.plot.imagegrid import ResidualImageGridPlotter
from pts.core.tools import filesystem as fs
from pts.magic.core.frame import Frame

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

# Create the configuration definition
definition = ConfigurationDefinition()
definition.add_optional("not_filters", "lazy_broad_band_filter_list", "don't show these filters")

definition.add_flag("downsample", "perform downsampling")
definition.add_optional("max_npixels", "positive_integer", "maximum number of pixels to enabled downsampling", 400)
definition.add_flag("truncate", "truncate the images", True)

definition.add_flag("distributions", "show residual distributions", False)

# Extra
definition.add_flag("normalize", "normalize the images")
definition.add_optional("share_scale_with", "string", "share the scale of all other images with this image")
definition.add_optional("colormap", "string", "colormap", "viridis")

# Extra
definition.add_flag("write_data", "write data")
Beispiel #38
0
# Create the configuration definition
definition = ConfigurationDefinition()

# The fitting run name
if runs.empty: raise ValueError("No analysis runs present (yet)")
elif runs.has_single: definition.add_fixed("run", "name of the fitting run", runs.single_name)
else: definition.add_required("run", "string", "name of the fitting run for which to (re)make the wavelength grids", choices=runs.names)

# Options
definition.add_flag("basic", "make basic wavelength grids", True)
definition.add_flag("refined", "make refined wavelength grids", True)
definition.add_flag("highres", "make high-resolution wavelength grids", True)

# Settings for the wavelength grid generation
definition.add_optional("npoints_range_basic", "integer_range", "range of the basic wavelength grid size", default_npoints_range_basic, convert_default=True)
definition.add_optional("npoints_range_refined", "integer_range", "range of the refined wavelength grid size", default_npoints_range_refined, convert_default=True)
definition.add_optional("npoints_range_highres", "integer_range", "range of the high-resolution wavelength grid size", default_npoints_range_highres, convert_default=True)
definition.add_optional("ngrids_basic", "integer", "number of basic wavelength grids to generate", default_ngrids_basic)
definition.add_optional("ngrids_refined", "integer", "number of refined wavelength grids to generate", default_ngrids_refined)
definition.add_optional("ngrids_highres", "integer", "number of high-resolution wavelength grids to generate", default_ngrids_highres)
definition.add_flag("add_emission_lines", "add emission lines to the wavelength grids", True)
definition.add_optional("range", "quantity_range", "range of wavelengths", default_wavelength_range, convert_default=True)

# Backup existing wavelength grids
definition.add_flag("backup", "backup existing wavelength grids", True)

# Create the configuration
config = parse_arguments("make_wavelength_grids", definition, "(Re)make the wavelength grids for a fitting run")

# -----------------------------------------------------------------
Beispiel #39
0
# 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)

    # Check whether retrieved (specific to remote simulations)
    if not simulation.retrieved: raise ValueError("The simulation has not been retrieved yet")
Beispiel #40
0
# **       © Astronomical Observatory, Ghent University          **
# *****************************************************************

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

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

# Create the configuration
definition = ConfigurationDefinition()

# Add prequired
definition.add_required("ski", "file_path", "name or path of the ski file")

# Add optional argument
definition.add_optional("input", "directory_path",
                        "path to the input directory")

# Add required
definition.add_required("nnodes", "integer", "number of nodes")
definition.add_required("nsockets", "integer", "number of sockets per node")
definition.add_required("ncores", "integer", "number of cores per socket")
definition.add_required("memory", "real", "available virtual memory per node")

# Add flags
definition.add_flag("mpi", "mpi available", True)
definition.add_flag("hyperthreading", "use hyperthreading", False)
definition.add_optional("threads_per_core", "integer",
                        "number of hyperthreads per core")

# Add optional
definition.add_optional(
Beispiel #41
0
# -----------------------------------------------------------------

# 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
definition.add_flag("round", "round the table values")
definition.add_optional("ndecimal_places", "positive_integer", "number of decimal places when rounding")

# Additional options
definition.add_flag("unique", "show only the unique in each column")
definition.add_flag("sorted_unique", "sort the unique values")
Beispiel #42
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.modeling.tests.NGC4013.test import fitting_filter_names, free_parameters, free_parameter_labels

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

# Simulation
definition.add_optional("npackages", "positive_integer",
                        "number of photon packages", int(1e4))

# Free parameters
definition.add_optional("free_parameters",
                        "string_list",
                        "list of free parameters",
                        free_parameter_labels,
                        choices=free_parameters)

# Fitting filters
definition.add_optional("fitting_filters",
                        "filter_list",
                        "filters for the fitting",
                        fitting_filter_names,
                        convert_default=True)
Beispiel #43
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.modeling.tests.base import default_free_parameters, possible_free_parameters
from pts.evolve.solve.extremizer import genetic_definition

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

# Optional settings
definition.add_optional("nwavelengths", "positive_integer", "number of wavelengths for the reference simulation", 50)
definition.add_optional("npackages", "positive_integer", "number of photon packages per wavelength for the reference simulation", int(1e5))
definition.add_optional("dust_grid_relative_scale", "real", "smallest scale of the dust grid relative to the pixelscale of the input maps", 2.)
definition.add_optional("dust_grid_min_level", "positive_integer", "level for the dust grid", 2)
definition.add_optional("dust_grid_max_mass_fraction", "positive_real", "max mass fraction for the dust grid", 1e-6)

# Flags
definition.add_flag("transient_heating", "enable transient heating", False)
definition.add_flag("selfabsorption", "enable dust selfabsorption", False)

# For remote execution
definition.add_optional("host_ids", "string_list", "remote hosts to use for heavy computations and simulations", choices=find_host_ids())
definition.add_flag("attached", "launch remote executions in attached mode", False)

# Fitting
definition.add_optional("ngenerations", "positive_integer", "number of generations", 5)
Beispiel #44
0
# *****************************************************************

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

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

# Create the configuration definition
definition = ConfigurationDefinition()

definition.add_flag(
    "use_frame_fwhm",
    "If possible, avoid the fitting procedure and use the FWHM defined by the frame",
    True)
definition.add_optional("input_path", "directory_path",
                        "path to the input directory")
definition.add_optional("output_path", "directory_path",
                        "path to the output directory")
definition.add_flag("track_record", "track record", False)
definition.add_flag("plot_track_record_if_exception", True)
definition.add_optional("manual_region", "file_path", "manual star region")
definition.add_flag("remove", "remove stars from the frame", True)
definition.add_flag("find_saturation", "find saturated stars", True)

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

# Settings for fetching the catalogs
definition.add_section("fetching", "fetching")

# THE CATALOGS
default_catalogs = ["2MASS"]
Beispiel #45
0
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")
#definition.sections["input"].add_optional("segments", "file_path", "image with segmentation maps (as planes 'galaxies', 'stars' and 'other_sources')", "segments.fits")

# Number of parallel processes
Beispiel #46
0
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 #47
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 #48
0
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")
definition.add_optional("retrieve_crashed", "string_integer_list_dictionary", "retrieve crashed simulations for these hosts and simulation IDs")
definition.add_flag("check_data", "for crashed simulations, check whether the simulation data is valid")

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

definition.add_flag("ignore_missing_data", "ignore missing data when analysing the simulations", False)
definition.add_flag("batch_replace", "replace timing and memory information when a simulation is ")

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

definition.add_flag("offline", "run in offline mode: only analyse already retrieved simulations and tasks, don't try to connect to remotes")

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

# ADVANCED
definition.add_optional("nopen_files", "positive_integer", "number of allowed open files", 2000)
Beispiel #49
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
definition = ConfigurationDefinition()

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

# Interactive mode
definition.add_flag("interactive", "use interactive mode", default=None)

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

# Showing
definition.add_flag("show", "show stuff", True)
definition.add_flag("show_components", "show the model components", False)

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

# Writing
definition.add_flag("write", "do writing", True)
Beispiel #50
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

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

# 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:
definition.add_optional("python_name", "string_no_spaces", "name for the python environment for PTS (also the alias for the python executable)", "python_pts")
Beispiel #51
0
# *****************************************************************

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

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

definition.add_optional("types", "string_list", "only adapt properties of these types")
Beispiel #52
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")

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