imcascade.utils
Module Contents
Functions
|
Method to guess the weights of gaussian componenets given an re and flux. |
|
Expands mask by convolving it with a Gaussians |
|
Simple wrapper to generate list of numbers equally spaced in asinh space |
|
Simple wrapper to generate list of numbers equally spaced in logspace |
|
Simple wrapper to add obj to dictionary if it doesn’t exist. Used in fitter.Fitter when defining defaults |
|
Simple function to find percentiles from distribution |
|
Simple function to approximate b(n) when evaluating a Sersic profile |
|
Calculates the surface brightness profile for a Sersic profile |
|
Function used to calculate the minimum difference between any two elements |
Attributes
- imcascade.utils.vars_to_use = ['img', 'weight', 'mask', 'sig', 'Ndof', 'Ndof_sky', 'Ndof_gauss', 'has_psf', 'psf_a',...
- imcascade.utils.guess_weights(sig, re, flux)
Method to guess the weights of gaussian componenets given an re and flux. Based on a polynomial fit to the exp fits of Hogg & Lang 2013
- Parameters
sig (array) – List of gaussian widths for imcascade model
re (Float) – Estimate of effective radius
flux – Estimate of flux
- Returns
a_i – Inital estimate of weights based on re and flux
- Return type
Array
- imcascade.utils.expand_mask(mask, radius=5, threshold=0.001)
Expands mask by convolving it with a Gaussians
- Parameters
Mask (2D array) – inital mask with masked pixels equal to 1
radius (Float) – width of gaussian used to convolve mask. default 5, set larger for more aggresive masking
threshold (Float) – threshold to generate new mask from convolved mask. Default is 1e-3, set lower for more aggresive mask
- Returns
new_mask – New, expanded mask
- Return type
2D-Array
- imcascade.utils.asinh_scale(start, end, num)
Simple wrapper to generate list of numbers equally spaced in asinh space
- Parameters
start (floar) – Inital number
end (Float) – Final number
num (Float) – Number of number in the list
- Returns
list – List of number spanning start to end, equally space in asinh space
- Return type
1d array
- imcascade.utils.log_scale(start, end, num)
Simple wrapper to generate list of numbers equally spaced in logspace
- Parameters
start (floar) – Inital number
end (Float) – Final number
num (Float) – Number of number in the list
- Returns
list – List of number spanning start to end, equally space in log space
- Return type
1d array
- imcascade.utils.dict_add(dict_use, key, obj)
Simple wrapper to add obj to dictionary if it doesn’t exist. Used in fitter.Fitter when defining defaults
- Parameters
dict_use (Dictionary) – dictionary to be, possibly, updated
key (str) – key to update, only updated if the key doesn’t exist in dict_use already
obj (Object) – Object to be added to dict_use under key
- Returns
dict_add – updated dictionary
- Return type
Dictionary
- imcascade.utils.get_med_errors(arr, lo=16, hi=84)
Simple function to find percentiles from distribution
- Parameters
arr (array) – Array containing in the distribution of intrest
lo (float (optional)) – percentile to define lower error bar, Default 16
hi (float (optional)) – percentile to define upper error bar, Default 84
- Returns
(med,err_lo,err_hi) – Array containg the median and errorbars of the distiribution
- Return type
array
- imcascade.utils.b(n)
Simple function to approximate b(n) when evaluating a Sersic profile following Capaccioli (1989). Valid for 0.5 < n < 10
- Parameters
n (float or array) – Sersic index
- Returns
b(n) – Approximation to Gamma(2n) = 2 gamma(2n,b(n))
- Return type
float or array
- imcascade.utils.sersic(r, n, re, Ltot)
Calculates the surface brightness profile for a Sersic profile
- Parameters
r (array) – Radii at which to evaluate surface brightness profile
n (float) – Sersic index of profile
re (float) – Half-light radius of profile
Ltot (float) – Total flux of Sersic profile
- Returns
Surface brightness profile evaluate along the semi-major axis at ‘r’
- Return type
float or array
- imcascade.utils.min_diff_array(arr)
Function used to calculate the minimum difference between any two elements in a given array_like :param arr: Array to be searched :type arr: 1-D array
- Returns
min_diff – The minimum difference between any two elements of the given array
- Return type
Float