コード例 #1
0
ファイル: plots.py プロジェクト: machielblok/analysis
def plot_tail(fp, **kw):
    ret = kw.pop('ret', 'subplots')
    
    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)
    
    fig, (ax0, ax1) = plt.subplots(2,1, figsize=(12,8))
    _plot_photon_hist(ax0, h0, b0)
    _plot_photon_hist(ax1, h1, b1)
    
    ax0.set_xlim(settings.CH0_START-5, settings.CH0_START + 100)
    ax1.set_xlim(settings.CH1_START-5, settings.CH1_START + 100)
    ax0.set_title('tail channel 0')
    ax1.set_title('tail channel 1')
    
    fitres0, fitres1 = events.fit_tail(fp)
    
    ax0.plot(fitres0['fit_x'], fitres0['fit_y'], lw=2)
    ax1.plot(fitres1['fit_x'], fitres1['fit_y'], lw=2)
    
    ax0.text(settings.CH0_START, 1, fitres0['info'], va='bottom', ha='left', color='k', size='x-small',
             bbox = {'facecolor' : 'white', 'alpha' : 0.5})
    ax1.text(settings.CH1_START, 1, fitres1['info'], va='bottom', ha='left', color='k', size='x-small',
             bbox = {'facecolor' : 'white', 'alpha' : 0.5})
    
    starts = stats.get_sequence_starts(fp)
    ax0.text(settings.CH0_START+5, max(h0)/5., 
             'tailcounts / shot: {:.2e} ({} x {} starts)'.format(fitres0['tcpsh'], starts, settings.SEQREPS))
    ax1.text(settings.CH1_START+5, max(h1)/5., 
             'tailcounts / shot: {:.2e} ({} x {} starts)'.format(fitres1['tcpsh'], starts, settings.SEQREPS))

    fig.suptitle(files.get_msmt_header(fp) + ' -- Tail')

    if ret=='subplots':
        return fig, (ax0, ax1)
コード例 #2
0
ファイル: plots.py プロジェクト: machielblok/analysis
def plot_CR_hist_before_after(fp):
    h1b, b1b = stats.get_CR_hist_before(fp, 'lt1')
    h1a, b1a = stats.get_CR_hist_after(fp, 'lt1')

    fig, (ax1, ax2) = plt.subplots(1,2, figsize=(12,5))
    ax1.bar(np.arange(len(h1b)), h1b, align='center',
        width=1, color=settings.COLORS[0], lw=0, alpha=0.7,
        label='before')
    ax1.bar(np.arange(len(h1a)), h1a, align='center',
        width=1, color=settings.COLORS[1], lw=0, alpha=0.7,
        label='after')
    ax1.set_xlabel('CR counts')
    ax1.set_ylabel('Events')
    ax1.set_title('LT1')
    ax1.set_xlim(left=-0.5)
    ax1.legend(loc='best')

    h2b, b2b = stats.get_CR_hist_before(fp, 'lt2')
    h2a, b2a = stats.get_CR_hist_after(fp, 'lt2')

    ax2.bar(np.arange(len(h2b)), h2b, align='center',
        width=1, color=settings.COLORS[0], lw=0, alpha=0.7,
        label='before')
    ax2.bar(np.arange(len(h2a)), h2a, align='center',
        width=1, color=settings.COLORS[1], lw=0, alpha=0.7,
        label='after')
    ax2.set_xlabel('CR counts')
    ax2.set_title('LT2')
    ax2.set_xlim(left=-0.5)
    ax2.legend(loc='best')

    fig.suptitle(files.get_msmt_header(fp) + ' -- CR histogram before/after')
    folder, _fn = os.path.split(fp)
    fig.savefig(os.path.join(folder, 'CR_histogram_before-after.png'))
