Stacking

class fermi_stacking.stacking.MakeStack(input_yaml)[source]

Performs stacking.

PL2(Fit, name)[source]

Power law spectral model for stacking: sets parameters of PowerLaw2 spectral function.

Parameters:
  • Fit (BinnedAnalysis) – Likelihood object.

  • name (str) – Name of source.

Returns:

Fit

Return type:

BinnedAnalysis.

run_stacking(srcname, PSF, indir='default')[source]

Construct 2D TS profiles for sources.

Parameters:
  • srcname (str) – Name of source.

  • PSF (int) – Integer ranging from 0-3 indicating PSF class for JLA. The passed value is 0 for standard analysis.

  • indir (str, optional) – Input preprocessing directory to use for stacking (defualt is preprocessing directory from main run directory.

combine_likelihood(exclusion_list, savefile, stack_mode='flux_index', likelihood_home='default')[source]

Make 2D TS profiles for each source and add to get stacked profile.

Parameters:
  • exclusion_list (list) – List of sources to exclude from stacked profile.

  • Savefile (str) – Prefix of array to be saved. Do not include “.npy” at the end of the name; it’s already included.

  • stack_mode (str, optional) – Type of stacking being performed. Default is flux_index. Other option is alpha_beta.

  • likelihood_home (str, optional) – Full path to run directory of preprocessing, where null likelihood has been calculated (default is current working directory).

evolution_plot(skip_rows, savefile, preprocess_home='default', exclude_list=None, use_src_names=False, stack_mode='flux_index', show_index=False, show_flux=False)[source]

Plot max TS as a funtion of source.

Parameters:
  • skip_rows (list) – List of rows to skip when reading preprocessing summary.

  • savefile (str) – Prefix of output image.

  • preprocess_home (str, optional) – Full path to run directory of preprocessing.

  • exlude_list (list of str, optional) – Names of sources to exclude.

  • use_src_names (bool, optional) – Option to use source names in x-axis of plot (default is False).

  • stack_mode (str, optional) – Stacking mode to use. Default is flux_index. The other option is alpha_beta.

  • show_index (bool, optional) – Show index evolution (default is False).

  • show_flux (bool, optional) – Show flux evolution (default is False).

class fermi_stacking.stacking.MakeAlphaBeta(input_yaml)[source]
alpha_beta_data(index, name_list, d_list, xlum)[source]

Initiates data for alpha-beta stacking.

Parameters:
  • index (float) – Absolute value of spectral index.

  • name_list (array or list) – List of sample names.

  • d_list (array or list) – List of distance for sample in Mpc. Must be in same order as name list.

  • xlum (array or list) – Numpy array with luminosity values in erg/s. Must be in same order as name list.

check_data()[source]

Checks if alpha-beta data has been loaded.

interpolate_array_alpha_beta(savefile, exclusion_list=[])[source]

Interpolate flux-index array to stack in alpha-beta.

Parameters:
  • savefile (str) – Name of output total array file (do not include .npy extension).

  • exclusion_list (list, optional) – Names of sources to exlude in total stack.

Note

The alpha-beta data must first be specified by running alpha_beta_data.

run_stacking(srcname, PSF, indir='default')[source]

Construct 2D TS profiles for sources.

Parameters:
  • srcname (str) – Name of source.

  • PSF (int) – Integer ranging from 0-3 indicating PSF class for JLA. The passed value is 0 for standard analysis.

  • indir (str, optional) – Input preprocessing directory to use for stacking (defualt is preprocessing directory from main run directory.