def PlotPatchBins(Sc, PatchData, NumBins, color, MinimumBinSize=7, ErrorBars=True):
    """
    Plot E*R* data binned from the hilltop pacth data.
    """
    E_s = E_Star(Sc, PatchData[6], PatchData[2])
    R_s = R_Star(Sc, PatchData[10], PatchData[2])

    bin_x, bin_std_x, bin_y, bin_std_y, std_err_x, std_err_y, count = Bin.bin_data_log10(E_s, R_s, NumBins)

    # filter bins based on the number of data points used in their calculation
    bin_x = np.ma.masked_where(count < MinimumBinSize, bin_x)
    bin_y = np.ma.masked_where(count < MinimumBinSize, bin_y)
    # these lines produce a meaningless warning - don't know how to solve it yet.

    if ErrorBars:
        # only plot errorbars for y as std dev of x is just the bin width == meaningless
        plt.scatter(
            bin_x,
            bin_y,
            c=count,
            s=50,
            edgecolor="",
            cmap=plt.get_cmap("autumn_r"),
            label="Binned Patch Data",
            zorder=100,
        )
        plt.errorbar(bin_x, bin_y, yerr=std_err_y, fmt=None, ecolor="k", elinewidth=2, capsize=3, zorder=0)
        cbar = plt.colorbar()
        cbar.set_label("Number of values per bin")

    else:
        plt.errorbar(bin_x, bin_y, fmt="o", color=color, label="No. of Bins = " + str(NumBins))
示例#2
0
def PlotRawBins(Sc, RawData, NumBins, MinimumBinSize=100, ErrorBars=True):
    """
    Plot E*R* data binned from the raw data.
    """
    E_s = E_Star(Sc, RawData[3], RawData[2])
    R_s = R_Star(Sc, RawData[4], RawData[2])

    (bin_x, bin_std_x, bin_y, bin_std_y, std_err_x, std_err_y,
     count) = Bin.bin_data_log10(E_s, R_s, NumBins)

    # filter bins based on the number of data points used in their calculation
    bin_x = np.ma.masked_where(count < MinimumBinSize, bin_x)
    bin_y = np.ma.masked_where(count < MinimumBinSize, bin_y)
    # these lines produce a meaningless warning - don't know how to solve it yet

    if ErrorBars:
        # only plot errorbars for y as std dev of x is the bin width
        plt.scatter(bin_x,
                    bin_y,
                    c=count,
                    s=50,
                    edgecolor='',
                    cmap=plt.get_cmap("autumn_r"),
                    label='Binned Raw Data',
                    zorder=100)
        plt.errorbar(bin_x,
                     bin_y,
                     yerr=std_err_y,
                     fmt=None,
                     ecolor='k',
                     zorder=0)
        cbar = plt.colorbar()
        cbar.set_label('Number of values per bin')
    else:
        plt.errorbar(bin_x, bin_y, fmt='bo', label='Binned Raw Data')
示例#3
0
def PlotPatchBins(Sc, PatchData, NumBins, MinimumBinSize=10, ErrorBars=True):
    """
    Plot E*R* data binned from the hilltop pacth data.
    """
    E_s = E_Star(Sc, PatchData[6], PatchData[2])
    R_s = R_Star(Sc, PatchData[10], PatchData[2])

    (bin_x, bin_std_x, bin_y, bin_std_y,
     std_err_x, std_err_y, count) = Bin.bin_data_log10(E_s, R_s, NumBins)

    # filter bins based on the number of data points used in their calculation
    bin_x = np.ma.masked_where(count < MinimumBinSize, bin_x)
    bin_y = np.ma.masked_where(count < MinimumBinSize, bin_y)
    # these lines produce a meaningless warning - don't know how to solve it yet

    if ErrorBars:
        # only plot errorbars for y as std dev of x is the bin width
        plt.scatter(bin_x, bin_y, c=count, s=50, edgecolor='',
                    cmap=plt.get_cmap("autumn_r"), label='Binned Patch Data',
                    zorder=100)
        plt.errorbar(bin_x, bin_y, yerr=std_err_y, fmt=None, ecolor='k',
                     zorder=0)
        cbar = plt.colorbar()
        cbar.set_label('Number of values per bin')

    else:
        plt.errorbar(bin_x, bin_y, fmt='bo', label='Binned Patch Data')