コード例 #1
0
def plotnoisedist(noisepkl, plot_width=450, plot_height=400):
    """ """

    # plot noise and flag distributions
    scans, segments, noiseperbl, flagfrac, imstd = read_noise(noisepkl)
    pl = Figure(plot_width=plot_width,
                plot_height=plot_height,
                toolbar_location="above",
                x_axis_label='Flag fraction',
                y_axis_label='Image noise (sys)',
                tools='pan, wheel_zoom, reset')
    pl.cross(flagfrac, imstd, line_alpha=0.2, color='blue')

    # find medians
    flagfrac_med = np.median(flagfrac)
    imstd_med = np.median(imstd)
    logger.info('Median image noise (sys) = {0}'.format(imstd_med))
    logger.info('Median flag fraction = {0}'.format(flagfrac_med))
    pl.cross(flagfrac_med, imstd_med, line_alpha=1, size=40, color='red')

    # estimate number of zero noise images
    zeronoisefrac = float(len(np.where(imstd == 0.)[0])) / len(imstd)
    logger.info('{0:.0%} of noise images are zeros'.format(zeronoisefrac))

    return pl, imstd_med, flagfrac_med
コード例 #2
0
def plotnoisecum(noisepkl, fluxscale=1, plot_width=450, plot_height=400):
    """ Merged noise pkl converted to interactive cumulative histogram 

    noisepkl is standard noise pickle file.
    fluxscale is scaling applied by gain calibrator. telcal solutions have fluxscale=1.
    also returns corrected imnoise values if non-unity fluxscale provided
    """

    # noise histogram
    noises = read_noise(noisepkl)
    imnoise = np.sort(fluxscale * noises[4])
    frac = [
        float(count) / len(imnoise)
        for count in reversed(range(1,
                                    len(imnoise) + 1))
    ]
    noiseplot = Figure(
        plot_width=plot_width,
        plot_height=plot_height,
        toolbar_location="above",
        x_axis_label='Image noise (Jy; cal scaling {0:.3})'.format(fluxscale),
        y_axis_label='Cumulative fraction',
        tools='pan, wheel_zoom, reset')
    noiseplot.line(imnoise, frac)

    if fluxscale != 1:
        return noiseplot, imnoise
    else:
        return noiseplot
コード例 #3
0
ファイル: interactive.py プロジェクト: bandersen441/rtpipe
def plotnoisedist(noisepkl, plot_width=450, plot_height=400):
    """ """

    # plot noise and flag distributions
    scans, segments, noiseperbl, flagfrac, imstd = read_noise(noisepkl)
    pl = Figure(plot_width=plot_width, plot_height=plot_height, toolbar_location="above",
                x_axis_label='Flag fraction', y_axis_label='Image noise (sys)', tools='pan, wheel_zoom, reset')
    pl.cross(flagfrac, imstd, line_alpha=0.2, color='blue')

    # find medians
    flagfrac_med = np.median(flagfrac)
    imstd_med = np.median(imstd)
    logger.info('Median image noise (sys) = {0}'.format(imstd_med))
    logger.info('Median flag fraction = {0}'.format(flagfrac_med))
    pl.cross(flagfrac_med, imstd_med, line_alpha=1, size=40, color='red')

    # estimate number of zero noise images
    zeronoisefrac = float(len(np.where(imstd == 0.)[0]))/len(imstd)
    logger.info('{0:.0%} of noise images are zeros'.format(zeronoisefrac))
    
    return pl, imstd_med, flagfrac_med
コード例 #4
0
ファイル: interactive.py プロジェクト: bandersen441/rtpipe
def plotnoisecum(noisepkl, fluxscale=1, plot_width=450, plot_height=400):
    """ Merged noise pkl converted to interactive cumulative histogram 

    noisepkl is standard noise pickle file.
    fluxscale is scaling applied by gain calibrator. telcal solutions have fluxscale=1.
    also returns corrected imnoise values if non-unity fluxscale provided
    """

    # noise histogram
    noises = read_noise(noisepkl)
    imnoise = np.sort(fluxscale*noises[4])
    frac = [float(count)/len(imnoise) for count in reversed(range(1, len(imnoise)+1))]
    noiseplot = Figure(plot_width=plot_width, plot_height=plot_height, toolbar_location="above",
                       x_axis_label='Image noise (Jy; cal scaling {0:.3})'.format(fluxscale),
                       y_axis_label='Cumulative fraction', tools='pan, wheel_zoom, reset')
    noiseplot.line(imnoise, frac)

    if fluxscale != 1:
        return noiseplot, imnoise
    else:
        return noiseplot