Skip to content

Commit

Permalink
Few cleaning/formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
maray committed Dec 16, 2016
1 parent acde689 commit dcdc871
Show file tree
Hide file tree
Showing 4 changed files with 4,692 additions and 3,583 deletions.
78 changes: 0 additions & 78 deletions acalib/core/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,81 +407,3 @@ def vel_stacking(data,data_slice, wcs=None, mask=None,uncertainty=None, meta=Non
wcs = wcs.dropaxis(2)

return NDData(stacked, uncertainty=uncertainty, mask=mask,wcs=wcs, meta=meta, unit=unit)


### DEPRECATED ####


# def ndslice(ndd, lower, upper):
# """
# N-Dimensional slicing.
#
# Arguments:
# ndd -- an astropy.nddata.NDDataArray object.
# lower -- n-dimensional point as an n-tuple.
# upper -- n-dimensional point as an n-tuple.
#
# Returns:
# A sliced astropy.nddata.NDDataArray object.
#
# """
# lower = lower if lower is not None else np.zeros(ndd.ndim)
# upper = upper if upper is not None else ndd.shape
# return ndd[[slice(min(a,b), max(a,b)+1) for a,b in zip(lower, upper)]]
#
# def adjust_index(relative, origin):
# """
# Adjusts an index relative to a subarray to an absolute
# index in the superarray.
#
# Arguments:
# origin -- an n-dimensional index of a point as an n-tuple.
# It should be the origin from which the relative
# index was computed.
# relative -- an n-dimensional index of a point as an n-tuple.
# The index to be adjusted.
#
# Returns:
# The relative index adjusted to the superarray as an n-tuple.
# """
# return tuple(np.array(origin) + np.array(relative))

# def index_of_max(ndd, lower=None, upper=None):
# """
# Index of maximum value in an m-dimensional subarray from
# an n-dimensional array, specified by lower and upper.
#
# Arguments:
# ndd -- an astropy.nddata.NDDataArray object.
# lower -- n-dimensional point as an n-tuple.
# upper -- n-dimensional point as an n-tuple.
#
# Returns:
# A tuple with the maximum value found in the m-dimensional
# subarray and its index in the n-dimensional superarray.
#
# """
# ndd = ndslice(ndd, lower, upper)
# index = np.unravel_index(ndd.data.argmax(), ndd.data.shape)
# value = ndd.data[index]
# return (value, adjust_index(index, lower))

# def index_of_min(ndd, lower=None, upper=None):
# """
# Index of minimum value in an m-dimensional subarray from
# an n-dimensional array, specified by lower and upper.
#
# Arguments:
# ndd -- an astropy.nddata.NDDataArray object.
# lower -- n-dimensional point as an n-tuple.
# upper -- n-dimensional point as an n-tuple.
#
# Returns:
# A tuple with the minimum value found in the m-dimensional
# subarray and its index in the n-dimensional superarray.
#
# """
# ndd = ndslice(ndd, lower, upper)
# index = np.unravel_index(ndd.data.argmin(), ndd.data.shape)
# value = ndd.data[index]
# return (value, adjust_index(index, lower))

0 comments on commit dcdc871

Please sign in to comment.