get_partition

get_partition#

Catalog.get_partition(order: int, pixel: int) NestedFrame#

Get the dask partition for a given HEALPix pixel

Parameters:
orderint

Order of HEALPix pixel

pixelint

HEALPix pixel number in NESTED ordering scheme

Returns:
nd.NestedFrame

Dask Dataframe with a single partition with data at that pixel

Raises:
ValueError

If no data exists for the specified pixel

Examples

Get a single HEALPix partition from a small synthetic catalog:

>>> import lsdb
>>> from lsdb.nested.datasets import generate_data
>>> nf = generate_data(1000, 5, seed=0, ra_range=(0.0, 300.0), dec_range=(-50.0, 50.0))
>>> catalog = lsdb.from_dataframe(nf.compute()[["ra", "dec", "id"]])
>>> hp = catalog.get_healpix_pixels()[0]
>>> partition = catalog.get_partition(hp.order, hp.pixel)
>>> partition.compute().head()
                        ra        dec    id
_healpix_29
118362963675428450  52.696686  39.675892  8154
98504457942331510   89.913567  46.147079  3437
70433374600953220   40.528952  35.350965  8214
154968715224527848   17.57041    29.8936  9853
67780378363846894    45.08384   31.95611  8297