示例#1
0
from pts.core.simulation.simulation import createsimulations
from pts.core.extract.timeline import TimeLineExtractor, TimeLineTable
from pts.core.plot.timeline import TimeLinePlotter
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration
definition = ConfigurationDefinition()

# Add flags
definition.add_flag("table", "save the extracted timeline table")

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

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

# Look for a file in the current working directory that contains extracted timeline information
timeline_table_path = fs.join(fs.cwd(), "timeline.dat")
if fs.is_file(timeline_table_path):
    table = TimeLineTable.from_file(timeline_table_path)

    # If extracted timeline information is not present, first perform the extraction
else:

    # Create a SkirtSimulation object based on a log file present in the current working directory
    simulation = createsimulations(single=True)
示例#2
0
# Import the relevant PTS classes and modules
from pts.core.tools import logging, time
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add setting
definition.add_required("step", str, "the modeling step for which to clear the output")

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

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

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

# Determine the log level
level = "DEBUG" if config.arguments.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting clear ...")

# -----------------------------------------------------------------
示例#3
0
文件: scaling.py 项目: wdobbels/CAAPR
    0)
definition.add_optional("cluster", str, "the name of the cluster", None)
definition.add_optional("wavelengths", float,
                        "boost the number of wavelengths by a certain factor",
                        None)
definition.add_optional(
    "packages", float,
    "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")

# Get configuration
reader = ConfigurationReader(
    "scaling", "Test the scaling of SKIRT on a particular system")
config = reader.read(definition)

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting scaling ...")
示例#4
0
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"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting initialize_data ...")
示例#5
0
from pyevolve import Mutators
from pyevolve import Initializators
from pyevolve import Consts
from pts.core.tools.logging import log
from pts.core.tools import time
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Configuration
definition = ConfigurationDefinition()
definition.add_positional_optional("seed", int, "the random seed", 4357)

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

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

x = np.linspace(12,25,100)

test_data_x = [20., 16., 19.79999924, 18.39999962, 17.10000038, 15.5, 14.69999981, 17.10000038, 15.39999962,
               16.20000076,
               15., 17.20000076, 16., 17., 14.39999962]
test_data_y = [88.59999847, 71.59999847, 93.30000305, 84.30000305, 80.59999847, 75.19999695, 69.69999695, 82.,
               69.40000153, 83.30000305, 79.59999847, 82.59999847, 80.59999847, 83.5, 76.30000305]

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

def fit_function(x, a, b):
示例#6
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import logging, time
from pts.core.tools import filesystem as fs
from pts.core.tools import introspection
from pts.dustpedia.core.database import DustPediaDatabase, get_account
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration definition
definition = ConfigurationDefinition()

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

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting list_galaxies ...")

# -----------------------------------------------------------------
示例#7
0
from pts.core.tools import filesystem as fs
from pts.magic.core.frame import Frame
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader
from pts.core.simulation.wavelengthgrid import WavelengthGrid
from pts.magic.core.image import Image
from pts.magic.core.datacube import DataCube
from pts.magic.tools import plotting
from pts.core.basics.filter import Filter

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Get configuration
reader = ConfigurationReader("check_simulated_images")
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"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting check_simulated_images ...")
示例#8
0
文件: explore.py 项目: wdobbels/CAAPR
from pts.evolve import mutators
from pts.evolve import initializators
from pts.evolve import constants
from pts.core.tools.logging import log
from pts.core.tools import time
from pts.core.tools.random import setup_prng, save_state
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Configuration
definition = ConfigurationDefinition()
definition.add_positional_optional("seed", int, "the random seed", 4357)

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

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

seed = config.seed
prng = setup_prng(seed)

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

# path to the GA object
path = fs.join(fs.cwd(), "ga.pickle")

# Path to the parameter table
parameters_path = fs.join(fs.cwd(), "parameters.dat")
示例#9
0
# -----------------------------------------------------------------

# Configuration
definition = ConfigurationDefinition()

# Galaxy name
definition.add_required("galaxy_name", str, "the name of the galaxy")
definition.add_required("band", str, "the band (GALEX or SDSS u/g/r/i/z)")

# Optional
definition.add_optional("remote", str, "the remote host name", None)

# Get configuration
reader = ConfigurationReader(
    "get_poisson_errors",
    "Calculate poisson error maps for DustPedia UV and optical images")
config = reader.read(definition)
arguments = reader.get_arguments()

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
示例#10
0
    from pts.core.basics.configuration import ConfigurationReader

    ## GET THE CONFIGURATION DEFINITION

    configuration_name = tables[subproject]["Configuration"][index]
    if configuration_name == "--": configuration_name = command_name
    configuration_module_path = "pts." + subproject + ".config." + configuration_name

    configuration_module = importlib.import_module(configuration_module_path)

    definition = getattr(configuration_module, "definition")

    ## CREATE THE CONFIGURATION

    # Create the ConfigurationReader
    reader = ConfigurationReader(command_name, description, log_path="log")

    # Create the configuration from the definition and from reading the command line arguments
    config = reader.read(definition)

    ## SETUP LOGGER

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

    # Determine the log level
    level = "DEBUG" if config.debug else "INFO"

    # Initialize the logger
