Sky statistics functions for skypac

Sky statistics computation class for skymatch and _weighted_sky.

Authors

Mihai Cara

License

LICENSE

class stsci.skypac.skystatistics.SkyStats(skystat='mean', **kwargs)[source]

This is a superclass build on top of stsci.imagestats.ImageStats. Compared to ImageStats, 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 while skystat='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), where skyvalue is the statistics specified by the skystat parameter during the initialization of the SkyStats object and npix is the number of pixels used in comuting the statistics reported in skyvalue.

class stsci.skypac.skystatistics.SkyStats(skystat='mean', **kwargs)[source]

This is a superclass build on top of stsci.imagestats.ImageStats. Compared to ImageStats, 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 while skystat='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), where skyvalue is the statistics specified by the skystat parameter during the initialization of the SkyStats object and npix is the number of pixels used in comuting the statistics reported in skyvalue.