Example #1
0
definition.add_flag("write_steps", "write the results of intermediate steps")

# Sky subtraction
definition.add_flag("write_sky_apertures",
                    "write sky apertures and sky annulus")
definition.add_optional(
    "sky_apertures_path", "directory_path",
    "the path to the directory where the aperture frames and annulus region should be written to"
)

definition.add_flag("calculate_calibration_uncertainties",
                    "calculate calibration uncertainties", True)

# Source extraction
definition.add_flag("extract_sources", "extract sources", True)
definition.import_section("extraction", "star extraction options",
                          extraction_definition)

# Galactic extinction
definition.add_flag("correct_for_extinction",
                    "correct for galactic extinction", True)
definition.add_optional("attenuation", "real", "the galactic attenuation")

# Unit conversion
definition.add_flag("convert_unit", "convert unit", True)
definition.add_section("unit_conversion", "unit conversion")
definition.sections["unit_conversion"].add_optional("to_unit", "unit",
                                                    "target unit", "MJy/sr")

# Convolution
definition.add_flag("convolve", "convolve")
definition.add_section("convolution", "convolution")
Example #2
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.evolve.solve.extremizer import genetic_definition

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

# Create the configuration
definition = ConfigurationDefinition()

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

# Add
definition.sections["genetic"].add_optional("ngenerations", "positive_integer",
                                            "number of generations", 10)
definition.sections["genetic"].add_optional(
    "nindividuals", "even_integer", "number of individuals per generation",
    100)

# -----------------------------------------------------------------
Example #3
0
File: config.py Project: SKIRT/PTS
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)
definition.add_optional("nsimulations", "even_positive_integer", "number of simulations per generation", 30)
definition.add_optional("npackages_fitting", "positive_integer", "number of photon packages for each fitting simulation", int(1e4))

# Free parameters
definition.add_optional("free_parameters", "string_list", "free parameter labels", choices=possible_free_parameters, default=default_free_parameters)
definition.add_optional("relative_range_initial", "real_range", "relative range for generating the initial parameter values", default="0.3>3", convert_default=True)
definition.add_optional("relative_range_fitting", "real_range", "relative range of the free parameter values for the fitting", default="0.1>20", convert_default=True)

# Wavelength grid
definition.add_optional("wavelength_range", "quantity_range", "range of wavelengths", "0.1 micron > 2000 micron", convert_default=True)

# Dust grid
definition.add_optional("physical_domain_disk_ellipse_factor", "positive_real", "factor of the disk ellipse region to take as the physical domain of the model", 0.82)

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

# Flags
definition.add_flag("spectral_convolution", "use spectral convolution to calculate observed fluxes", False)

# -----------------------------------------------------------------
Example #4
0
File: status.py Project: SKIRT/PTS
# 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)

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

# Add section for analysis options
definition.import_section("analysis", "analyser options", analysis_definition)

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

definition.add_flag("simulations", "get status of simulations", True)
definition.add_flag("tasks", "get status of tasks", True)

# -----------------------------------------------------------------
Example #5
0
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")
definition.add_flag("extrema", "add extrema to plot")
definition.add_flag("minima", "add minima", None)
definition.add_flag("maxima", "add maxima", None)
definition.add_flag("hatches", "add hatches", False)
Example #6
0
# 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)

definition.add_flag("manual", "don't find sources, but mark them from the catalog, and let the selection be done manually", False)

# Cache
cache_host_id = get_cache_host_id(modeling_path)
if cache_host_id is not None: definition.add_flag("cache", "cache image data for which the initialized image has been created", False)
else: definition.add_fixed("cache", "caching not possible since cache host id not defined", False)

# -----------------------------------------------------------------
Example #7
0
# 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)
definition.import_section("batch", "batch analysis options", batch_definition)

# Remove certain settings from the sections
definition.sections["basic"].remove_positional_optional("remote")
definition.sections["basic"].remove_positional_optional("id")
definition.sections["batch"].remove_positional_optional("remote")
definition.sections["batch"].remove_positional_optional("id")

# -----------------------------------------------------------------
Example #8
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.evolve.solve.extremizer import genetic_definition

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

# Create the configuration
definition = ConfigurationDefinition()

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

# Add
definition.sections["genetic"].add_optional("ngenerations", "positive_integer", "number of generations", 10)
definition.sections["genetic"].add_optional("nindividuals", "even_integer", "number of individuals per generation", 100)

# -----------------------------------------------------------------
Example #9
0
File: config.py Project: SKIRT/PTS
# **       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.find_sources import definition as sources_definition

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

# Create definition
definition = ConfigurationDefinition(write_config=False)

# Galaxy
definition.add_optional("galaxy_name", "string", "name of the galaxy", "M51")
definition.add_optional("filter", "filter", "image filter", "R")
definition.add_optional("year", "positive_integer", "year of the image")

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

# Flags
default_catalogs = ["2MASS"]
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)

# Manual (use SourceMarker)
definition.add_flag("manual", "don't find sources, but mark them from the catalog, and let the selection be done manually", False)

# -----------------------------------------------------------------
Example #10
0
    "region indicating areas that require special attention")
definition.add_optional("ignore_region", "file_path",
                        "region indicating areas that should be ignored")

# Output
definition.add_optional("output",
                        "directory_path",
                        "output directory",
                        letter="o")
definition.add_optional("input",
                        "directory_path",
                        "input directory",
                        letter="i")

# Sections
definition.import_section("extended", "options for extended source finder",
                          extended_definition)
definition.import_section("point", "options for point source finder",
                          point_definition)
definition.import_section("other",
                          "options for finding other contaminating sources",
                          other_definition)

# Flags
definition.add_flag(
    "weak",
    "only do weak search: find point source positions, create regions and segments but let user adjust them manually, no segmentation or source finding",
    False)
definition.add_flag("write", "writing", True)

definition.add_flag(
    "catalog_overlapping",
Example #11
0
# Wavelength grid
definition.add_optional("wavelength_range",
                        "quantity_range",
                        "range of wavelengths",
                        "0.1 micron > 2000 micron",
                        convert_default=True)

# Dust grid
definition.add_optional(
    "physical_domain_disk_ellipse_factor", "positive_real",
    "factor of the disk ellipse region to take as the physical domain of the model",
    0.82)

# Genetic section
definition.import_section("genetic", "genetic algorithm options",
                          genetic_definition)
#definition.sections["genetic"].optional["crossover_method"].default = ""
#definition.sections["genetic"].optional["nelite_individuals"].default = 2
definition.sections["genetic"].optional["mutation_rate"].default = 0.07
definition.sections["genetic"].optional[
    "genome_type"].default = "binary_string"
#definition.sections["genetic"].flags["gray_code"].default = True # IS ALREADY TRUE BY DEFAULT

# Flags
definition.add_flag("spectral_convolution",
                    "use spectral convolution to calculate observed fluxes",
                    False)
definition.add_flag(
    "cheat",
    "cheat by putting the real parameter values into the initial population of models",
    False)
Example #12
0
# -----------------------------------------------------------------

default_residual_reference = "models"
residual_references = ["models", "observations"]

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_positional_optional("seds", "filepath_list",
                                   "SED files to be plotted")

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

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

# Residual reference
definition.add_optional("residual_reference",