def circular_apodization(wf, radius, t_in, t_out, xc = 0.0, yc = 0.0, **kwargs):

    if ("NORM" in kwargs and kwargs["NORM"]):
        norm = True
    else:
        norm = False

    if (t_in > t_out):
        apodizer = proper.prop_shift_center(proper.prop_ellipse(wf, radius, radius, xc, yc, NORM = norm))*(t_in-t_out)+t_out
    else:
         apodizer = proper.prop_shift_center(proper.prop_ellipse(wf, radius, radius, xc, yc, NORM = norm))*(t_out-t_in)+t_in

    return apodizer
def circular_apodization(wf, radius, t_in, t_out, xc=0, yc=0, NORM=False):

    apodizer = proper.prop_ellipse(wf, radius, radius, xc, yc, NORM=NORM)

    if (t_in > t_out):
        apodizer = apodizer*(t_in - t_out) + t_out
    else:
        apodizer = apodizer*(t_out - t_in) + t_in

    return apodizer
def falco_gen_annular_FPM(pixresFPM,
                          rhoInner,
                          rhoOuter,
                          FPMampFac,
                          centering,
                          rot180=False):
    dxiUL = 1.0 / pixresFPM  # lambda_c/D per pixel. "UL" for unitless

    if np.isinf(rhoOuter):
        if centering == "interpixel":
            # number of points across the inner diameter of the FPM.
            Narray = utils.ceil_even((2 * rhoInner / dxiUL))
        else:
            # number of points across the inner diameter of the FPM. Another half pixel added for pixel-centered masks.
            Narray = utils.ceil_even(2 * (rhoInner / dxiUL + 0.5))
    else:
        if centering == "interpixel":
            # number of points across the outer diameter of the FPM.
            Narray = utils.ceil_even(2 * rhoOuter / dxiUL)
        else:
            # number of points across the outer diameter of the FPM. Another half pixel added for pixel-centered masks.
            Narray = utils.ceil_even(2 * (rhoOuter / dxiUL + 0.5))

    xshift = 0  # translation in x of FPM (in lambda_c/D)
    yshift = 0  # translation in y of FPM (in lambda_c/D)

    Darray = Narray * dxiUL  # width of array in lambda_c/D
    diam = Darray
    wl_dummy = 1e-6  # wavelength (m); Dummy value--no propagation here, so not used.

    if centering == "interpixel":
        cshift = -diam / 2 / Narray
    elif rot180:
        cshift = -diam / Narray
    else:
        cshift = 0

    wf = proper.prop_begin(diam, wl_dummy, Narray, 1.0)

    if not np.isinf(rhoOuter):
        # Outer opaque ring of FPM
        cx_OD = 0 + cshift + xshift
        cy_OD = 0 + cshift + yshift
        proper.prop_circular_aperture(wf, rhoOuter, cx_OD, cy_OD)

    # Inner spot of FPM (Amplitude transmission can be nonzero)
    ra_ID = (rhoInner)
    cx_ID = 0 + cshift + xshift
    cy_ID = 0 + cshift + yshift
    innerSpot = proper.prop_ellipse(
        wf, rhoInner, rhoInner, cx_ID, cy_ID,
        DARK=True) * (1 - FPMampFac) + FPMampFac

    mask = np.fft.ifftshift(np.abs(wf.wfarr))  # undo PROPER's fftshift
    return mask * innerSpot  # Include the inner FPM spot
Exemple #4
0
def build_prop_circular_aperture(wf, radius, xc=0.0, yc=0.0, **kwargs):
    """Multiply the wavefront by a circular clear aperture.
    
    Parameters
    ----------
    wf : obj
        WaveFront class object
    
    radius : float
       Radius of aperture in meters, unless norm is specified
      
    xc : float
        X-center of aperture relative to center of wavefront. Default is 0.0
        
    yc : float
        Y-center of aperture relative to center of wavefront. Default is 0.0
        
        
    Returns
    -------
    numpy ndarray:
        Multiplies current wavefront in wf object by a circular aperture.
    
    
    Other Parameters
    -----------------
    NORM : bool
        If set to True, the specified radius and xc, yc aperure centers are 
        assumed to be normalized to the current beam radius (e.g. radius is 1.0
        means the aperture is the same size as  the current beam). xc, yc = 0,0 
        is the center of the wavefront. Default is False.
    """

    if ("NORM" in kwargs and kwargs["NORM"]):
        norm = True
    else:
        norm = False

    return proper.prop_shift_center(
        proper.prop_ellipse(wf, radius, radius, xc, yc, NORM=norm))