Sky statistics functions for skypac¶
Sky statistics computation class for skymatch
and
_weighted_sky
.
- Authors
Mihai Cara
- License
- class stsci.skypac.skystatistics.SkyStats(skystat='mean', **kwargs)[source]¶
This is a superclass build on top of
stsci.imagestats.ImageStats
. Compared toImageStats
,SkyStats
has “persistent settings” in the sense that object’s parameters need to be set once and these settings will be applied to all subsequent computations on different data.Initializes the SkyStats object.
- Parameters
- skystat: str
Sets the statistics that will be returned by the
calc_sky
. The following statistics are supported:'mean'
,'mode'
,'midpt'
, and'median'
. First three statistics have the same meaning as in stsdas.toolbox.imgtools.gstatistics whileskystat='median'
will compute the median of the distribution.- kwargs: dict
A dictionary of optional arguments to be passed to
ImageStats
.
- calc_sky(data)[source]¶
Computes statistics on data.
- Parameters
- data: numpy.ndarray
A numpy array of values for which the statistics needs to be computed.
- Returns
- statistics: tuple
A tuple of two values: (
skyvalue
,npix
), whereskyvalue
is the statistics specified by theskystat
parameter during the initialization of theSkyStats
object andnpix
is the number of pixels used in comuting the statistics reported inskyvalue
.
- class stsci.skypac.skystatistics.SkyStats(skystat='mean', **kwargs)[source]¶
This is a superclass build on top of
stsci.imagestats.ImageStats
. Compared toImageStats
,SkyStats
has “persistent settings” in the sense that object’s parameters need to be set once and these settings will be applied to all subsequent computations on different data.Initializes the SkyStats object.
- Parameters
- skystat: str
Sets the statistics that will be returned by the
calc_sky
. The following statistics are supported:'mean'
,'mode'
,'midpt'
, and'median'
. First three statistics have the same meaning as in stsdas.toolbox.imgtools.gstatistics whileskystat='median'
will compute the median of the distribution.- kwargs: dict
A dictionary of optional arguments to be passed to
ImageStats
.
- calc_sky(data)[source]¶
Computes statistics on data.
- Parameters
- data: numpy.ndarray
A numpy array of values for which the statistics needs to be computed.
- Returns
- statistics: tuple
A tuple of two values: (
skyvalue
,npix
), whereskyvalue
is the statistics specified by theskystat
parameter during the initialization of theSkyStats
object andnpix
is the number of pixels used in comuting the statistics reported inskyvalue
.