uvex_transients.utils.results.get_phase_space_map#

uvex_transients.utils.results.get_phase_space_map(map_id: str, files: list[str] | tuple[str, ...] = ('map', 'points', 'overlay'), tag: str | None = None, directory: str | PathLike | None = None, overwrite: bool = False, timeout: float = 60.0) → dict[str, Path][source]#

Download the files of one phase-space recovery map of a published release.

The maps are the ones configs/phase_space.yaml defines, attached to each release as one phase_space.zip; only the requested files of the requested map are downloaded from it. They are read with astropy.table.Table.read(path, format="ascii.ecsv"), or rebuilt into an experiment that can evaluate the map anywhere with ~uvex_transients.phase_space.experiment.Experiment.load.

Parameters:
  • map_id (str) – The id of the map in the run-config, for example "fuv_detection".

  • files (sequence of str, optional) – What to fetch, from PHASE_SPACE_FILES: "map", "points", "overlay" and "figure". The default is the first three, the data products.

  • tag (str, optional) – The release tag. The default is the newest published release.

  • directory (str or os.PathLike, optional) – Place the files directly in this directory instead of the per-release cache directory.

  • overwrite (bool, optional) – Replace an existing file whose size differs from the archive member, instead of raising.

  • timeout (float, optional) – Network timeout in seconds, per request. The default is 60.

Returns:

Each requested file, as named in files, mapped to its local path.

Return type:

dict of str to pathlib.Path

Raises:
  • ConnectionError – If the GitHub releases API cannot be reached.

  • LookupError – If there are no published releases, tag does not exist, the release has no phase-space maps, or the map or a file is not in the archive.

  • ValueError – If a name in files is not one of PHASE_SPACE_FILES.

Examples

from astropy.table import (
    Table,
)
from uvex_transients.utils import (
    get_phase_space_map,
)

paths = get_phase_space_map(
    "fuv_detection", ["map"]
)
grid = Table.read(
    paths["map"], format="ascii.ecsv"
)