Skip to main content

A package collecting things to make nice plots from root files

Project description

Niceplot: A python module to make nice looking plots so I don't re-do the same thing all the time.

Installation:

To install, simply do:

pip install niceplotpy

Non-standard Dependencies:

Niceplot uses the atlasify and uproot packages.

Usage:

After installation, the the module can be used with:

niceplot CONFIG_FILE

Where the CONFIG_FILE includes all information on which plots to make, variables to plot, etc.

Currently supported plot types are: 1dratio, 2dhist and 2dscatter. For detailled example config files, see: example_configs. Here a shortened example config file:

input_file: 'data/susy.root'
output_dir: 'plots/GMSB_Factory'
treename: 'susy'
configurations:
  - name: 'GMSBpresel'
    addinfo: all GMSB models
    masklist:
      - "df['EWSummary_ExpCLs_Overall'] != -1."
    newvar: 
      - varname: 'min_m_mu_LR'
        formula: "df[['m_mu_L', 'm_mu_R']].values.min(axis=1)"
      - varname: 'min_m_chi'
        formula: "df[['m_chi_10', 'm_chi_20', 'm_chi_1p']].values.min(axis=1)"
  - name: 'GMSBgmuon'
    addinfo: $\Delta a_\mu$ selection applied
    seedfrom: 'GMSBpresel'
    masklist:
      - "(df['gm2_nom']-df['gm2_err']) <= (25.1e-10+5.9e-10)"
      - "(df['gm2_nom']+df['gm2_err']) >= (25.1e-10-5.9e-10)"
define: &ploting_common
  { type: 1dratio, denominator: 'GMSBgmuon', numerator: 'GMSBpresel', nbins: 30, ylab: no. of models, logy: True, subdir: 1dratio}
plots:

  # Loop over N1 BFs:
  - !for_loop
    - BF:
      - 'BF_chi_10_to_e_L'
      - 'BF_chi_10_to_e_R'
    # 1D histograms:
    - {<<: *ploting_common, x: !evaluate "${BF}" }
    # 2D histograms:
    - { type: 2dhist, x: 'min_m_chi', y: !evaluate "${BF}", range: [ [0, 2000], [0, 1.]], nbins: 20, addnumbers: True }
    - { type: 2dhist, x: 'min_m_chi', y: !evaluate "${BF}", z: 'EWSummary_ExpCLs_Overall', zopt: 'excl_frac', range: [ [0, 2000], [0, 1.]], nbins: 20, addnumbers: True, subdir: 'EWSummary_ExpCLs_Overall' }
  
  - { type: 2dscatter, x: 'BF_chi_10_to_gravitino_Z', y: 'BF_chi_10_to_gravitino_gam', z: 'EWSummary_ObsCLs_Overall', range: [ [0, 1.], [0, 1.]], subdir: '2dscatter'}

ToDo:

  • Move 2Dscatterplot grid to background.
  • Add more options for plots:
    • data/MC plots

Project details


Download files

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

Source Distribution

niceplotpy-0.10.1.tar.gz (31.4 kB view details)

Uploaded Source

File details

Details for the file niceplotpy-0.10.1.tar.gz.

File metadata

  • Download URL: niceplotpy-0.10.1.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.10

File hashes

Hashes for niceplotpy-0.10.1.tar.gz
Algorithm Hash digest
SHA256 c376c29f6cca83840da331b9250db007c71e2b577762973d7eea12007305e273
MD5 00a01830c580e77a352d747e917df2ee
BLAKE2b-256 0fa126d43df96e1960e2d9d92737929c586af9def333ed404c439777f437a6f2

See more details on using hashes here.

Supported by

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