예제 #1
0
import numpy
import condor

# Construct Source instance
src = condor.Source(wavelength=0.1E-9, pulse_energy=1E-3, focus_diameter=1E-6)

# Construct Detector instance
det = condor.Detector(distance=0.05, pixel_size=110E-6, nx=1000, ny=1000)

# Construct ParticleSphere instance
par = condor.ParticleSphere(diameter=1E-9, material_type="water")

# Combine source, detector, and particle by constructing Experiment instance
E = condor.Experiment(src, {"particle_sphere" : par}, det)

# Calculate diffraction pattern and obtain results in a dict
res = E.propagate()

# Arrays for Fourier and real space
data_fourier = res["entry_1"]["data_1"]["data_fourier"]
real_space = numpy.fft.fftshift(numpy.fft.ifftn(data_fourier))
예제 #2
0
import condor
this_dir = os.path.dirname(os.path.realpath(__file__))

do_plot = False

if do_plot:
    import matplotlib
    matplotlib.use('TkAgg')
    from matplotlib import pyplot
    from matplotlib.colors import LogNorm

src = condor.Source(wavelength=0.1E-10, pulse_energy=1E-3, focus_diameter=1E-6)
ds = 16
det = condor.Detector(distance=2., pixel_size=110E-6*ds, nx=1024/ds+1, ny=1024/ds+1, solid_angle_correction=False)

psphere = {"particle_sphere": condor.ParticleSphere(diameter=1E-9, material_type="water")}
pmap = {"particle_map": condor.ParticleMap(diameter=1E-9, material_type="water", geometry="icosahedron")}
patoms = {"particle_atoms": condor.ParticleAtoms(pdb_filename="%s/../../DNA.pdb" % this_dir)}
          
particles = [psphere, pmap, patoms]

if do_plot:
    fig, (axs1, axs2) = pyplot.subplots(2, len(particles), figsize=(3*len(particles), 3*2))

for i,par in enumerate(particles): 

    E = condor.Experiment(src, par, det)
    res = E.propagate()
    data = res["entry_1"]["data_1"]["data"]
    if do_plot:
        axs1[i].set_title("2D: " + par.keys()[0])