示例#11
0
from pts.core.tools import introspection
from pts.core.tools.logging import log

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

# Create configuration definition
definition = ConfigurationDefinition()

# Add required
definition.add_required("remote", str, "the remote host ID")

# Add flags
definition.add_flag("versions", "compare versions", "v")

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

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

# Create the remote execution environment
remote = Remote()

# Log in
remote.setup(config.remote)

# Get all python packages installed on the remote host
remote_packages = remote.installed_python_packages

# Get local python package version
local_packages = introspection.installed_python_packages()
示例#12
0
from pts.core.simulation.simulation import createsimulations
from pts.core.extract.progress import ProgressExtractor, ProgressTable
from pts.core.plot.progress import ProgressPlotter
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add flags
definition.add_flag("table", "save the extracted progress table")

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

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

# Look for a file in the current working directory that contains extracted progress information
progress_table_path = fs.join(fs.cwd(), "progress.dat")
if fs.is_file(progress_table_path):
    table = ProgressTable.from_file(progress_table_path)

    # If extracted progress information is not present, first perform the extraction
else:

    # Create a SkirtSimulation object based on a log file present in the current working directory
    simulation = createsimulations(single=True)
示例#13
0
from pts.core.tools import time

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

# Configuration
definition = ConfigurationDefinition()

# Galaxy name
definition.add_required("galaxy_name", str, "the name of the galaxy")
definition.add_required("band", str, "the band (GALEX or SDSS u/g/r/i/z)")

# Optional
definition.add_optional("remote", str, "the remote host name", None)

# Get configuration
reader = ConfigurationReader("get_poisson_errors", "Calculate poisson error maps for DustPedia UV and optical images")
config = reader.read(definition)
arguments = reader.get_arguments()

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting get_poisson_errors ...")
示例#14
0
文件: setup.py 项目: wdobbels/CAAPR
# Import the relevant PTS classes and modules
from pts.core.tools import logging
from pts.magic.tools import catalogs
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration
definition = ConfigurationDefinition()

# Add required settings
definition.add_required("name", str, "the name of the galaxy")

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level)
log.start("Starting setup ...")

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

# Inform the user
log.info("Resolving the galaxy name ...")
示例#15
0
from pts.core.simulation.simulation import createsimulations
from pts.core.extract.memory import MemoryExtractor, MemoryUsageTable
from pts.core.plot.memory import MemoryPlotter
from pts.core.tools import filesystem as fs
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration definition
definition = ConfigurationDefinition()

# Add flags
definition.add_flag("table", "save the extracted memory table")

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

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

# Look for a file in the current working directory that contains extracted memory information
memory_table_path = fs.join(fs.getcwd(), "memory.dat")
if fs.is_file(memory_table_path): table = MemoryUsageTable.from_file(memory_table_path)

# If extracted memory information is not present, first perform the extraction
else:

    # Create a SkirtSimulation object based on a log file present in the current working directory
    simulation = createsimulations(single=True)

    # Create a new MemoryExtractor instance
示例#16
0
from __future__ import absolute_import, division, print_function

# Import the relevant PTS classes and modules
from pts.core.tools import logging, time
from pts.core.tools import filesystem as fs
from pts.core.tools import introspection
from pts.magic.misc.dustpedia import DustPediaDatabase, get_account
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Create the configuration
definition = ConfigurationDefinition()

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

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

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

# Determine the log level
level = "DEBUG" if config.debug else "INFO"

# Initialize the logger
log = logging.setup_log(level=level, path=logfile_path)
log.start("Starting plot_galaxies ...")

# -----------------------------------------------------------------
示例#17
0
from pts.evolve import initializators
from pts.evolve import constants
from pts.core.tools.logging import log
from pts.core.tools import time
from pts.core.tools import filesystem as fs
from pts.core.tools.random import setup_prng
from pts.core.basics.configuration import ConfigurationDefinition, ConfigurationReader

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

# Configuration definition
definition = ConfigurationDefinition()
definition.add_positional_optional("seed", int, "the random seed", 4357)

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

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

x = np.linspace(12, 25, 100)

test_data_x = [
    20., 16., 19.79999924, 18.39999962, 17.10000038, 15.5, 14.69999981,
    17.10000038, 15.39999962, 16.20000076, 15., 17.20000076, 16., 17.,
    14.39999962
]
test_data_y = [
    88.59999847, 71.59999847, 93.30000305, 84.30000305, 80.59999847,
    75.19999695, 69.69999695, 82., 69.40000153, 83.30000305, 79.59999847,
    82.59999847, 80.59999847, 83.5, 76.30000305