# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/API/sparse.ipynb.

# %% auto 0
__all__ = ['points2raster']

# %% ../nbs/API/sparse.ipynb 4
import cupy as cp
import numpy as np
import numpy.typing as npt

# %% ../nbs/API/sparse.ipynb 5
def points2raster(is_pt:npt.ArrayLike, # bool array index
                  point:npt.ArrayLike, # data
                 ):
    '''convert sparse data to raster, filled with nan'''
    xp = cp.get_array_module(is_pt)
    raster = xp.empty_like(is_pt,dtype=point.dtype)
    raster[:] = xp.nan
    raster[is_pt] = point
    return raster
