
    Ug
                    T    d dl mZ d dlmZ ddlmZ ddlmZ ddlmZ  G d d      Z	y	)
    )annotations)identity   )transfer_functions)
reductions)corec                  r    e Zd ZdZ ej
                         eej                  ej                  ddfdZ
ddZy)Pipelinea  A datashading pipeline callback.

    Given a declarative specification, creates a callable with the following
    signature:

    ``callback(x_range, y_range, width, height)``

    where ``x_range`` and ``y_range`` form the bounding box on the viewport,
    and ``width`` and ``height`` specify the output image dimensions.

    Parameters
    ----------
    df : pandas.DataFrame, dask.DataFrame
    glyph : Glyph
        The glyph to bin by.
    agg : Reduction, optional
        The reduction to compute per-pixel. Default is ``count()``.
    transform_fn : callable, optional
        A callable that takes the computed aggregate as an argument, and
        returns another aggregate. This can be used to do preprocessing before
        passing to the ``color_fn`` function.
    color_fn : callable, optional
        A callable that takes the output of ``tranform_fn``, and returns an
        ``Image`` object. Default is ``shade``.
    spread_fn : callable, optional
        A callable that takes the output of ``color_fn``, and returns another
        ``Image`` object. Default is ``dynspread``.
    height_scale: float, optional
        Factor by which to scale the provided height
    width_scale: float, optional
        Factor by which to scale the provided width
    g      ?c	                t    || _         || _        || _        || _        || _        || _        || _        || _        y )N)dfglyphaggtransform_fncolor_fn	spread_fnwidth_scaleheight_scale)	selfr   r   r   r   r   r   r   r   s	            3lib/python3.12/site-packages/datashader/pipeline.py__init__zPipeline.__init__+   s?     
( "&(    Nc                   t        j                  t        || j                  z        t        || j                  z        ||      }t        j
                  | j                  || j                  | j                  | j                  j                        }| j                  | j                  |            }| j                  |      S )a1  Compute an image from the specified pipeline.

        Parameters
        ----------
        x_range, y_range : tuple, optional
            The bounding box on the viewport, specified as tuples of
            ``(min, max)``
        width, height : int, optional
            The shape of the image
        )
plot_widthplot_heightx_rangey_range)	antialias)r   Canvasintr   r   bypixelr   r   r   antialiasedr   r   r   )r   r   r   widthheightcanvasbinsimgs           r   __call__zPipeline.__call__7   s     E$2B2B,B(C),VD4E4E-E)F%,g? ||DGGVTZZ&*jj&<&<>mmD--d34~~c""r   )NNX  r(   )__name__
__module____qualname____doc__r   countr   tfshade	dynspreadr   r'    r   r   r
   r
   
   s6    @ '7j&6&6&8&R\\ s
)#r   r
   N)

__future__r   toolzr    r   r.   r   r   r
   r1   r   r   <module>r5      s    "  &  ># >#r   