Skip to main content

Package for post-processing of results obtained with the Beagle SED fitting tool

Project description

PyP-BEAGLE

PyP-BEAGLE (Python Postprocessing of BEAGLE) is a Python package to postprocess the analyses performed with the galaxy SED modelling tool Beagle (BayEsian Analysis of GaLaxy sEds). PyP-BEAGLE allows one to create different types of publication-quality plots, LaTeX tables, as well as several higher level "summary" catalogues.

Installing PyP-BEAGLE

  • Make sure that you have a (science-ready!) installation of Python 2.7, for instance Anaconda (the Python 2.7 version)

  • To install PyP-BEAGLE simply run

    pip install pyp_beagle
    

Known issues

  • On a Mac OS, multiprocessing only works with the Agg backend. Make sure that your ~/.matplotlib/matplotlibrc file contains the line

    backend      : Agg
    
  • If you encounter errors related to LaTeX, or if the visual appearance of the plots is not satisfying, you can copy the matplotlib configuration file script/matplotlibrc into your $HOME/.matplotlib/ folder (if the folder does not exist, create it). If you already have a customized matplotlibrc file, then you can use the GNU diff command to update it.

  • PyP-BEAGLE assumes that the Beagle environment variables are correctly set on your machine. Note that while these are the same environment variables used by Docker-Beagle (see here), they have to point to the actual folders on your machine, not to the "virtual" folder that Docker-Beagle uses. To correctly set the environment variables, you can use the scripts/BEAGLE_env_variable.bash or scripts/BEAGLE_env_variable.csh files. In practice, after modifying the file to reflect your Beagle folder tree, you can simply add at the end of your .bashrc (or .tcshrc, or equivalent) the line

source <full path to the file>/BEAGLE_env_variable.bash

Using PyP-BEAGLE

The post-processing of Beagle results is performed by means of the command pyp_beagle. Since PyP-BEAGLE is often updated, you can visualize the (entire) possible options via the PyP-BEAGLE help, with the command

pyp_beagle --help

Below we report a few of some common PyP-BEAGLE use cases and related commands.

Plotting the posterior probability distributions (aka "triangle plots")

Command

pyp_beagle -r <your Beagle results folder> \
--plot-triangle \
[-np <number of processors>] \
[--json-triangle <JSON triangle file>] \
[--mock-catalogue <input mock catalogue>] \
[--json-mock <JSON mock file>]

where

  • <your Beagle results folder> must be replaced by the full path to the Beagle output directory;
  • <number of processors> is an integer indicating how many processors can be used for the parallel execution of the script. This is particularly important when producing plots for large (> 1000) samples, as the creation of each individual plot can take several tens of seconds.
  • <JSON triangle file> is a JSON file used for the configuration of the triangle plot (which parameters should be plotted, log scale, plot limits, ...), an example can be found here;
  • <input mock catalogue> indicates a Beagle FITS file containing the input (i.e. "true") physical parameters used to construct the noiseless SEDs which have then been fitted with Beagle (after the noise addition, which must be performed outside Beagle). Note that in this case, a <JSON mock file> must be passed, since we must instruct PyP-BEAGLE where (in which FITS extension and column) to find the "true" parameters. An example of the <JSON mock file> to be used in this case can be found here.

Output

The successful execution of the script will create a set of *_triangle.pdf files (one per object) in the <your Beagle results folder>/pyp-beagle/plot folder.

Plotting the comparison of data and model observables (aka "marginal plots")

Command

pyp_beagle -r <your Beagle results folder> \
--plot-marginal \
[-np <number of processors>] \
[--log-wavelength] \
[--plot-line-labels] \
[--spectral-resolution <resolution>] \

where

  • <your Beagle results folder> must be replaced by the full path to the Beagle output directory;
  • <number of processors> is an integer indicating how many processors can be used for the parallel execution of the script. This is particularly important when producing plots for large (> 1000) samples, as the creation of each individual plot can take several tens of seconds;
  • <resolution> is a float indicating the resolution of the spectra, and it is used to determine which emission line labels are printed on the plot.

Output

The successful execution of the script will create a set of *_marginal_SED_spec.pdf files (one per object) in the <your Beagle results folder>/pyp-beagle/plot folder.

Computing a summary catalogue

Command

pyp_beagle -r <your Beagle results folder> 
--compute-summary
[--json-summary <JSON summary file>]

where

  • <your Beagle results folder> must be replaced by the full path to the Beagle output directory;
  • <JSON summary file> is a JSON file used for the configuration of the summary catalogue, specifying for which parameters the summary statistics (posterior mean and median, 68 and 95 % credible regions) should be computed. An example can be found here.

Output

The successful execution of the script will create the file <your Beagle results folder>/pyp-beagle/data/BEAGLE_summary_catalogue.fits.

Plotting the comparison of input and retrieved parameters when fitting mock observations

Command

pyp_beagle -r <your Beagle results folder> 
--mock-catalogue <input mock catalogue> \
--json-mock <JSON mock file>

where

  • <your Beagle results folder> must be replaced by the full path to the Beagle output directory;
  • <input mock catalogue> indicates a Beagle FITS file containing the input (i.e. "true") physical parameters used to construct the noiseless SEDs which have then been fitted with Beagle (after the noise addition, which must be performed outside Beagle). Note that in this case, a <JSON mock file> must be passed, since we must instruct PyP-BEAGLE where (in which FITS extension and column) to find the "true" parameters. An example of the <JSON mock file> to be used in this case can be found here.

Output

The successful execution of the script will create the files <your Beagle results folder>/pyp-beagle/plot/BEAGLE_mock_retrieved_params_hist.pdf and <your Beagle results folder>/pyp-beagle/plot/BEAGLE_mock_retrieved_params.pdf.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyp_beagle-0.6.6.tar.gz (64.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyp_beagle-0.6.6-py2.7.egg (156.2 kB view details)

Uploaded Egg

File details

Details for the file pyp_beagle-0.6.6.tar.gz.

File metadata

  • Download URL: pyp_beagle-0.6.6.tar.gz
  • Upload date:
  • Size: 64.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for pyp_beagle-0.6.6.tar.gz
Algorithm Hash digest
SHA256 06c84cc575a3509381810be5e100fdcd2610c48303af8d0dfb8efab3933df009
MD5 79ecd9ddf7a3436a691c4190626923b0
BLAKE2b-256 9cfcdcf05bd740a78ea93316ab71bfefc1d9c04de00611ef2ca520855deae2f8

See more details on using hashes here.

File details

Details for the file pyp_beagle-0.6.6-py2.7.egg.

File metadata

  • Download URL: pyp_beagle-0.6.6-py2.7.egg
  • Upload date:
  • Size: 156.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.14

File hashes

Hashes for pyp_beagle-0.6.6-py2.7.egg
Algorithm Hash digest
SHA256 ac677f4a23908a7afb40b74e7ad7ca633a27ebd6f169df1e258aaeeb0bc6c201
MD5 7069f2ada5ed01442c24ff854e3787e9
BLAKE2b-256 7772bdd1992ffdefa54f1083f571238be418cef106613a856d3ab1b7c5f80e7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page