imcascade.results

Module Contents

Classes

ImcascadeResults

A class used for collating imcascade results and performing analysis

MultiResults

A Class to analyze and combine multiple ImcascadeResults classes using evidence weighting

Functions

calc_flux_input(weights, sig[, cutoff])

r_root_func(r, f_L, weights, sig, cutoff)

imcascade.results.calc_flux_input(weights, sig, cutoff=None)
imcascade.results.r_root_func(r, f_L, weights, sig, cutoff)
class imcascade.results.ImcascadeResults(Obj, thin_posterior=1)

A class used for collating imcascade results and performing analysis

Parameters
  • Obj (imcascade.fitter.Fitter class, dictionary or str) – Object which contains the data to be analyzed. Can be a Fitter object once the run_(ls_min,dynesty, emcee) has been ran. If it is a dictionay needs to contain, at bare minmum the variables sig, Ndof, Ndof_sky, Ndof_gauss, log_weight_scale and either min_param or posterior. If a string is passed it will be interreted as a file locations with an ASDF file containing the neccesary information.

  • thin_posterior (int (optional)) – Factor by which to thin the posterior distribution by. While one wants to ensure the posterior is large enough, some of this analysis can take time if you have >10^6 samples so this is one way to speed up this task but use with caution.

calc_flux(cutoff=None)

Calculate flux of given results

Parameters

cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

Returns

Flux – Total flux of best fit model

Return type

float or Array

_min_calc_rX(X, cutoff=None)

Old and slow Function to calculate the radius containing X percent of the light

Parameters
  • X (float) – Fractional radius of intrest to calculate. if X < 1 will take as a fraction, else will interpret as percent and divide X by 100. i.e. to calculate the radius containing 20% of the light, once can either pass X = 20 or 0.2

  • cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width used

Returns

r_X – The radius containg X percent of the light

Return type

float or Array

calc_rX(X, cutoff=None)

Function to calculate the radius containing X percent of the light

Parameters
  • X (float) – Fractional radius of intrest to calculate. if X < 1 will take as a fraction, else will interpret as percent and divide X by 100. i.e. to calculate the radius containing 20% of the light, once can either pass X = 20 or 0.2

  • cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width used

Returns

r_X – The radius containg X percent of the light

Return type

float or Array

calc_r90(cutoff=None)

Wrapper function to calculate the radius containing 90% of the light

Parameters

cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

Returns

r_90 – The radius containg 90 percent of the light

Return type

float or Array

calc_r80(cutoff=None)

Wrapper function to calculate the radius containing 80% of the light

Parameters

cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

Returns

r_80 – The radius containg 80 percent of the light

Return type

float or Array

calc_r50(cutoff=None)

Wrapper function to calculate the radius containing 50% of the light, or the effective radius

Parameters

cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

Returns

r_50 – The radius containg 50 percent of the light

Return type

float or Array

calc_r20(cutoff=None)

Wrapper function to calculate the radius containing 20% of the light

Parameters

cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

Returns

r_20 – The radius containg 20 percent of the light

Return type

float or Array

calc_sbp(r, return_ind=False)

Function to calculate surface brightness profiles for the given results

Parameters
  • r (float or array) – Radii (in pixels) at which to evaluate the surface brightness profile

  • return_ind (bool (optional)) – If False will only return the sum of all gaussian, i.e. the best fit profile. If true will return an array with +1 dimensions containing the profiles of each individual gaussian component

Returns

SBP – Surface brightness profiles evaluated at ‘r’. If ‘return_ind = True’, returns the profile of each individual gaussian component

Return type

array

calc_obs_sbp(r, return_ind=False)

Function to calculate the observed surface brightness profiles, i.e. convolved with the PSF for the given results

Parameters
  • r (float or array) – Radii (in pixels) at which to evaluate the surface brightness profile

  • return_ind (bool (optional)) – If False will only return the sum of all gaussian, i.e. the best fit profile. If true will return an array with +1 dimensions containing the profiles of each individual gaussian component

Returns

obsereved SBP – Observed surface brightness profiles evaluated at ‘r’. If ‘return_ind = True’, returns the profile of each individual gaussian component

Return type

array

calc_cog(r, return_ind=False, norm=False, cutoff=None)

Function to calculate curves-of-growth for the given results

