Ejemplo n.º 1
0
def check_scatter_iq(value):
    """
    Check two processor, algorithm pairs against each other for IQ calculation
    :param value:
    :return:
    """
    # set everything up
    atoms, exp = value[:2]
    scat = ElasticScatter(exp_dict=exp, verbose=True)
    proc1, alg1 = value[-1][0]
    proc2, alg2 = value[-1][1]

    # run algorithm 1
    scat.set_processor(proc1, alg1)
    ans1 = scat.get_iq(atoms)

    # run algorithm 2
    scat.set_processor(proc2, alg2)
    ans2 = scat.get_iq(atoms)

    # test
    stats_check(ans1, ans2, rtol, atol)
    assert_allclose(ans1, ans2, rtol=rtol, atol=atol)
    # make certain we did not give back the same pointer
    assert ans1 is not ans2
Ejemplo n.º 2
0
def check_scatter_consistancy(value):
    atoms, exp = value[0:2]
    proc, alg = value[-1]

    scat = ElasticScatter(exp_dict=exp, verbose=True)
    scat.set_processor(proc, alg)
    ans = scat.get_pdf(atoms)
    ans1 = scat.get_fq(atoms)
    print(len(ans1))
    print(scat.get_scatter_vector().shape)
    ans2 = scat.get_sq(atoms)
    print(len(ans2))
    ans3 = scat.get_iq(atoms)
Ejemplo n.º 3
0
def check_scatter_iq(value):
    """
    Smoke test for IQ
    :param value:
    :return:
    """
    atoms, exp = value[0:2]
    proc, alg = value[-1]

    scat = ElasticScatter(exp_dict=exp, verbose=True)
    scat.set_processor(proc, alg)
    # Test a set of different sized ensembles
    
    ans = scat.get_iq(atoms)
    
    # Check that Scatter gave back something
    assert ans is not None
    # Check that all the values are not zero
    assert np.any(ans)
    del atoms, exp, proc, alg, scat, ans
    return
Ejemplo n.º 4
0
__author__ = 'christopher'

# atoms = Atoms('Au4', [[0, 0, 0], [3, 0, 0], [0, 3, 0], [3, 3, 0]])
atoms = ase.io.read('/mnt/work-data/dev/IID_data/db_test/PDF_LAMMPS_587.traj')
scat = ElasticScatter()
scat.update_experiment({'qmax': 8, 'qmin': .5})
s = scat.get_scatter_vector()

k = 100
i_max, j_max = k, k

pixel_array = np.zeros((i_max, j_max))
for i in range(i_max):
    for j in range(j_max):
        pixel_array[i, j] = np.sqrt(i**2 + j**2)

pixel_array /= np.max(pixel_array)
pixel_array *= np.max(s)

img = scat.get_2d_scatter(atoms, pixel_array)
print img.shape

# plt.imshow(pixel_array)
print np.max(img), np.min(img)
plt.imshow(img, aspect='auto')
plt.colorbar()
plt.show()

plt.plot(scat.get_iq(atoms))
plt.show()
Ejemplo n.º 5
0
# atoms = Atoms('Au4', [[0, 0, 0], [3, 0, 0], [0, 3, 0], [3, 3, 0]])
atoms = ase.io.read('/mnt/work-data/dev/IID_data/db_test/PDF_LAMMPS_587.traj')
scat = ElasticScatter()
scat.update_experiment({'qmax': 8, 'qmin': .5})
s = scat.get_scatter_vector()

k = 100
i_max, j_max = k, k

pixel_array = np.zeros((i_max, j_max))
for i in range(i_max):
    for j in range(j_max):
        pixel_array[i, j] = np.sqrt(i ** 2 + j ** 2)

pixel_array /= np.max(pixel_array)
pixel_array *= np.max(s)

img = scat.get_2d_scatter(atoms, pixel_array)
print img.shape


# plt.imshow(pixel_array)
print np.max(img), np.min(img)
plt.imshow(img, aspect='auto')
plt.colorbar()
plt.show()

plt.plot(scat.get_iq(atoms))
plt.show()