twopc package
Submodules
twopc.ppc module
- twopc.ppc.compute_postpc(analysis: threeML.bayesian.bayesian_analysis.BayesianAnalysis, result: threeML.analysis_results.BayesianResults, n_sims: int, file_name: str, overwrite: bool = False, return_ppc: bool = False) Optional[twopc.ppc.PPC] [source]
Compute a posterior predictive check from a 3ML DispersionLike Plugin. The resulting posterior data simulations are stored in an HDF5 file which can be read by the PPC class
- Parameters
analysis – 3ML bayesian analysis object
result – 3ML analysis result
n_sims – the number of posterior simulations to create
file_name – the filename to save to
overwrite – to overwrite an existsing file
return_ppc – if true, PPC object will be return directy
- Returns
None
- Return type
- twopc.ppc.compute_priorpc(analysis: threeML.bayesian.bayesian_analysis.BayesianAnalysis, n_sims: int, file_name: str, parameters: Optional[List[str]] = None, overwrite: bool = False, return_ppc: bool = False) Optional[twopc.ppc.PPC] [source]
Compute a prior predictive check from a 3ML DispersionLike Plugin. The resulting prior data simulations are stored in an HDF5 file which can be read by the PPC class
- Parameters
analysis – 3ML bayesian analysis object
n_sims – the number of posterior simulations to create
file_name – the filename to save to
parameters – optional parameter paths to only be used
overwrite – to overwrite an existsing file
return_ppc – if true, PPC object will be return directy
- Returns
None
- Return type
- class twopc.ppc.PPC(file_name: str)[source]
Bases:
object
- __init__(file_name: str)[source]
Reads a PPC HDF5 created by compute_ppc. This applies to DispersionLike data types only. Each detector is read from the file and an associated detector attribute is added to the class allowing the user to access the observed and PPC information of the detector
- param filename
the file name to read
- returns
- rtype
>
- property n_sims: int
- property detectors: List[str]
- class twopc.ppc.PPCDetector(name: str, obs_counts: numpy.ndarray, obs_background: numpy.ndarray, mask: numpy.ndarray, ebounds: numpy.ndarray, exposure: float, scale_factor: float, ppc_counts, ppc_background)[source]
Bases:
object
- __init__(name: str, obs_counts: numpy.ndarray, obs_background: numpy.ndarray, mask: numpy.ndarray, ebounds: numpy.ndarray, exposure: float, scale_factor: float, ppc_counts, ppc_background)[source]
This is simply a container object that stores the observed and PPC information of each detector for examination
- Parameters
name –
obs_counts –
obs_background –
mask –
ebounds –
exposure –
ppc_counts –
ppc_background –
- Returns
- Return type
- property name: str
- property obs_counts: numpy.ndarray
- property obs_background: numpy.ndarray
- property mask: numpy.ndarray
- property ebounds: numpy.ndarray
- property channel_width: numpy.ndarray
- property exposure: float
- property scale_factor: float
- property ppc_counts: numpy.ndarray
- property ppc_background: numpy.ndarray
- plot_qq(levels: List[float] = [95, 75, 55], colors: List[str] = ['#ABB2B9', '#566573', '#17202A'], center_color: str = '#FFD100', channel_energies: Optional[List[float]] = [30.0, 300.0, 500.0], level_check: Optional[float] = None, bad_color: str = '#FF6E3F', ax=None, **kwargs)[source]
- plot(bkg_subtract: bool = False, ax=None, levels: List[float] = [95, 75, 55], colors: List[str] = ['#ABB2B9', '#566573', '#17202A'], lc: str = '#FFD100', lw: float = 0.9, **kwargs)[source]
FIXME! briefly describe function
- Parameters
bkg_subtract –
ax –
levels –
75 –
55] –
colors –
'#566573' –
'#17202A'] –
lc –
lw –
- Returns
- Return type