toasty.toast.sample_layer(pio, sampler, depth, coordsys=ToastCoordinateSystem.ASTRONOMICAL, format=None, parallel=None, cli_progress=False)[source]

Generate a layer of the TOAST tile pyramid through direct sampling.


A PyramidIO instance to manage the I/O with the tiles in the tile pyramid.


The sampler callable that will produce data for tiling.


The depth of the layer of the TOAST tile pyramid to generate. The number of tiles in each layer is 4**depth. Each tile is 256×256 TOAST pixels, so the resolution of the pixelization at which the data will be sampled is a refinement level of 2**(depth + 8).

coordsysoptional ToastCoordinateSystem

The TOAST coordinate system to use. Default is ToastCoordinateSystem.ASTRONOMICAL.

formatoptional str

If provided, override the default data storage format of pio with the named format, one of the values in toasty.image.SUPPORTED_FORMATS.

parallelinteger or None (the default)

The level of parallelization to use. If unspecified, defaults to using all CPUs. If the OS does not support fork-based multiprocessing, parallel processing is not possible and serial processing will be forced. Pass 1 to force serial processing.

cli_progressoptional boolean, defaults False

If true, a progress bar will be printed to the terminal.