SubsampleSelectionFunctionHMLE#

class gaiaunlimited.selectionfunctions.SubsampleSelectionFunctionHMLE(subsample_query=None, file_name=None, hplevel_and_binning=None, z=None)#

Bases: object

Hierarchical maximum-likelihood estimate for the subsample selection function.

This function gives the probability

P(is in subsample| is in Gaia and has the certain HEALPix [, G [, color]])

The Binomial MLE is used for estimation of the probability in the HEALPix [, G [, color]] bins. If a bin is empty (no trials), the upper HEALPix level will be used for estimate. If it is empty too, the next upper will be used, etc.

Args: subsample_query : str, optional file_name : str, optional

File name (without extension) to store the fetched data.

hplevel_and_binning : dict, optional data : pandas.DataFrame or xarray.Dataset or dict, optional

These are the possible use cases: 1. subsample_query, file_name and hplevel_and_binning are given

The data will be collected through the Gaia TAP+ interface then

processed.

  1. No parameters are passed An empty class instance is created. The data should be provided later by the user and processed with the use method.

  2. An instance of the SubsampleSelectionFunction class is passed to the function use. This assumes that the data has already been collected.

  3. pandas.DataFrame and hplevel_and_binning are passed to the function use.

  4. xarray.Dataset and hplevel_and_binning are passed to the function use.

Methods Summary

evaluate(n, k[, z])

Evaluate success probability and optionally confidence interval for every pixel and magnitude/color bin.

finalize(nn, kk, pp[, ci_lo, ci_hi])

Collect everything into a list of the datasets, one for each HEALPix level.

query(coords[, hplevel, return_confidence, ...])

Query the selection function at the given coordinates.

use(obj[, hplevel_and_binning, z])

use_dataset(ds, hplevel_and_binning[, z])

Evaluate completeness using data collected in the native format at the SubsampleSelectionFunction class.

use_pandas(df, hplevel_and_binning[, z])

Evaluate completeness using data collected in the 'melted' format.

Methods Documentation

evaluate(n, k, z=None)#

Evaluate success probability and optionally confidence interval for every pixel and magnitude/color bin.

Args: n : ndarray k : ndarray z : float, optional

finalize(nn, kk, pp, ci_lo=None, ci_hi=None)#

Collect everything into a list of the datasets, one for each HEALPix level.

query(coords, hplevel=-1, return_confidence=False, fill_nan=False, **kwargs)#

Query the selection function at the given coordinates.

Args: coords : astropy.coordinates.SkyCoord

Sky coordinates as an astropy coordinates instance.

hplevelint, optional

HEALPixel order. If omitted, the largest (finest) possible is used.

return_confidencebool, optional

Whether to return the confidence interval (its lower and upper bounds).

fill_nanbool, optional

There should not be any NaNs in the data. This parameter is left for backwards compatibility.

kwargskey-value pairs

The key is a variable name (with ‘_’ suffix), the value is an array of the values of the variable where to interpolate. The shape of the values must be the same as the shape of the ‘coords’.

Other factors that determine this selection function should be given as keyword arguments of the same shape as coords.

Returns: numpy.ndarray

Selection probabilities

use(obj, hplevel_and_binning=None, z=None)#
use_dataset(ds, hplevel_and_binning, z=None)#

Evaluate completeness using data collected in the native format at the SubsampleSelectionFunction class.

Args: ds: xarray.Dataset hplevel_and_binning : dict z : float, optional

use_pandas(df, hplevel_and_binning, z=None)#

Evaluate completeness using data collected in the ‘melted’ format.

Args: df: pandas.DataFrame hplevel_and_binning : dict z : float, optional