Source code for threeML.config.plotting_structure

from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Dict, List, Optional

import matplotlib.pyplot as plt

# type checking matplotlib colormaps
MPLCmap = Enum("MPLCmap", zip(plt.colormaps(), plt.colormaps()))


[docs] @dataclass class BinnedSpectrumPlot: data_cmap: MPLCmap = MPLCmap.Set1 model_cmap: MPLCmap = MPLCmap.Set1 background_cmap: MPLCmap = MPLCmap.Set1 n_colors: int = 5 step: bool = False show_legend: bool = True show_residuals: bool = True data_color: Optional[str] = None model_color: Optional[str] = None background_color: Optional[str] = None show_background: bool = False data_mpl_kwargs: Optional[Dict[str, Any]] = None model_mpl_kwargs: Optional[Dict[str, Any]] = None background_mpl_kwargs: Optional[Dict[str, Any]] = None
[docs] @dataclass class FermiSpectrumPlot: total_model_color: str = "k" show_background_sources: bool = True shade_fixed_sources: bool = True shade_secondary_sources: bool = False fixed_sources_color: str = "grey" secondary_sources_color: str = "k" data_cmap: MPLCmap = MPLCmap.Set1 model_cmap: MPLCmap = MPLCmap.Set1 background_cmap: MPLCmap = MPLCmap.Set1 step: bool = False show_legend: bool = True show_residuals: bool = True data_color: Optional[str] = None model_color: Optional[str] = None background_color: Optional[str] = None data_mpl_kwargs: Optional[Dict[str, Any]] = None model_mpl_kwargs: Optional[Dict[str, Any]] = None background_mpl_kwargs: Optional[Dict[str, Any]] = None
[docs] @dataclass class DataHistPlot: counts_color: str = "#500472" background_color: str = "#79cbb8" warn_channels_color: str = "#C79BFE" bad_channels_color: str = "#FE3131" masked_channels_color: str = "#566573"
[docs] @dataclass class PlotStyle: linestyle: Optional[str] = "-" linewidth: Optional[float]= 1.7
[docs] @dataclass class ContourStyle: alpha: float = 0.4
[docs] @dataclass class CornerStyle: show_titles: bool = True smooth: float = 0.9 title_fmt: str = ".2g" bins: int = 25 quantiles: List[float] = field(default_factory=lambda: [0.16, 0.50, 0.84]) fill_contours: bool = True cmap: MPLCmap = MPLCmap.viridis extremes: str = "white" contourf_kwargs: Dict[str, Any] = field( default_factory=lambda: {"colors": None, "extend": "both"} ) levels: List[float] = field(default_factory=lambda: [0.99, 0.865, 0.393])
# class LegendLoc(Enum): # best = 'best' # lower_left = 'lower left' # lower_right = 'lower right' # upper_left = 'upper left' # upper_right = 'upper right'
[docs] @dataclass class LegendStyle: loc: str = "best" fancybox: bool = True shadow: bool = True
[docs] @dataclass class PointSourcePlot: fit_cmap: MPLCmap = MPLCmap.Set1 contour_cmap: MPLCmap = MPLCmap.Set1 bayes_cmap: MPLCmap = MPLCmap.Set1 plot_style: PlotStyle = field(default_factory=lambda: PlotStyle()) contour_style: ContourStyle = field(default_factory=lambda: ContourStyle()) show_legend: bool = True legend_style: LegendStyle = field(default_factory=lambda: LegendStyle()) flux_unit: str = "1/(keV s cm2)" emin: float = 10.0 emax: float = 1e4 num_ene: int = 100 ene_unit: str = "keV"
[docs] @dataclass class ResidualPlot: linewidth: float = 1 marker: str = "." size: float = 3 legend_font_size: float = 6.94
[docs] @dataclass class GenericPlotting: use_threeml_style: bool = True mplstyle: str = "threeml.mplstyle" residual_plot: ResidualPlot = field(default_factory=lambda: ResidualPlot())
[docs] @dataclass class ModelPlotting: point_source_plot: PointSourcePlot = field(default_factory=lambda: PointSourcePlot())