示例#1
0
文件: movie.py 项目: BNLIF/nuosc
def main(cmdline_file, outpat):
    outdir = os.path.dirname(outpat)
    data_file = os.path.join(outdir, 'magic.nod')
    params = nuosc.read_param_file(cmdline_file)
    params['data'] = data_file
    params['cmdline'] = os.path.join(outdir, 'magic.nop')
    params['info'] = '/dev/null'
    nuosc.call(**params)
    prob_data = nuosc.read_data(data_file)
    make_frames(prob_data, outpat, **params)
示例#2
0
文件: movie.py 项目: brettviren/nuosc
def main(cmdline_file, outpat):
    outdir = os.path.dirname(outpat)
    data_file = os.path.join(outdir, "magic.nod")
    params = nuosc.read_param_file(cmdline_file)
    params["data"] = data_file
    params["cmdline"] = os.path.join(outdir, "magic.nop")
    params["info"] = "/dev/null"
    nuosc.call(**params)
    prob_data = nuosc.read_data(data_file)
    make_frames(prob_data, outpat, **params)
示例#3
0
def get_graph(nu, **p):
    data = nuosc.call(**p)
    g = ROOT.TGraph()
    for ind, d in enumerate(data):
        prob = d[2 + nu]
        energy = d[0]
        g.SetPoint(ind, energy, prob)
    print p['delta'], len(data)
    return g
示例#4
0
def get_graph(nu, **p):
    data = nuosc.call(**p)
    g = ROOT.TGraph()
    for ind, d in enumerate(data):
        prob = d[2+nu]
        energy = d[0]
        g.SetPoint(ind, energy, prob)
    print p['delta'], len(data)
    return g
示例#5
0
def test_call():
    tdir = tempfile.mkdtemp()
    print tdir

    info_file = os.path.join(tdir,"test.info")
    cmdl_file = os.path.join(tdir,"test.cmdline")

    d = dict(osc_params, info = info_file, cmdline = cmdl_file)
    res = [x for x in nuosc.call(**d)]
    assert res, "No results for: %s" % str(d)
    
    args = nuosc.read_param_file(cmdl_file)
    res2 = [x for x in nuosc.call(**args)]
    
    print 'res:', res
    print 'res2:', res2
    for x1,x2 in zip(res, res2):
        assert x1 == x2
        print x1
示例#6
0
def make_hist(name, **kwds):
    ne = int(math.ceil(kwds['maxe'] / kwds['de']))
    nl = int(math.ceil(kwds['maxl'] / kwds['dl']))
    print '"{name}" energy: {ne},{de},{maxe}, {nl},{dl},{maxl}'.format(
        name=name, ne=ne, nl=nl, **kwds)

    h = ROOT.TH2F(name, 'numu -> %s' % name, ne, 0, kwds['maxe'], nl, 0,
                  kwds['maxl'])
    h.SetStats(0)
    return h


allcfg = dict(oscparams, **limits)
hists = list()
for name in ['nue', 'numu', 'nutau']:
    h = make_hist(name, **allcfg)
    hists.append(h)

e_eps = 0.5 * limits['de']
l_eps = 0.5 * limits['dl']

for e, l, a, b, c, _, _ in nuosc.call(**oscparams):
    for h, p in zip(hists, [a, b, c]):
        h.Fill(e + e_eps, l + l_eps, p)

fp = ROOT.TFile('oscillogram.root', 'recreate')
for h in hists:
    h.Write()
fp.Close()
示例#7
0
def make_hist(name, **kwds):
    ne = int(math.ceil(kwds['maxe']/kwds['de']))
    nl = int(math.ceil(kwds['maxl']/kwds['dl']))
    print '"{name}" energy: {ne},{de},{maxe}, {nl},{dl},{maxl}'.format(name=name,ne=ne,nl=nl,**kwds)
    

    h =  ROOT.TH2F(name,'numu -> %s'%name, 
                   ne, 0, kwds['maxe'],
                   nl, 0, kwds['maxl'])
    h.SetStats(0)
    return h

allcfg = dict(oscparams, **limits)
hists = list()
for name in ['nue','numu','nutau']:
    h = make_hist(name, **allcfg)
    hists.append(h)

e_eps = 0.5 * limits['de']
l_eps = 0.5 * limits['dl']

for e,l,a,b,c,_,_ in nuosc.call(**oscparams):
    for h,p in zip(hists, [a,b,c]):
        h.Fill(e+e_eps, l+l_eps, p)

fp = ROOT.TFile('oscillogram.root','recreate')
for h in hists:
    h.Write()
fp.Close()