Parameters
  • r (float or array) – Radii (in pixels) at which to evaluate the surface brightness profile

  • return_ind (bool (optional)) – If False will only return the sum of all gaussian, i.e. the best fit profile. If true will return an array with +1 dimensions containing the profiles of each individual gaussian component

  • norm (Bool (optional)) – Wether to normalize curves-of-growth to total flux, calculated using ‘self.calc_flux’. Does nothing if ‘return_ind = True’

  • cutoff (Float (optional)) – Cutoff radius used in ‘self.calc_flux’, only is used if ‘norm’ is True

Returns

COG – curves-of-growth evaluated at ‘r’. If ‘return_ind = True’, returns the profile of each individual gaussian component

Return type

array

calc_obs_cog(r, return_ind=False, norm=False, cutoff=None)

Function to calculate the observed curve of growth, i.e. convolved with the PSF for the given results

Parameters
  • r (float or array) – Radii (in pixels) at which to evaluate the surface brightness profile

  • return_ind (bool (optional)) – If False will only return the sum of all gaussian, i.e. the best fit profile. If true will return an array with +1 dimensions containing the profiles of each individual gaussian component

  • norm (Bool (optional)) – Wether to normalize curves-of-growth to total flux, calculated using ‘self.calc_flux’. Does nothing if ‘return_ind = True’

  • cutoff (Float (optional)) – Cutoff radius used in ‘self.calc_flux’, only is used if ‘norm’ is True

Returns

observed COG – curves-of-growth evaluated at ‘r’. If ‘return_ind = True’, returns the profile of each individual gaussian component

Return type

array

run_basic_analysis(zpt=None, cutoff=None, errp_lo=16, errp_hi=84, save_results=False, save_file='./imcascade_results.asdf')

Function to calculate a set of common variables and save the save the results

Parameters
  • zpt (float (optional)) – photometric zeropoint for the data. if not ‘None’, will also calculate magnitude

  • cutoff (float (optional)) – Radius out to which to consider the profile. Generally this should be around the half-width of the image or the largest gaussian width use

  • errp_(lo,hi) (float (optional)) – percentiles to be used to calculate the lower and upper error bars from the posterior distribution. Default is 16 and 84, corresponding to 1-sigma for a guassian distribtuion

  • save_results (bool (optional)) – If true will save results to file. If input is a file, will add to given file, else will save to file denoted by ‘save_file’ (see below)

  • save_file (str) – String to describe where to save file, only applicaple if the input is not a file.

Returns

res_dict – Dictionary contining the results of the analysis

Return type

dictionary

calc_iso_r(I, zpt=None, pix_scale=None)

Function to calculate the isophotal radius

Parameters
  • I (float) – Surface brightness target to define the isophotal radii. By defualt this shoud be in image units unless both zpt and pix_scale are given, then I is interpreted as mag per arcsec^2.

  • zpt (float (optional)) – zeropoint magnitude of image, used to convert I to mag per arcsec^2

  • pix_scale (float (optional)) – pixel scale in units of arcseconds/pixel, used to convert I to mag per arcsec^2

Returns

r_I – The radius, in pixel units, where the surface brightness profile matches I

Return type

float or Array

calc_petro_r(P_ratio=0.2, r_fac_min=0.8, r_fac_max=1.25)

Function to calculate the petrosian radii of a galaxy

Parameters
  • P_ratio (float (optional)) – The Petrosian ratio which defines the Petrosian radii, default is 0.2

  • r_fac_min (float (optional)) – lower multiplicative factor which is used to integrate flux, default 0.8

  • r_fac_max (float (optional)) – higher multiplicative factor which is used to inegrate flux, default 1.25

Returns

r_I – The radius, in pixel units, where the surface brightness profile matches I

Return type

float or Array

make_diagnostic_fig()

Function which generates a diagnostic figure to assess fit

Returns

fig – matplotlib figure object

Return type

matplotlib figure

class imcascade.results.MultiResults(lofr)

A Class to analyze and combine multiple ImcascadeResults classes using evidence weighting

calc_cog(r, num=1000)
calc_obs_cog(r, num=1000)
calc_sbp(r, num=1000)
calc_obs_sbp(r, num=1000)
calc_flux(cutoff=None, num=1000)
calc_rX(X, cutoff=None, num=1000)