uvex_transients.cli.phase_space#

Parsing and running of a phase-space run-config, for uvex-transients phase-space.

A phase-space run-config describes a survey and a list of maps (see uvex_transients.phase_space), and has nothing to do with the steps: pipeline of RunConfig, so it has its own loader. Its layout is:

schedule:                   # as for :class:`~uvex_transients.cli.config.RunConfig`
  name: uvex_v0.6.0
mission: uvex_fast
seed: 0
overlay: true               # shade the shipped transient classes on every map that can (or ``{n_draws: 1000}``)

detection:                  # shared by every map; each key is overridden by the same key of a map
  snr_threshold: 5.0
  n_visits: 2
simulation:
  mag_limit: 25.0

maps:
  - id: fuv_detection       # names the output directory
    detection: {band: FUV}
  - id: nuv_detection
    detection: {band: NUV}

A map is made of what a sampler needs to measure a point and what the campaign does with the measurements, and each has a section, named for what it decides:

detection:

What counts as a recovery: band, snr_threshold, n_visits, exclude_first_visit_detections, and cuts, a list of the simulator’s cuts for any other definition (below).

simulation:

How a point is simulated: mag_limit (the depth that sets the redshift limit), time_bins, nside and order.

stopping:

How many tries a point gets: chunk_size, k_target and n_max.

settings:

The arguments of the sampler that belong to no section above: the shape of the canonical transient (spectral_index, rise_ratio, fade_mag), the z_max of a breakout. What a sampler takes is in uvex-transients phase-space kinds.

axes:

The ranges of the axes of the map, by name: {log_luminosity: [36.5, 45.0]}.

campaign:

How the campaign spends its points: n_initial, batch_size, max_points, tolerance and acquisition.

grid_size:

Points per axis of the fitted map.

Every key that is left out takes its value from config["phase_space"].

detection:, simulation:, stopping:, settings: and axes: given at the top level are the defaults of the maps of the top-level kind: (the canonical one unless it is given) and of no other kind, since what they set (how many visits make a detection, how finely time is binned, the names of the axes) means something different for each sampler, and a canonical default that leaked into a breakout map would silently change its definition of a detection. A map of another kind takes its defaults from the package configuration (the section named for its kind, then the section of the same name as the run-config’s: phase_space.detection, phase_space.simulation and so on) and its own sections. campaign: and grid_size:, which set how points are placed and not what one is, are shared by every map. To share a section on purpose, use a YAML anchor (detection: &detection {...} and detection: {<<: *detection}).

By default a detection is n_visits observations above snr_threshold. Any other definition is a list of cuts:, the cuts a run-config’s steps: use (see uvex_transients.simulation.core.SurveySimulator.available_cuts()), applied in order to the events a point draws, with the survivors counted as recovered. A cut that takes snr_threshold, n_visits, exclude_first_visit_detections or bands and is not given them gets the map’s:

maps:
  - id: fuv_bracketed
    detection:
      band: FUV
      cuts:
        - cut: snr
          params: {n_visits: 2}
        - cut: time_since_last_nondetection
          params: {max_delay: 1.0}  # days

A map is of the canonical transient unless it names another kind: of sampler (see uvex_transients.phase_space.sampling.base.available_samplers()):

maps:
  - id: breakout_fuv
    kind: breakout
    detection: {band: FUV}
    simulation: {mag_limit: 25.0}
    settings: {z_max: 8.0}
    axes: {log_L0: [43.0, 46.0], log_t0: [3.0, 4.0]}
    grid_size: 40

Each map is run as an Experiment, and writes points.ecsv, map.ecsv and map.png, and overlay.ecsv if its sampler has an overlay (the canonical one does).

The names of the sections of an earlier layout (recovery:, sampler:, transient: and map:) are refused with what replaces them.

The run-config says what to simulate. What is done with the files afterwards (fitting, drawing, comparing) is the job of the other commands of uvex-transients phase-space, which take the directories of maps and no run-config; see uvex_transients.phase_space.stages.

Attributes

SECTIONS

The keys each section may hold.

Functions

dry_run_report(phase_space_config, out_dir, ...)

Describe what a run would do, without loading the schedule, sampling or writing anything.

run_maps(phase_space_config, out_dir, specs, *)

Make the maps, one after the other, each in its own subdirectory of out_dir.

Classes

MapSpec(id, kind, detection, ~typing.Any] =, ...)

One map of a run: an id, a kind and the settings of each section, with the shared ones already merged in.

PhaseSpaceConfig(raw[, source])

A parsed phase-space run-config, resolving the survey lazily on first access.