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:
RandomsBaseGenerates 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 the number attached data samples to draw from.
reseed([seed])Attributes
Whether this data source provides kappa (or any scalar values).
Whether this data source provides patch IDs.
Whether this data source provides redshifts.
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
raanddecfor coordinates of random points in radian. Optionally containsweightsand/orredshiftsif 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
raanddecfor coordinates of random points in degrees or radian. Optionally containsweightsand/orredshiftsif 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
weightsandredshiftsand 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_kappa: bool#
Whether this data source provides kappa (or any scalar values).
- 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.