a
    `
                     @   sX   d dl mZmZ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 deZd	S )
    )absolute_importdivisionprint_function)identity   )transfer_functions)
reductions)corec                   @   s8   e Zd ZdZe eejej	ddfddZ
d	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	           	      C   s4   || _ || _|| _|| _|| _|| _|| _|| _d S )N)dfglyphaggtransform_fncolor_fn	spread_fnwidth_scaleheight_scale)	selfr   r   r   r   r   r   r   r    r   2lib/python3.9/site-packages/datashader/pipeline.py__init__+   s    zPipeline.__init__NX  c                 C   sV   t jt|| j t|| j ||d}t | 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
        )Z
plot_widthZplot_heightx_rangey_range)r	   ZCanvasintr   r   Zbypixelr   r   r   r   r   r   )r   r   r   widthZheightZcanvasZbinsZimgr   r   r   __call__7   s    zPipeline.__call__)NNr   r   )__name__
__module____qualname____doc__r   countr   tfZshadeZ	dynspreadr   r   r   r   r   r   r
   
   s    

r
   N)Z
__future__r   r   r   Ztoolzr    r   r"   r   r	   objectr
   r   r   r   r   <module>   s
   