Esempio n. 1
0
def initialize_one_shot(dummy):
    """ Initialize the one shot calculation"""
    p = read_inputs()  # read all the inputs
    os.system("cp ../cilib/" + str(p.n) + "/* ./")  # copy input files
    #  os.system("cp "+ str(p.n) + "/* ./") # copy input files
    at = CIatom()  # create the CI object
    at.read()  # read all the matrices
    at.get_basis()  # read the basis from file
    m = DE(at, D=p.D, E=p.E, soc=p.soc, U=p.U, O=p.O, z4=p.z4,
           b=p.b)  # get the hamiltonian
    if do_check: check_all(at)  # check the hamiltonian
    header = latex_DE(at,
                      D=p.D,
                      E=p.E,
                      soc=p.soc,
                      U=p.U,
                      O=p.O,
                      z4=p.z4,
                      n=p.n,
                      b=p.b)  # string for the hamiltonian
    ls = lowest_states(m)  # create the object
    ls.disentangle_manifolds(at.jz)
    write.write_all(at, ls, header=header)
    os.system("pdflatex spectrum_ci.tex")
    os.system("cp spectrum_ci.pdf ../")  # copy to the previous folder
Esempio n. 2
0
def check_pwd(strs, passlist):
    ck_result = check.check_all(strs)
    if ck_result:
        passlist.write(strs + "\n")
    else:
        #		print "Weak password!"
        pass
Esempio n. 3
0
            print >> output, "unknown key '%s' in output" % (key)
            ok = False
    if ok:
        for key in a_order:
            if key in b_lookup:
                v1, v2 = a_lookup[key], b_lookup[key]
                print "%s: reference:%s yours:%s difference: %lf" % (
                    key, v1, v2, float(v2) - float(v1))
            else:
                print >> output, "key '%s' is missing from output" % (key)
                ok = False
    return ok


checks = {
    "ppattach_prep": {
        'stdout': diff_report_scores
    },
    "ppattach_all": {
        'stdout': diff_report_scores
    },
    "ppattach_curve": {
        'file_check': ["ppattach_curve.png", os.path.exists]
    },
    "rechunk": {
        'stdout': diff_report_scores
    },
}

check.check_all(checks, extra_usage=__doc__.rstrip('\n\r'))
def make_file_check_llvm_err(**args):
    gold_path, output_path = gold_output_paths(".llvm.ret", **args)
    diff_exit_status = make_diff_exit_status("Testcase was expected to succeed but failed.", "Testcase was expected to fail but succeeded.")
    return { 'gold': gold_path, 'output': output_path, 'check': diff_exit_status, 'load_lines': True, 'backup': False, 'gold_default': ['0'], 'name': "code generation exit status" }

def make_file_check_run_out(**args):
    gold_path, output_path = gold_output_paths(".run.out", **args)
    return { 'gold': gold_path, 'output': output_path, 'check': diff_exact, 'load_lines': True, 'backup': False, 'gold_default': [], 'name': "final output from compiled program" }

checks = {
        "q0": {},
        "q0-hw3": {},
        "q1": {},
        "q2": {},
        "q3": {},
        "q4": {},
        "q5": {},
        "q6-success": {},
        "q6-failure": {},
    }

check_defaults = {
        'command': command,
        'source_files': [codegen],
        'stdout': None,
        'stderr': None,
        'file_checks': [make_file_check_llvm_err, make_file_check_run_out]
    } 

check.check_all(checks, check_defaults, extra_usage=__doc__.rstrip('\n\r') % (source_extension))
Esempio n. 5
0
            for j in ewords:
                output.write("---")
            output.write("\n")
            for k in range(max(map(len, ewords))):
                output.write("  ")
                for word in ewords:
                    letter = word[k] if len(word) > k else " "
                    output.write(" %s " % letter)
                output.write("\n")
            output.write("\n")

    precision = size_a_and_p / size_a
    recall = size_a_and_s / size_s
    aer = 1 - ((size_a_and_s + size_a_and_p) / (size_a + size_s))
    output.write("Precision = %f\nRecall = %f\nAER = %f\n" %
                 (precision, recall, aer))
    print >> sys.stderr, "Precision = %f\nRecall = %f\nAER = %f\n" % (
        precision, recall, aer)
    return True


checks = {
    "align": {
        'stdout': grade_align
    },
}

check.check_all(checks,
                extra_ops=('p:n:', align_ops),
                extra_usage=__doc__.rstrip('\n\r'))
Esempio n. 6
0
    try:
        a_order, a_lookup = parse(a, "reference", None)
        b_order, b_lookup = parse(b, "output", a_order)
    except ValueError, e:
        return False

    ok = True
    for key in b_order:
        if key not in a_lookup:
            print >> output, "unknown key '%s' in output" % (key)
            ok = False
    if ok:
        for key in a_order:
            if key in b_lookup:
                v1, v2 = a_lookup[key], b_lookup[key]
                print "%s: reference:%s yours:%s difference: %lf" % (key, v1, v2, float(v2)-float(v1))
            else:
                print >> output, "key '%s' is missing from output" % (key)
                ok = False
    return ok

checks = {
    "ppattach_prep": { 'stdout': diff_report_scores },
    "ppattach_all": { 'stdout': diff_report_scores },
    "ppattach_curve": { 'file_check': ["ppattach_curve.png", os.path.exists] },
    "rechunk": { 'stdout': diff_report_scores },
}

check.check_all(checks, extra_usage=__doc__.rstrip('\n\r'))
Esempio n. 7
0
          for (j, _) in enumerate(ewords):
            (left,right) = ("(",")") if (i,j) in alignment else (" "," ")
            point = "*" if (i,j) in sure else "?" if (i,j) in possible else " "
            output.write("%s%s%s" % (left,point,right))
          output.write(" | %s\n" % f_i)
        output.write("  ")
        for j in ewords:
          output.write("---")
        output.write("\n")
        for k in range(max(map(len, ewords))):
          output.write("  ")
          for word in ewords:
            letter = word[k] if len(word) > k else " "
            output.write(" %s " % letter)
          output.write("\n")
        output.write("\n")

    precision = size_a_and_p / size_a
    recall = size_a_and_s / size_s
    aer = 1 - ((size_a_and_s + size_a_and_p) / (size_a + size_s))
    output.write("Precision = %f\nRecall = %f\nAER = %f\n" % (precision, recall, aer))
    print >>sys.stderr, "Precision = %f\nRecall = %f\nAER = %f\n" % (precision, recall, aer)
    return True

checks = {
    "align": { 'stdout': grade_align },
}

check.check_all(checks, extra_ops=('p:n:', align_ops), extra_usage=__doc__.rstrip('\n\r'))


def make_file_check_run_out(**args):
    gold_path, output_path = gold_output_paths(".run.out", **args)
    return {
        'gold': gold_path,
        'output': output_path,
        'check': diff_exact,
        'load_lines': True,
        'backup': False,
        'gold_default': [],
        'name': "final output from compiled program"
    }


checks = {
    "contest": {},
}

check_defaults = {
    'command': command,
    'source_files': [codegen],
    'stdout': None,
    'stderr': None,
    'file_checks': [make_file_check_llvm_err, make_file_check_run_out]
}

check.check_all(checks,
                check_defaults,
                extra_usage=__doc__.rstrip('\n\r') % (source_extension))
Esempio n. 9
0
def check_proxy():
    check_all()
    return jsonify({
        "status": 0,
        "msg": "ok",
    })