generate_catalog

generate_catalog#

lsdb.generate_catalog(n_base, n_layer, seed=None, ra_range=(0.0, 360.0), dec_range=(-90, 90), search_region=None, **kwargs)[source]#

Generates a toy catalog.

The base layer always contains columns ra, dec, id, a, and b. Each nested layer contains columns t, flux, flux_error, band, and flux_err. When n_layer is an int the single layer is always named "nested"; pass a dict to use custom layer names.

Column reference:

  • ra, dec (float64): Sky position in degrees, drawn uniformly over the sphere within ra_range and dec_range (or the search region when provided).

  • id (int64): Unique random integer identifier per base row.

  • a (float64): Random float in [0, 1).

  • b (float64): Random float in [0, 2).

  • <layer>.t (float64): Time-like value in [0, 20).

  • <layer>.flux (float64): Flux value in [0, 100).

  • <layer>.flux_error (float64): Constant error 1.0.

  • <layer>.band (str): Filter band, one of "r" or "g".

  • <layer>.flux_err (float64): flux * 0.05.

Parameters:
n_baseint

The number of rows to generate for the base layer

n_layerint or dict

The number of rows per n_base row to generate for a nested layer. Alternatively, a dictionary of layer label, layer_size pairs may be specified to created multiple nested columns with custom sizing.

seedint

A seed to use for random generation of data

ra_rangetuple

A tuple of the min and max values for the ra column in degrees

dec_rangetuple

A tuple of the min and max values for the dec column in degrees

search_regionAbstractSearch

A search region to apply to the generated data. Currently supports the ConeSearch and BoxSearch regions. Note that if provided, this will override the ra_range and dec_range parameters.

**kwargs

Additional keyword arguments to pass to lsdb.from_dataframe.

Returns:
Catalog

The constructed LSDB Catalog.

Examples

>>> from lsdb import generate_catalog
>>> gen_cat = generate_catalog(10,100)
>>> gen_cat = generate_catalog(1000, 10, ra_range=(0.,10.), dec_range=(-5.,0.))

Constraining spatial ranges:

>>> gen_cat = generate_catalog(10, 100, ra_range=(0., 10.), dec_range=(-5., 0.))

Using a search region:

>>> from lsdb import ConeSearch
>>> gen_cat = generate_catalog(10, 100, search_region=ConeSearch(5, 5, 1))