Exemple #1
0
def test_mix_2():
    input_data = [0.05, 0.1, [], 1.0]
    good_data = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5,
                 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0]
    output_data = s.float_set(input_data)
    success, msg = sets_are_equal(output_data, good_data)
    assert success, msg
Exemple #2
0
def test_mix_3():
    input_data = [0.05, 0.1, [], 1.0, 1.1, [], 2.0, 2.2, [],
                  3.8, 3.82, [], 4.2, 4.25, [], 4.5, 4.6, [],
                  5.0, 5.5, [], 8.0]
    good_data = [0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5,
                 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0,
                 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
                 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8,
                 3.82, 3.84, 3.86, 3.88, 3.9 , 3.92, 3.94, 3.96, 3.98,
                 4.0, 4.02, 4.04, 4.06, 4.08, 4.10, 4.12, 4.14, 4.16,
                 4.18, 4.20,
                 4.25, 4.3, 4.35, 4.4, 4.45, 4.5,
                 4.6, 4.7, 4.8, 4.9,
                 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0]
    output_data = s.float_set(input_data)
    success, msg = sets_are_equal(output_data, good_data)
    assert success, msg
Exemple #3
0
def test_mix_1():
    assert (s.float_set([0, [3], 3, 4, [], 6]) ==
            [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
Exemple #4
0
def check_with_sets_are_equal(a, b):
    success, msg = sets_are_equal(s.float_set(a), b)
    assert success, msg
Exemple #5
0
def check_plain(a,b):
    assert s.float_set(a) == b
Exemple #6
0
    if header and os.path.exists(file): return
    f = open(file, "a")
    f.write(line)
    f.close()

out("# d/l_ex  Hc/Ms  Mr_x/Ms  Mr_y/Ms\n", header=True)

args = []
if len(sys.argv) > 1:
    # We take only arguments which do not contain '-'
    # (just to avoid considering '-ldebug' and other options)
    for arg in sys.argv[1:]:
        if not('-' in arg): args.append(arg)

if len(args) != 0:
    d_list = sets.float_set(args)
else:
    d_list = sets.float_set([5]) #, 6, "...", 10])

for d in d_list:
    mesh_file = specification.bar_mesh
    r = mumag2_simulation(mesh_file, specification.mesh_unit_length, Hs, m0)
    #ocaml.sys_check_heap()

    mesh_unit_length_nm = float(specification.mesh_unit_length/SI(1e-9, "m"))
    out("# d=%f, mesh='%s', scaling=%f\n" % (d, mesh_file, mesh_unit_length_nm))
    out("%f %f %f %f\n" % (d, r["hc"], r["mrx"], r["mry"]))

    m_out = open("m_d%03.0f.dat" % d, "w")
    for h_par, m_par, (mx, my, mz), t in zip(r["h_pars"], r["m_pars"], r["ms"], r["ts"]):
        m_out.write("%g %g %g %g %g %g\n" % (h_par, m_par, mx, my, mz, t))