clenspy.utils.BinCollection¶
- class clenspy.utils.BinCollection(bins)[source]¶
Bases:
SequenceAn ordered set of RichnessBin, addressable by
(i_lam, i_z).Behaves as a sequence, so
for b in binsandbins[k]work in the flat order the bins were supplied.bins.at(i, j)addresses a bin by its paper indices, which is how results are labelled.- Parameters:
bins (Iterable[RichnessBin])
- __init__(bins)[source]¶
- Parameters:
bins (Iterable[RichnessBin])
- Return type:
None
Methods
__init__(bins)at(i_lam, i_z)The bin with paper indices \((i, j)\).
count(value)from_edges(lam_edges, z_edges[, sigma_z])Build the full outer product of richness and redshift edges.
index(value, [start, [stop]])Raises ValueError if the value is not present.
reshape(flat)Fold a flat per-bin result into
(n_lam, n_z, ...).Attributes
Number of distinct richness bins.
Number of distinct redshift bins.
- classmethod from_edges(lam_edges, z_edges, sigma_z=None)[source]¶
Build the full outer product of richness and redshift edges.
- Parameters:
lam_edges (sequence of float, length
n_lam + 1) – Monotonic richness bin edges.z_edges (sequence of float, length
n_z + 1) – Monotonic redshift bin edges.sigma_z (float or sequence of float, optional) – Photo-z scatter. A scalar applies to every bin; a sequence must have length
n_lam, since \(\sigma_z\) depends on the richness bin.
- Returns:
BinCollection –
n_lam * n_zbins in row-major (richness-outer) order.- Return type: