Exemple #1
0
def calcRealIntensity(elem, channel, error):
    # get measurement, underground and spectrum of lamp
    data = P1SemiCon.fromPath('../data/part1/%s_Messung.txt' % elem, (P1SemiCon.CENERGY, channel))
    data.setYErrorAbs(error)
    underground = P1SemiCon.fromPath('../data/part1/%s_Untergrund.txt' % elem, (P1SemiCon.CENERGY, channel))
    data.setYErrorAbs(error)
    lamp = P1SemiCon.fromPath('../data/part1/%s_Lampe.txt' % elem, (P1SemiCon.CENERGY, P1SemiCon.CPYRO))
    lamp.setYErrorAbs(error)

    # calculate real itensity
    data.subtractUnderground(underground)
    data.normalize(lamp)
    data.setXErrorRel(0.01)
    return data
Exemple #2
0
def plotMultiChannelSpectrum(elem, mode, multichannels, legendlabels, rangeX, rangeY=(0, 5.5), connect=False, addlabel=''):
    label = '%s_%s' % (elem, mode)
    drawoptions = 'L' if connect else ''

    c = TCanvas('c_spectrum_%s' % label, '', 1280, 720)
    graphs = []
    l = TLegend(0.6, 0.8 - len(multichannels) * 0.05, 0.85, 0.85)
    for i, channels in enumerate(multichannels):
        data = P1SemiCon.fromPath('../data/part1/%s.txt' % label, channels)
        g = data.makeGraph('g_spectrum_%s' % label, P1SemiCon.LABELS[channels[0]], P1SemiCon.LABELS[channels[1]])
        g.SetMarkerStyle(1)
        g.SetMinimum(rangeY[0])
        g.SetMaximum(rangeY[1])
        g.GetXaxis().SetRangeUser(rangeX[0], rangeX[1])
        g.SetLineWidth(0)
        g.SetMarkerStyle(8)
        g.SetMarkerSize(0.4)

        l.AddEntry(g, legendlabels[i], 'pl')

        graphs.append(g)

    first = True
    for i, g in enumerate(graphs):
        if first:
            g.SetMarkerColor(2)
            g.SetLineColor(2)
            g.Draw('AP' + drawoptions)
            first = False
        else:
            g.SetMarkerColor(3 + i)
            g.SetLineColor(3 + i)
            g.Draw('P' + drawoptions)
    l.Draw()

    vline = TLine(0, rangeY[0], 0, rangeY[1])
    vline.Draw()

    c.Update()
    c.Print('../img/part1/%s_spectrum%s.pdf' % (label, addlabel), 'pdf')
Exemple #3
0
def evalYErrors(elem):
    errorTransPyro = np.std(P1SemiCon.fromPath('../data/part1/%s_Fehler_MaxTrans.txt' % elem, (P1SemiCon.CANGLE, P1SemiCon.CPYRO)).getY(), ddof=1)
    errorTransSample = np.std(P1SemiCon.fromPath('../data/part1/%s_Fehler_MaxTrans.txt' % elem, (P1SemiCon.CANGLE, P1SemiCon.CSAMPLE)).getY(), ddof=1)
    errorAbsPyro = np.std(P1SemiCon.fromPath('../data/part1/%s_Fehler_MaxAbs.txt' % elem, (P1SemiCon.CANGLE, P1SemiCon.CPYRO)).getY(), ddof=1)
    errorAbsSample = np.std(P1SemiCon.fromPath('../data/part1/%s_Fehler_MaxAbs.txt' % elem, (P1SemiCon.CANGLE, P1SemiCon.CSAMPLE)).getY(), ddof=1)
    return max(errorAbsPyro, errorTransPyro), max(errorAbsSample, errorTransSample)