Пример #1
0
def tui_checkap(args):
    import omega as om

    if len(args) != 2:
        util.die('usage: <datfile> <antpol>')

    nc = NoiseCal()
    nc.load(args[0])

    ap = util.parseAP(args[1])
    apidx = nc.saps.index(ap)
    if apidx < 0:
        util.die('no antpol %s in data file!', util.fmtAP(ap))

    sqbps = nc.sqbps
    vals = nc.bpdata[:, 1]
    modelvals = nc.bpdata[:, 3] * nc.svals
    resids = vals - modelvals

    runcerts = np.sqrt(1. / nc.bpdata[:, 2] +
                       (nc.suncerts * nc.bpdata[:, 3])**2)
    resids /= runcerts

    w = np.where((sqbps[:, 0] == apidx) | (sqbps[:, 1] == apidx))
    resids = resids[w]

    n = resids.size
    mn = resids.mean()
    s = resids.std()
    md = np.median(resids)
    smadm = 1.4826 * np.median(np.abs(resids - md))  # see comment below

    print '       Number of samples:', n
    print '      Norm. mean residal:', mn
    print '                  Median:', md
    print 'Norm. residual std. dev.:', s
    print '                   SMADM:', smadm

    bins = 50
    rng = -5, 5
    p = om.quickHist(resids,
                     keyText='%s Residuals' % util.fmtAP(ap),
                     bins=bins,
                     range=rng)
    x = np.linspace(-5, 5, 200)
    area = 10. / bins * n
    y = area / np.sqrt(2 * np.pi) * np.exp(-0.5 * x**2)
    p.addXY(x, y, 'Ideal')
    p.rebound(False, False)
    p.show()

    return 0
Пример #2
0
def tui_checkap (args):
    import omega as om

    if len (args) != 2:
        util.die ('usage: <datfile> <antpol>')

    nc = NoiseCal ()
    nc.load (args[0])

    ap = util.parseAP (args[1])
    apidx = nc.saps.index (ap)
    if apidx < 0:
        util.die ('no antpol %s in data file!', util.fmtAP (ap))

    sqbps = nc.sqbps
    vals = nc.bpdata[:,1]
    modelvals = nc.bpdata[:,3] * nc.svals
    resids = vals - modelvals

    runcerts = np.sqrt (1./nc.bpdata[:,2] + (nc.suncerts * nc.bpdata[:,3])**2)
    resids /= runcerts

    w = np.where ((sqbps[:,0] == apidx) | (sqbps[:,1] == apidx))
    resids = resids[w]

    n = resids.size
    mn = resids.mean ()
    s = resids.std ()
    md = np.median (resids)
    smadm = 1.4826 * np.median (np.abs (resids - md)) # see comment below

    print '       Number of samples:', n
    print '      Norm. mean residal:', mn
    print '                  Median:', md
    print 'Norm. residual std. dev.:', s
    print '                   SMADM:', smadm


    bins = 50
    rng = -5, 5
    p = om.quickHist (resids, keyText='%s Residuals' % util.fmtAP (ap),
                      bins=bins, range=rng)
    x = np.linspace (-5, 5, 200)
    area = 10. / bins * n
    y = area / np.sqrt (2 * np.pi) * np.exp (-0.5 * x**2)
    p.addXY (x, y, 'Ideal')
    p.rebound (False, False)
    p.show ()

    return 0
Пример #3
0
def loadNoiseCalExport (path):
    byinstr = {}

    for a in pathwords (path):
        instr = a[0]
        ap = util.parseAP (a[1])
        value = float (a[2])

        byap = byinstr.setdefault (instr, {})
        byap[ap] = value

    for instr, byap in byinstr.items ():
        default = np.median (byap.values ())
        byinstr[instr] = (byap, default)

    return byinstr
Пример #4
0
def loadNoiseCalExport(path):
    byinstr = {}

    for a in pathwords(path):
        instr = a[0]
        ap = util.parseAP(a[1])
        value = float(a[2])

        byap = byinstr.setdefault(instr, {})
        byap[ap] = value

    for instr, byap in byinstr.items():
        default = np.median(byap.values())
        byinstr[instr] = (byap, default)

    return byinstr