Exemple #1
0
    def test_py_cpu_smoke(self):

        traj = trajectory.load(ref_file('ala2.pdb'))
        
        num_molecules = 1
        detector = xray.Detector.generic()
        detector.beam.photons_scattered_per_shot = 1e3

        I = scatter.simulate_shot(traj, num_molecules, detector, 
                                  finite_photon=True)
                                          
        # simple statistical sanity check
        assert np.abs(I.sum() - detector.beam.photons_scattered_per_shot) < \
                           np.sqrt(detector.beam.photons_scattered_per_shot)*6.0
Exemple #2
0
    def test_python_call(self):
        """
        Test the GPU scattering simulation interface (scatter.simulate)
        """

        if not GPU: raise SkipTest
        print "testing python wrapper fxn..."
        
        traj = trajectory.load(ref_file('ala2.pdb'))
        num_molecules = 512
        detector = xray.Detector.generic()

        py_I = scatter.simulate_shot(traj, num_molecules, detector)

        assert not np.all( py_I == 0.0 )
        assert not np.isnan(np.sum( py_I ))
Exemple #3
0
from odin import installed
if installed.gpuscatter:
    GPU = True
    from odin import gpuscatter
else:
    GPU = False

from odin.refdata import cromer_mann_params
from odin import xray, scatter, cpuscatter, structure
from odin.structure import rand_rotate_molecule

from mdtraj import trajectory
                
                
import matplotlib.pyplot as plt
        
# traj = trajectory.load('reference/ala2.pdb')
traj = structure.load_coor('reference/gold1k.coor')

num_molecules = 10
detector = xray.Detector.generic()
detector.beam.photons_scattered_per_shot = 1e4

I = scatter.simulate_shot(traj, num_molecules, detector, 
                          finite_photon=False)
print I.shape

plt.imshow( I.reshape(201,201), vmin=0, vmax=1e5 )
plt.show()