Here we have a few functions that are used by internally by PyCASSO but may be useful anyway.
Created on Oct 25, 2012
@author: andre
Reshape a to a “row matrix” of bigger rank, ndim.
Parameters : | a : array
ndim : integer
|
---|---|
Returns : | a_reshaped : array
|
Rebinning function. Given the value array a, with generic positions e such that e.shape == a.shape, return the sum or the mean values of a inside the bins defined by bin_e.
Parameters : | a : array like
e : array like
bin_e : array like
mean : boolean
|
---|---|
Returns : | a_e : array
|
Examples
TODO: Add examples for gen_rebin.
Evaluate radius where the cumulative value of X reaches half of its value.
Parameters : | X : array like
r : array like
r_max : int
|
---|---|
Returns : | HXR : float
|
Examples
Find the radius containing half of the volume of a gaussian.
>>> import numpy as np
>>> xx, yy = np.indices((100, 100))
>>> x0, y0, A, a = 50.0, 50.0, 1.0, 20.0
>>> z = A * np.exp(-((xx-x0)**2 + (yy-y0)**2)/a**2)
>>> r = np.sqrt((xx - 50)**2 + (yy-50)**2)
>>> getGenHalfRadius(z, r)
16.786338066912215
TODO: getAverageFilledImage documentation.
TODO: Documentation for apertures.
Compute the convex hull of a boolean image mask.
Parameters : | mask : array
|
---|---|
Returns : | convex_mask : array
|
Estimate ellipticity and orientation of the galaxy using the “Stokes parameters”, as described in: http://adsabs.harvard.edu/abs/2002AJ....123..485S The image used is qSignal.
Parameters : | image : array
x0 : float
y0 : float
mask : array, optional
|
---|---|
Returns : | pa : float
ba : float
|
Return an image (numpy.ndarray) of the distance from the center (x0, y0) in pixels, assuming a projected disk.
Parameters : | x : array
y : array
x0 : float, optional
y0 : float, optional
pa : float, optional
ba : float, optional
|
---|---|
Returns : | pixelDistance : array
|
See also
Return an image (numpy.ndarray) of the distance from the center (x0, y0) in pixels, assuming a projected disk.
Parameters : | shape : (float, float)
x0 : float, optional
y0 : float, optional
pa : float, optional
ba : float, optional
|
---|---|
Returns : | pixelDistance : 2-D array
|
See also
Return an image (numpy.ndarray of same shape as :attr`qSignal`) of the angle in radians of each pixel, relative from the axis of the position angle pa. The projection is fixed assuming the galaxy is a disk, throught the ellipticity parameter ba.
The angle is obtained “de-rotating” the pixel positions, stretching the y-coordinates to account for the perspective, and then calculating the arc tangent of the resulting y/x.
Parameters : | x : array
y : array
x0 : float, optional
y0 : float, optional
pa : float, optional
ba : float, optional
|
---|---|
Returns : | pixelAngle : 2-D array
|
See also
getPixelDistance
Return an image (numpy.ndarray of same shape as :attr`qSignal`) of the angle in radians of each pixel, relative from the axis of the position angle pa. The projection is fixed assuming the galaxy is a disk, throught the ellipticity parameter ba.
The angle is obtained “de-rotating” the pixel positions, stretching the y-coordinates to account for the perspective, and then calculating the arc tangent of the resulting y/x.
Parameters : | shape : (float, float)
x0 : float, optional
y0 : float, optional
pa : float, optional
ba : float, optional
|
---|---|
Returns : | pixelAngle : 2-D array
|
See also
getPixelDistance
Calculate the radial profile of an N-D image.
Parameters : | prop : array
r__yx : array
bin_r : array
rad_scale : float, optional
mask : array, optional
mode : string, optional
return_npts : bool, optional
|
---|---|
Returns : | radProf : [masked] array
npts : [masked] array, optional
|
See also
getPixelDistance