healpix_resample.BitmaskResampler#
- class healpix_resample.BitmaskResampler(lon_deg, lat_deg, level, *, n_bits, bit_threshold=0.5, kernel=<class 'healpix_resample.bilinear.BilinearResampler'>, **kernel_kwargs)[source]#
Resample an integer bitmask (independent boolean flags) to HEALPix.
Use this when each bit of an integer mask is an independent yes/no flag that can co-occur with any other bit (e.g. per-pixel quality flags: cloud / cloud-shadow / snow / saturated / … all packed into one integer). Each bit is resampled independently as a 0/1 indicator through
kernel(defaultBilinearResampler) and thresholded atbit_threshold(default 50%), then the surviving bits are recombined into an output bitmask – seeresample().Not for mutually-exclusive class labels (one class per sample) – use
CategoricalResamplerfor that instead.- Parameters:
lon_deg, lat_deg (
array-like,shape (N,)) – Sample coordinates in degrees.level (
int) – HEALPix level (nside = 2**level).n_bits (
int) – Number of bits to resample (bits0throughn_bits - 1). Deliberately not auto-detected frommax(mask): a bit that happens to never be set in one particularresample()call’s input (or in one parent-cell subset, if combined withsubset_for_parent_cell) would otherwise silently vanish from the output instead of correctly coming back as all-zero.bit_threshold (
float) – Fraction (in[0, 1], default0.5) above which a bit’s resampled indicator is considered “on” in the output. Distinct fromkernel’s ownthreshold(its cell-retention support threshold, if you pass one via**kernel_kwargs) – the two are unrelated despite the similar name.kernel (
type) – AKNeighborsResamplersubclass used to interpolate each bit’s indicator map – defaultBilinearResampler. Seeresample()’s docstring for why the default is the best-behaved choice for this purpose.**kernel_kwargs – Forwarded to
kernel’s constructor together withlon_deg,lat_deg,level(e.g.nest,device,dtype,out_cell_ids,threshold,sigma_m,verbose, …).
- __init__(lon_deg, lat_deg, level, *, n_bits, bit_threshold=0.5, kernel=<class 'healpix_resample.bilinear.BilinearResampler'>, **kernel_kwargs)[source]#
Methods
__init__(lon_deg, lat_deg, level, *, n_bits)resample(mask, **kwargs)Resample an integer bitmask to HEALPix, bit by bit.