Skip to content

Commit

Permalink
Added info to index documentation page and fixed some format problems…
Browse files Browse the repository at this point in the history
… in source docstrings
  • Loading branch information
cvalenzu committed Dec 17, 2016
1 parent 3d4bfdc commit 40df2f7
Show file tree
Hide file tree
Showing 18 changed files with 226 additions and 130 deletions.
2 changes: 1 addition & 1 deletion acalib/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .fellWalker import FellWalker
from .clumpFind import ClumpFind
from .gms import GMS
from .indexing import Indexing
from .stacking import Stacking
from .gms import GMS

__all__ = ['FellWalker','Indexing', 'ClumpFind', 'Stacking', 'GMS']
4 changes: 2 additions & 2 deletions acalib/algorithms/algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self, params=None):
Parameters
----------
params: dict (default = None)
params : dict (default = None)
Dictionary with algorithm's parameters
"""
self.config = dict()
Expand All @@ -32,7 +32,7 @@ def set_param(self, key, value):
----------
key : string
algorithm internal config dictionary key.
value:
value :
value to set.
"""
self.config[key] = value
Expand Down
5 changes: 3 additions & 2 deletions acalib/algorithms/gms.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ class GMS(Algorithm):
Parameters
----------
params: dict (default = None)
Algorithm parameters, allowed keys:
params : dict (default = None)
Algorithm parameters, allowed keys:
P : float (default = 0.05)
Thresholding quantile for multiscale segmentation.
PRECISION : float (default = 0.02)
Expand Down
7 changes: 4 additions & 3 deletions acalib/algorithms/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ class Indexing(Algorithm):
Parameters
----------
params: dict (default = None)
Algorithm parameters, allowed keys:
params : dict (default = None)
Algorithm parameters, allowed keys:
P : float (default = 0.05)
Thresholding quantile for multiscale segmentation.
PRECISION : float (default = 0.02)
Expand Down Expand Up @@ -48,7 +49,7 @@ def run(self, data):
Returns
-------
result: :class:`~acalib.Container` with the cube slices, segmentated images and region of interest tables for each scale analyzed.
:class:`~acalib.Container` with the cube slices, segmentated images and region of interest tables for each scale analyzed.
"""

if data.wcs:
Expand Down
6 changes: 3 additions & 3 deletions acalib/algorithms/stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def run(self, template_data, data_cont):
Parameters
----------
template_data: (M,N) numpy.ndarray
template_data : (M,N) numpy.ndarray
Astronomical image.
data_cont: acalib.container
data_cont : acalib.container
An images set container
Returns
-------
result: (M,N) numpy.ndarray
result : (M,N) numpy.ndarray
Image stacked
"""

Expand Down
56 changes: 34 additions & 22 deletions acalib/core/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ def rms(data, mask=None):
Parameters
----------
data: (M,N,Z) numpy.ndarray or astropy.nddata.NDData
data : (M,N,Z) numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
mask: numpy.ndarray (default = None)
mask : numpy.ndarray (default = None)
Returns
-------
Expand All @@ -42,22 +42,23 @@ def snr_estimation(data, mask=None, noise=None, points=1000, full_output=False):
Parameters
----------
data: (M,N,Z) numpy.ndarray or astropy.nddata.NDData
data : (M,N,Z) numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
mask: numpy.ndarray (default = None)
mask : numpy.ndarray (default = None)
noise: float (default=None)
noise : float (default=None)
Noise level, if not given will use rms of the data.
points: (default=1000)
points : (default=1000)
full_output: boolean (default=False)
full_output : boolean (default=False)
Gives verbose results if True
Returns
"Signal to Noise Radio"
-------
--------
"Signal to Noise Radio" value
"""
if noise is None:
Expand Down Expand Up @@ -90,12 +91,12 @@ def integrate(data, mask=None, axis=(0)):
Parameters
----------
data: (M,N,Z) numpy.ndarray or astropy.nddata.NDData
data : (M,N,Z) numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
mask: numpy.ndarray (default = None)
mask : numpy.ndarray (default = None)
axis: (default=(0))
axis : int (default=(0))
Returns
-------
Expand Down Expand Up @@ -171,16 +172,18 @@ def spectra_sketch(data, samples, random_state=None):
Parameters
----------
data: (M,N,Z) numpy.ndarray or astropy.nddata.NDData
data : (M,N,Z) numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
samples: Number of pixel samples(int) used for the sketch.
samples : Number of pixel samples(int) used for the sketch.
random_state: (default=None)
random_state : (default=None)
Returns:
spectra: (array)
slices: (list)
Returns
-------
spectra (array) and slices (list)
"""
# Specific for a FREQ,DEC,RA order
if random_state is not None:
Expand Down Expand Up @@ -392,10 +395,19 @@ def _kernel_shift(back, kernel, x, y):
@support_nddata
def vel_stacking(data,data_slice, wcs=None, mask=None,uncertainty=None, meta=None, unit=None):
"""
Create an image collapsing the frecuency axis
:param data_slice: Sector to be collapsed
:type data_slice: slice
:returns: image (NDData): 2D-Array with the stacked cube.
Create an image collapsing the frecuency axis
Parameters
----------
data : numpy.ndarray
Astronomical 2D image
slice : slice object
Sector to be collapsed
Returns
-------
image (NDData): 2D-Array with the stacked cube.
"""
if len(data.shape) != 3:
Expand Down
14 changes: 7 additions & 7 deletions acalib/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ def gaussian_function(mu, P, feat, peak):
Parameters
----------
mu: numpy.ndarray
mu : numpy.ndarray
Centers of gaussians array.
P: numpy.ndarray
P : numpy.ndarray
Precision matrix.
feat: numpy.ndarray.
feat : numpy.ndarray.
Features matrix.
peak: float
peak : float
Peak value of the resulting evaluation.
Returns
Expand All @@ -39,14 +39,14 @@ def create_mould(P, delta):
Parameters
----------
P: numpy.ndarray
P : numpy.ndarray
Precision matrix.
delta: list or numpy.ndarray
delta : list or numpy.ndarray
Delta values used to generate the mould.
Returns
-------
result: numpy.ndarray
result : numpy.ndarray
Mould matrix.
"""
n = len(delta)
Expand Down
48 changes: 24 additions & 24 deletions acalib/core/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ def scale(inputCont, majorAxisTemplate):
Parameters
----------
inputCont: acalib.Container
inputCont : acalib.Container
Container with the images to be scaled.
mayorAxisTemplate: float
mayorAxisTemplate : float
Axis respect the scale will be performed on all the images of the container.
Returns
-------
result: list
result : list
List with the scaled images.
"""
scaledData = []
Expand All @@ -43,14 +43,14 @@ def rotate(data, angle):
Parameters
----------
data: list
data : list
List of (M,N,Z) numpy.ndarray images.
angle: float
angle : float
Rotation reference angle that will be applied to all the images.
Returns
-------
result: tuple
result : tuple
Tuple with the list of rotated images and the list of rotation angles applied to each one.
"""
rotatedData = []
Expand Down Expand Up @@ -81,15 +81,15 @@ def crop_and_align(data, angles):
Parameters
----------
data: list
data : list
List of astronomical data cubes (numpy.ndarray).
angles: list
angles : list
List of angles (float) to perform alignment.
Returns
-------
result: list
result : list
List of *aligned* astronomical data cubes (numpy.ndarray).
"""
alignedData = []
Expand Down Expand Up @@ -121,12 +121,12 @@ def standarize(data):
Parameters
----------
data: numpy.ndarray or astropy.nddata.NDData
data : numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
Returns
-------
result: tuple
result : tuple
Tuple containing the standarized numpy.ndarray or astropy.nddata.NDData cube, the factor scale y_fact and the shift y_min.
"""
y_min = data.min()
Expand All @@ -142,16 +142,16 @@ def unstandarize(data, a, b):
Parameters
----------
data: numpy.ndarray or astropy.nddata.NDData
data : numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
a: float
a : float
Scale value.
b: float
b : float
Shift value.
Returns
-------
result: numpy.ndarray or astropy.nddata.NDData
result : numpy.ndarray or astropy.nddata.NDData
Unstandarized astronomical cube.
"""
return a*data+b
Expand All @@ -163,13 +163,13 @@ def add(data, flux, lower, upper):
Parameters
----------
data: numpy.ndarray or astropy.nddata.NDData
data : numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
flux: numpy.ndarray
flux : numpy.ndarray
Flux added to the cube.
lower: float
lower : float
Lower bound of the sub-cube to which flux will be added.
upper: float
upper : float
Upper bound of the sub-cube to which flux will be added.
"""

Expand All @@ -183,14 +183,14 @@ def denoise(data, threshold):
Parameters
----------
data: numpy.ndarray or astropy.nddata.NDData
data : numpy.ndarray or astropy.nddata.NDData
Astronomical data cube.
threshold: float
threshold : float
Threshold value used for denoising.
Returns
-------
result: numpy.ndarray
result : numpy.ndarray
Denoised (thresholded) astronomical data cube.
"""

Expand All @@ -206,12 +206,12 @@ def fits_props(img):
Parameters
----------
img: numpy.ndarray
img : numpy.ndarray
Astronomical data cube.
Returns
-------
result: dict
result : dict
Dictionary with properties of the image: *centroid*, *major*, *minor*, *ratio*, *angle*, *area*, *img*, *clr*, *label*, *orig*.
"""
flt = threshold_otsu(img)
Expand Down

0 comments on commit 40df2f7

Please sign in to comment.