コード例 #3
0
ファイル: plots.py プロジェクト: zaguros/analysis
def plot_tail(fp, **kw):
    ret = kw.pop('ret', 'subplots')

    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)

    fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(12, 8))
    _plot_photon_hist(ax0, h0, b0)
    _plot_photon_hist(ax1, h1, b1)

    ax0.set_xlim(settings.CH0_START - 5, settings.CH0_START + 100)
    ax1.set_xlim(settings.CH1_START - 5, settings.CH1_START + 100)
    ax0.set_title('tail channel 0')
    ax1.set_title('tail channel 1')

    fitres0, fitres1 = events.fit_tail(fp)

    ax0.plot(fitres0['fit_x'], fitres0['fit_y'], lw=2)
    ax1.plot(fitres1['fit_x'], fitres1['fit_y'], lw=2)

    ax0.text(settings.CH0_START,
             1,
             fitres0['info'],
             va='bottom',
             ha='left',
             color='k',
             size='x-small',
             bbox={
                 'facecolor': 'white',
                 'alpha': 0.5
             })
    ax1.text(settings.CH1_START,
             1,
             fitres1['info'],
             va='bottom',
             ha='left',
             color='k',
             size='x-small',
             bbox={
                 'facecolor': 'white',
                 'alpha': 0.5
             })

    starts = stats.get_sequence_starts(fp)
    ax0.text(
        settings.CH0_START + 5,
        max(h0) / 5., 'tailcounts / shot: {:.2e} ({} x {} starts)'.format(
            fitres0['tcpsh'], starts, settings.SEQREPS))
    ax1.text(
        settings.CH1_START + 5,
        max(h1) / 5., 'tailcounts / shot: {:.2e} ({} x {} starts)'.format(
            fitres1['tcpsh'], starts, settings.SEQREPS))

    fig.suptitle(files.get_msmt_header(fp) + ' -- Tail')

    if ret == 'subplots':
        return fig, (ax0, ax1)
コード例 #4
0
ファイル: plots.py プロジェクト: machielblok/analysis
def plot_CR_hist_sequence_timeout(fp):
    h1, b1 = stats.get_CR_hist_sequence_timeout(fp, 'lt1')
    h2, b2 = stats.get_CR_hist_sequence_timeout(fp, 'lt2')
    
    fig, (ax1, ax2) = plt.subplots(1,2, figsize=(12,5))
    _plot_CR_hist(ax1, h1, title='LT1')
    _plot_CR_hist(ax2, h2, title='LT2')
    
    fig.suptitle(files.get_msmt_header(fp) + ' -- CR histogram sequence timeout')
    folder, _fn = os.path.split(fp)
    fig.savefig(os.path.join(folder, 'CR_histogram_sequence_timeout.png'))
コード例 #5
0
ファイル: plots.py プロジェクト: zaguros/analysis
def plot_CR_hist_before_after(fp):
    h1b, b1b = stats.get_CR_hist_before(fp, 'lt1')
    h1a, b1a = stats.get_CR_hist_after(fp, 'lt1')

    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
    ax1.bar(np.arange(len(h1b)),
            h1b,
            align='center',
            width=1,
            color=settings.COLORS[0],
            lw=0,
            alpha=0.7,
            label='before')
    ax1.bar(np.arange(len(h1a)),
            h1a,
            align='center',
            width=1,
            color=settings.COLORS[1],
            lw=0,
            alpha=0.7,
            label='after')
    ax1.set_xlabel('CR counts')
    ax1.set_ylabel('Events')
    ax1.set_title('LT1')
    ax1.set_xlim(left=-0.5)
    ax1.legend(loc='best')

    h2b, b2b = stats.get_CR_hist_before(fp, 'lt2')
    h2a, b2a = stats.get_CR_hist_after(fp, 'lt2')

    ax2.bar(np.arange(len(h2b)),
            h2b,
            align='center',
            width=1,
            color=settings.COLORS[0],
            lw=0,
            alpha=0.7,
            label='before')
    ax2.bar(np.arange(len(h2a)),
            h2a,
            align='center',
            width=1,
            color=settings.COLORS[1],
            lw=0,
            alpha=0.7,
            label='after')
    ax2.set_xlabel('CR counts')
    ax2.set_title('LT2')
    ax2.set_xlim(left=-0.5)
    ax2.legend(loc='best')

    fig.suptitle(files.get_msmt_header(fp) + ' -- CR histogram before/after')
    folder, _fn = os.path.split(fp)
    fig.savefig(os.path.join(folder, 'CR_histogram_before-after.png'))
