yaw.randoms.BoxRandoms#

class yaw.randoms.BoxRandoms(ra_min: float, ra_max: float, dec_min: float, dec_max: float, *, weights: NDArray | None = None, redshifts: NDArray | None = None, seed: int = 12345)[source]#

Bases: RandomsBase

Generates random points within a right ascension / declination window.

Generators are used with the from_random() method to create a catalog with uniformly distributed random coordiantes. Additional redshifts or weights (e.g. from an observed data sample) may be attached to randomly sample from their distribution.

Call instance to generate random points.

Parameters:
  • ra_min – The lower limit of the right ascension in degrees.

  • ra_max – The upper limit of the right ascension in degrees.

  • dec_min – The lower limit of the declination in degrees.

  • dec_max – The upper limit of the declination in degrees.

  • weights – Optional array of weights to draw from.

  • redshifts – Optional array of redshifts to draw from.

  • seed – Integer number from which the random seed is generated.

weights#

Optional array of weights to draw from.

redshifts#

Optional array of redshifts to draw from.

Methods

__init__(ra_min, ra_max, dec_min, dec_max, *)

copy_chunk_info(*[, drop_patch_ids])

Copy the data attribute information.

generate_dataframe(probe_size, *[, degrees])

Draw a new sample of uniform random points into a pandas DataFrame.

get_data_size()

Get the number attached data samples to draw from.

reseed([seed])

Attributes

has_patch_ids

Whether this data source provides patch IDs.

has_redshifts

Whether this data source provides redshifts.

has_weights

Whether this data source provides weights.

__call__(probe_size: int) TypeDataChunk#

Draw a new sample of uniform random points.

Parameters:

probe_size – Number of points to generate.

Returns:

Dictionary of arrays, always contains keys ra and dec for coordinates of random points in radian. Optionally contains weights and/or redshifts if data as been provided to sample from.

copy_chunk_info(*, drop_patch_ids: bool = False) DataChunkInfo#

Copy the data attribute information.

generate_dataframe(probe_size: int, *, degrees: bool = True)#

Draw a new sample of uniform random points into a pandas DataFrame.

Requires installing the optional dependency pandas.

Parameters:

probe_size – Number of points to generate.

Keyword Arguments:

degrees – Whether to return the coordinates in degrees (the default).

Returns:

A pandas.DataFrame, always contains keys ra and dec for coordinates of random points in degrees or radian. Optionally contains weights and/or redshifts if data as been provided to sample from.

get_data_size() int#

Get the number attached data samples to draw from.

Checks the length of the weights and redshifts and returns their length. If neither are defined, returns -1.

Returns:

Number of observations or -1.

Raises:

ValueError – If the lengths of the arrays do not match.

property has_patch_ids: bool#

Whether this data source provides patch IDs.

property has_redshifts: bool#

Whether this data source provides redshifts.

property has_weights: bool#

Whether this data source provides weights.