Ejemplo n.º 1
0
def MTFplot(meta, intensity, density=False):
    '''
    '''
    intensity = ea.getMTF(meta, intensity)
    variable = ea.findDependentVar(meta)

    fig = plt.figure()
    fig.set_tight_layout(True)
    ax = fig.add_subplot(111)
    pf.AxisFormat(20)
    pf.TufteAxis(ax, ['left', 'bottom'], [5, 5], integer='on')

    cycles = (np.arange(0, intensity['MTF'].shape[1] )) / 2
    cpd = cycles / meta['retImg'] * meta['mm/deg'] 

    for i in range(0, meta['iterations']):

        if variable is not None:
            ax.plot(cpd,
                intensity['MTF'][i, :].T,
                label = '{0}'.format(meta[variable][i]))
        else:
            ax.plot(cpd, intensity['MTF'][i, :].T)

    # plot diffraction limited case:
    diffract, _x = o.diffraction(intensity['MTF'].shape[1], 
                    meta['pupil_size_%'][0], 16.6)
    if not density: 
        ax.plot(_x, diffract, 'k')
    if density:
        ax.semilogx(cpd, decibels(diffract), 'k')

    if variable is not None:
        ax.legend().set_title(variable.replace('_',' ')
            .replace('%','(mm)')
            .replace('&','(y)')
            .replace('D', '(D)')
            .replace('*', '$\\degree$'))

    plt.ylim([0, 1.0])
    plt.xlim([0, 60.0])
    plt.ylabel('modulation transfer')
    plt.xlabel('cycles / deg')
    plt.show()
Ejemplo n.º 2
0
def PSFplot(meta, intensity, symmetric=True):
    '''
    '''
    intensity = ea.getPSF(meta, intensity)
    variable = ea.findDependentVar(meta)

    fig = plt.figure()
    fig.set_tight_layout(True)
    ax = fig.add_subplot(111)
    pf.AxisFormat(20)
    pf.TufteAxis(ax, ['left', 'bottom'], [5, 5], integer='on')
    size = meta['samples']

    if symmetric:
        _x = np.linspace(-meta['retImg'] / meta['mm/deg'], 
            meta['retImg'] / meta['mm/deg'],
            (meta['samples'] * 2) + 1)

    for i in range(0, meta['iterations']):

        if variable is not None:
            ax.plot(_x * 60,
                intensity['PSFtotal'][i].T, 
                label = '{0}'.format(meta[variable][i]))
        else:
            ax.plot(_x * 60, intensity['PSFtotal'][i].T)

    if variable is not None:
        ax.legend().set_title(variable.replace('_',' ')
            .replace('%','(mm)')
            .replace('&','(y)')
            .replace('D', '(D)')
            .replace('*', '$\\degree$'))

    if symmetric:
        plt.xlim([-3, 3])
    else:
        plt.xlim([0, 2])
    plt.ylabel('point spread')
    plt.xlabel('arc min')
    plt.show()