__author__ = 'christopher'
import numpy as np
from pyiid.wrappers.scatter import Scatter
from pyiid.tests import setup_atoms, generate_experiment
from pyiid.testing.decorators import known_fail_if


def test_scatter_fq():
    for i in range(4):
        if i == 0:
            exp = None
        else:
            exp = generate_experiment()
        scat = Scatter(exp_dict=exp)
        # Test a set of different sized ensembles
        for n in np.logspace(1, 3, 3):
            atoms = setup_atoms(int(n))
            fq = scat.get_fq(atoms)
            print fq
            # Check that Scatter gave back something
            assert fq is not None
            # Check that all the values are not zero
            assert np.any(fq)


def test_scatter_pdf():
    for i in range(4):
        if i == 0:
            exp = None
        else:
            exp = generate_experiment()
        scat = Scatter(exp_dict=exp)
        # Test a set of different sized ensembles
        for n in np.logspace(1, 3, 3):
            atoms = setup_atoms(int(n))
            pdf = scat.get_pdf(atoms)
            # Check that Scatter gave back something
            assert pdf is not None
            # Check that all the values are not zero
            assert np.any(pdf)


@known_fail_if(True)
def test_gpu_scatter_fail():
    for i in range(4):
        if i == 0:
            exp = None
        else:
            exp = generate_experiment()
        scat = Scatter(exp_dict=exp)
        scat.set_processor('Multi-GPU')
        assert scat.processor == 'Multi-GPU'

if __name__ == '__main__':
    import nose
    nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
@@ -552,16 +552,1025 @@
     
-print fq
+# Check that Scatter gave back something%0A            assert fq is not None%0A            # Check that all the values are not zero%0A            assert np.any(fq)%0A%0Adef test_scatter_fq():%0A    for i in range(4):%0A        if i == 0:%0A            exp = None%0A        else:%0A            exp = generate_experiment()%0A        scat = Scatter(exp_dict=exp)%0A        # Test a set of different sized ensembles%0A        for n in np.logspace(1, 3, 3):%0A            atoms = setup_atoms(int(n))%0A            sq = scat.get_sq(atoms)%0A            # Check that Scatter gave back something%0A            assert sq is not None%0A            # Check that all the values are not zero%0A            assert np.any(sq)%0A%0Adef test_scatter_fq():%0A    for i in range(4):%0A        if i == 0:%0A            exp = None%0A        else:%0A            exp = generate_experiment()%0A        scat = Scatter(exp_dict=exp)%0A        # Test a set of different sized ensembles%0A        for n in np.logspace(1, 3, 3):%0A            atoms = setup_atoms(int(n))%0A            iq = scat.get_iq(atoms)
 %0A   
@@ -1630,33 +1630,33 @@
          assert 
-f
+i
 q is not None%0A  
@@ -1728,25 +1728,25 @@
 sert np.any(
-f
+i
 q)%0A%0A%0Adef tes

add sq, iq