Preprocessing

class fermi_stacking.preprocessing.StackingAnalysis(input_yaml)[source]

Superclass for conducting Fermi-LAT stacking.

Parameters:
  • sample_file (str) – Full path to sample file.

  • file_type (str) – Type for the sample file. Must be either ‘csv’, ‘fits’, or ‘tab’.

  • column_name (str) – Header of name column in sample file.

  • column_ra (str) – Header of ra column in sample file.

  • column_dec (str) – Header of dec column in sample file.

  • run_list (list) – List of names to run (subsample of full sample). For full sample use “default”.

  • psf_low (int) – Lower PSF iterator for JLA stacking (0-3). Default is 0 for standard analysis and preprocessing.

  • psf_high (int) – Upper PSF iterator for JLA stacking (1-4). Default is 1 for standard analysis and preprocessing.

  • run_name (str) – Main name of run.

  • job_type (str) – “p” for preprocessing or “s” for stacking.

  • ft1 (str) – Full path to ft1 photon data file.

  • ft2 (str) – Full path to spacecraft file.

  • galdiff (str) – Full path to Galactic diffuse model.

  • isodiff (str) – Full path to isotropic model.

  • ltcube (str, optional) – Full path to precomputed ltcube (the default is ‘None’, in which case the ltcube is calculated on the fly).

  • use_scratch (bool) – If True, will perform analysis in scratch directory.

  • scratch (str) – Full path to sratch directory.

  • JLA (bool) – If True will perform joint likelihood analysis, using 4 different PSF classes. If False, a standard analysis will be performed.

  • irfs (str) – Name of LAT instrument response functions.

  • evclass (int) – Event class, i.e. source, clean, etc.

  • evtype (int) – Event type, i.e. back/front conversion, etc.

  • emin (float or int) – Miminum energy of analysis in MeV.

  • emax (float or int) – Maximum energy of analysis in MeV.

  • tmin (float or int) – Minimum time of analysis in mission elapsed time (MET).

  • tmax (float or int) – Maximum time of analysis in mission elapsed time (MET).

  • zmax (float or int) – Maximun zenith angle to use in the analysis in degrees.

  • index_min (float) – Minimum index for stacking scan (absolute value).

  • index_max (float) – Maximum index for stacking scan (absolute value).

  • flux_min (float) – Power of min flux for stacking scan.

  • flux_max (float) – Power of max flux for stacking scan.

  • num_flux_bins (int) – Number of flux bins to use.

  • alpha_low (float) – Lower bound of alpha range.

  • alpha_high (float) – Upper bound of alpha range.

  • alpha_step (float) – Step size of alpha list

  • beta_low (float) – Log of Lower bound of beta range,

  • beta_high (float) – Log of Upper bound of beta range (non-inclusive)

  • beta_step (float) – step size of beta list

  • calc_sed (bool) – If True will calculate SED.

  • sed_logEbins (list) – Log of energy bin edges for SED calculation.

  • delete_4fgl (bool) – Option to run 4FGL source. If True, must provide “remove_list.csv” file in run directory, with col1=sample_name, col2=4fgl_name, and no header.

  • show_plots (bool) – If True will show plots. Set to False for submitted batch jobs.

Note

All inputs are passed with inputs.yaml file.

ang_sep(ra0, dec0, ra1, dec1)[source]

Calculate angular distance between two points on the sky.

Parameters:
  • ra0 (float) – Right ascension of first source in degrees.

  • dec0 (float) – Declination of first source in degrees.

  • ra1 (float) – Right ascension of second source in degrees.

  • dec1 (float) – Declination of first source in degrees.

Returns:

Angular distance between two sources in degrees.

Return type:

float

run_preprocessing(srcname, ra, dec, components=None)[source]

Perform preprocessing of source.

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

  • ra (float) – Right ascension of source.

  • dec (float) – Declination of source.

  • components (list of strings, optional) – Specify components of analysis via a list, where each entry in the list is a line that is to be written in the yaml file. Must include new line command at the end of each line.

make_preprocessing_summary()[source]

Makes sumarray of preprocessing.