merge_map#
- Catalog.merge_map(map_catalog: MapCatalog, func: Callable[[...], NestedFrame], *args, meta: NestedFrame | None = None, **kwargs) Catalog[source]#
Applies a function to each pair of partitions in this catalog and the map catalog.
The pixels from each catalog are aligned via a PixelAlignment, and the respective dataframes are passed to the function. The resulting catalog will have the same partitions as the point source catalog.
- Parameters:
- map_catalogMapCatalog
The continuous map to merge.
- funcCallable
The function applied to each catalog partition, which will be called with: func(catalog_partition: npd.NestedFrame, map_partition: npd.NestedFrame, ` ` healpix_pixel: HealpixPixel, *args, **kwargs) with the additional args and kwargs passed to the merge_map function.
- *args
Additional positional arguments to call func with.
- metapd.DataFrame | pd.Series | Dict | Iterable | Tuple | None, default None
An empty pandas DataFrame that has columns matching the output of the function applied to the catalog partition. Other types are accepted to describe the output dataframe format, for full details see the dask documentation https://blog.dask.org/2022/08/09/understanding-meta-keyword-argument If meta is None (default), LSDB will try to work out the output schema of the function by calling the function with an empty DataFrame. If the function does not work with an empty DataFrame, this will raise an error and meta must be set. Note that some operations in LSDB will generate empty partitions, though these can be removed by calling the Catalog.prune_empty_partitions method.
- **kwargs
Additional keyword args to pass to the function. These are passed to the Dask DataFrame dask.dataframe.map_partitions function, so any of the dask function’s keyword args such as transform_divisions will be passed through and work as described in the dask documentation https://docs.dask.org/en/stable/generated/dask.dataframe.DataFrame.map_partitions.html
- Returns:
- Catalog
A Catalog with the data from the left and right catalogs merged with one row for each pair of neighbors found from cross-matching. The resulting table contains all columns from the left and right catalogs with their respective suffixes and, whenever specified, a set of extra columns generated by the crossmatch algorithm.