def fluximage2(x, y, phix, phiy, flux0, scale_fact=1, scale_order=3):
    '\n    An alternative approach to creating a flux image out of a perpendicular deflection field. \n    \n    Args:\n        x (array): Plasma x-coordinates (cm). \n        y (array): Plasma x-coordinates (cm).\n        phix (array): Gradient of screen mapping potential in x-direction.\n        phiy (array): Gradient of screen mapping potential in y-direction.\n        scale_fact: Integer factor by which to upscale arrays before analysis; a larger number slows the algorithm but fills out low-flux regions better\n        scale_order: Order of the spline interpolation for scipy.ndimage.zoom\n    Returns:\n        flux_image (array): Generated flux image.\n    '
    xgv = x[:, 0].flatten()
    ygv = y[0, :].flatten()
    if (scale_fact != 1):
        print('Rescaling...')
        xgv = scipy.ndimage.zoom(xgv, scale_fact, order=scale_order)
        ygv = scipy.ndimage.zoom(ygv, scale_fact, order=scale_order)
        phix = scipy.ndimage.zoom(phix, scale_fact, order=scale_order)
        phiy = scipy.ndimage.zoom(phiy, scale_fact, order=scale_order)
        flux0 = scipy.ndimage.zoom(flux0, scale_fact, order=scale_order)
    dx = np.mean(np.diff(xgv))
    dy = np.mean(np.diff(ygv))
    x_edges = np.append((xgv - (dx / 2.0)), (xgv[(- 1)] + (dx / 2.0)))
    y_edges = np.append((ygv - (dy / 2.0)), (ygv[(- 1)] + (dy / 2.0)))
    print('Performing histogram...')
    (flux_image, _, _) = np.histogram2d(phix.flatten(), phiy.flatten(), bins=[x_edges, y_edges], weights=flux0.flatten())
    if (scale_fact != 1):
        print('Descaling...')
        flux_image = scipy.misc.imresize(flux_image, (1.0 / scale_fact), mode='F')
    print('DONE')
    return flux_image
An alternative approach to creating a flux image out of a perpendicular deflection field. 

Args:
    x (array): Plasma x-coordinates (cm). 
    y (array): Plasma x-coordinates (cm).
    phix (array): Gradient of screen mapping potential in x-direction.
    phiy (array): Gradient of screen mapping potential in y-direction.
    scale_fact: Integer factor by which to upscale arrays before analysis; a larger number slows the algorithm but fills out low-flux regions better
    scale_order: Order of the spline interpolation for scipy.ndimage.zoom
Returns:
    flux_image (array): Generated flux image.
def fluximage2(x, y, phix, phiy, flux0, scale_fact=1, scale_order=3):
    '\n    An alternative approach to creating a flux image out of a perpendicular deflection field. \n    \n    Args:\n        x (array): Plasma x-coordinates (cm). \n        y (array): Plasma x-coordinates (cm).\n        phix (array): Gradient of screen mapping potential in x-direction.\n        phiy (array): Gradient of screen mapping potential in y-direction.\n        scale_fact: Integer factor by which to upscale arrays before analysis; a larger number slows the algorithm but fills out low-flux regions better\n        scale_order: Order of the spline interpolation for scipy.ndimage.zoom\n    Returns:\n        flux_image (array): Generated flux image.\n    '
    xgv = x[:, 0].flatten()
    ygv = y[0, :].flatten()
    if (scale_fact != 1):
        print('Rescaling...')
        xgv = scipy.ndimage.zoom(xgv, scale_fact, order=scale_order)
        ygv = scipy.ndimage.zoom(ygv, scale_fact, order=scale_order)
        phix = scipy.ndimage.zoom(phix, scale_fact, order=scale_order)
        phiy = scipy.ndimage.zoom(phiy, scale_fact, order=scale_order)
        flux0 = scipy.ndimage.zoom(flux0, scale_fact, order=scale_order)
    dx = np.mean(np.diff(xgv))
    dy = np.mean(np.diff(ygv))
    x_edges = np.append((xgv - (dx / 2.0)), (xgv[(- 1)] + (dx / 2.0)))
    y_edges = np.append((ygv - (dy / 2.0)), (ygv[(- 1)] + (dy / 2.0)))
    print('Performing histogram...')
    (flux_image, _, _) = np.histogram2d(phix.flatten(), phiy.flatten(), bins=[x_edges, y_edges], weights=flux0.flatten())
    if (scale_fact != 1):
        print('Descaling...')
        flux_image = scipy.misc.imresize(flux_image, (1.0 / scale_fact), mode='F')
    print('DONE')
    return flux_image