コード例 #6
0
ファイル: plots.py プロジェクト: zaguros/analysis
def plot_CR_hist_total(fp):
    h1, b1 = stats.get_CR_hist_total(fp, 'lt1')
    h2, b2 = stats.get_CR_hist_total(fp, 'lt2')

    fig, (ax1, ax2) = files.subplots(1, 2, figsize=(12, 5))
    _plot_CR_hist(ax1, h1, title='LT1')
    _plot_CR_hist(ax2, h2, title='LT2')

    fig.suptitle(files.get_msmt_header(fp) + ' -- CR histogram total')
    folder, _fn = os.path.split(fp)
    fig.savefig(os.path.join(folder, 'CR_histogram_total.png'))
コード例 #7
0
ファイル: plots.py プロジェクト: machielblok/analysis
def plot_photon_hist(fp, **kw):    
    ret = kw.pop('ret', 'subplots')

    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)
   
    fig, (ax0, ax1) = plt.subplots(2,1, figsize=(12,8))
    _plot_photon_hist(ax0, h0, b0)
    _plot_photon_hist(ax1, h1, b1)

    ax0.set_title('photons channel 0')
    ax1.set_title('photons channel 1')
    
    fig.suptitle(files.get_msmt_header(fp) + ' -- Photon histogram')
    
    if ret == 'subplots':
        return fig, (ax0, ax1)
コード例 #8
0
ファイル: plots.py プロジェクト: zaguros/analysis
def plot_photon_hist(fp, **kw):
    ret = kw.pop('ret', 'subplots')

    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)

    fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(12, 8))
    _plot_photon_hist(ax0, h0, b0)
    _plot_photon_hist(ax1, h1, b1)

    ax0.set_title('photons channel 0')
    ax1.set_title('photons channel 1')

    fig.suptitle(files.get_msmt_header(fp) + ' -- Photon histogram')

    if ret == 'subplots':
        return fig, (ax0, ax1)
コード例 #9
0
ファイル: plots.py プロジェクト: machielblok/analysis
def plot_photon_hist_filter_comparison(fp, fltr, **kw):
    ret = kw.pop('ret', 'subplots')
    
    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)
    (h0f, b0f), (h1f, b1f) = events.get_photon_hist(fp, fltr=fltr, **kw)
    
    fig, (ax0, ax1) = plt.subplots(2,1, figsize=(12,8))
    _plot_photon_hist(ax0, h0, b0, label='unfiltered')
    _plot_photon_hist(ax0, h0f, b0f, label='filtered')

    _plot_photon_hist(ax1, h1, b1, label='unfiltered')
    _plot_photon_hist(ax1, h1f, b1f, label='filtered')
    
    ax0.set_title('photons channel 0')
    ax1.set_title('photons channel 1')

    fig.suptitle(files.get_msmt_header(fp) + ' -- Photon histogram, comparison w/ filter')
        
    if ret=='subplots':
        return fig, (ax0, ax1)
コード例 #10
0
ファイル: plots.py プロジェクト: zaguros/analysis
def plot_photon_hist_filter_comparison(fp, fltr, **kw):
    ret = kw.pop('ret', 'subplots')

    (h0, b0), (h1, b1) = events.get_photon_hist(fp, **kw)
    (h0f, b0f), (h1f, b1f) = events.get_photon_hist(fp, fltr=fltr, **kw)

    fig, (ax0, ax1) = plt.subplots(2, 1, figsize=(12, 8))
    _plot_photon_hist(ax0, h0, b0, label='unfiltered')
    _plot_photon_hist(ax0, h0f, b0f, label='filtered')

    _plot_photon_hist(ax1, h1, b1, label='unfiltered')
    _plot_photon_hist(ax1, h1f, b1f, label='filtered')

    ax0.set_title('photons channel 0')
    ax1.set_title('photons channel 1')

    fig.suptitle(
        files.get_msmt_header(fp) +
        ' -- Photon histogram, comparison w/ filter')

    if ret == 'subplots':
        return fig, (ax0, ax1)