def wcs_pix_transform(ct, i, format=0):
    """Computes the WCS corrected pixel value given a coordinate
    transformation and the raw pixel value.

    Input:
    ct      coordinate transformation. instance of coord_tran.
    i       raw pixel intensity.
    format  format string (optional).

    Returns:
    WCS corrected pixel value
    """
    z1 = float(ct.z1)
    z2 = float(ct.z2)
    i = float(i)

    yscale = 128.0 / (z2 - z1)
    if (format == 'T' or format == 't'):
        format = 1

    if (i == 0):
        t = 0.
    else:
        if (ct.zt == W_LINEAR):
            t = ((i - 1) * (z2 - z1) / 199.0) + z1
            t = max(z1, min(z2, t))
        else:
            t = float(i)
    if (format > 1):
        t = (z2 - t) * yscale
    return (t)
Computes the WCS corrected pixel value given a coordinate
    transformation and the raw pixel value.

    Input:
    ct      coordinate transformation. instance of coord_tran.
    i       raw pixel intensity.
    format  format string (optional).

    Returns:
    WCS corrected pixel value