
    |Le
                    \    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	d	S )
    )annotations)identity   )transfer_functions)
reductions)corec                  \    e Zd ZdZ ej                    eej        ej	        ddfdZ
ddZdS )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	                v    || _         || _        || _        || _        || _        || _        || _        || _        d S )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.11/site-packages/datashader/pipeline.py__init__zPipeline.__init__+   sE     
( "&(    NX  c                d   t          j        t          || j        z            t          || j        z            ||          }t          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$2B,B(C(C),VD4E-E)F)F%,g? ? ? |DGVTZ&*j&<> > >mmD--d3344~~c"""r   )NNr   r   )__name__
__module____qualname____doc__r   countr   tfshade	dynspreadr   r(    r   r   r
   r
   
   sg         @ '7j&6&8&8&R\ s
) 
) 
) 
)# # # # # #r   r
   N)

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