def setup_class(cls): ex_dir_ = os.path.dirname(__file__) + '/../../../examples' # Load beam beam = ps.Beam(ex_dir_ + '/input/beam/amo86615.beam') # Load and initialize the detector np.random.seed(0) det = ps.Epix10kDetector( geom=ex_dir_ + '/input/lcls/xcsx35617/' 'Epix10ka2M::CalibV1/XcsEndstation.0:Epix10ka2M.0/geometry/0-end.data', run_num=0, beam=beam, cameraConfig='fixedMedium') cls.det = det cls.pos_recip = det.pixel_position_reciprocal # Ref Particle cls.particle_0 = ps.Particle() cls.particle_0.create_from_atoms([ # Angstrom ("O", cst.vecx), ("O", 2 * cst.vecy), ("O", 3 * cst.vecz), ]) cls.pattern_0 = pg.calculate_diffraction_pattern_gpu( cls.pos_recip, cls.particle_0, return_type="complex_field") # Second Particle cls.part_coord_1 = np.array((0.5, 0.2, 0.1)) # Angstrom cls.particle_1 = ps.Particle() cls.particle_1.create_from_atoms([ # Angstrom ("O", cst.vecx + cls.part_coord_1), ("O", 2 * cst.vecy + cls.part_coord_1), ("O", 3 * cst.vecz + cls.part_coord_1), ]) cls.part_coord_1 *= 1e-10 # Angstrom -> meter cls.pattern_1 = pg.calculate_diffraction_pattern_gpu( cls.pos_recip, cls.particle_1, return_type="complex_field") # Flat Field cls.flatField = np.ones( (cls.det.panel_num, cls.det.panel_pixel_num_x[0], cls.det.panel_pixel_num_y[0])) * 1.0 cls.I0width = 0.03 cls.I0min = 0 cls.I0max = 150000 cls.bauf = BuildAutoRangeFrames(cls.det, cls.I0width, cls.I0min, cls.I0max, cls.flatField) cls.bauf.makeFrame()
geom=input_dir+'/lcls/amo86615/PNCCD::CalibV1/Camp.0:pnCCD.1/geometry/0-end.data' pdbfile=input_dir+'/pdb/3iyf.pdb' # Load beam beam = ps.Beam(beamfile) increase_factor = 1e5 print('BEFORE: # of photons per pulse = {}'.format(beam.get_photons_per_pulse())) print('>>> Increasing the number of photons per pulse by a factor {}'.format(increase_factor)) beam.set_photons_per_pulse(increase_factor*beam.get_photons_per_pulse()) print('AFTER : # of photons per pulse = {}'.format(beam.get_photons_per_pulse())) #beam._n_phot = 1e14 # detector normal #beam._n_phot = 1e17 # detector saturates #beam._n_phot = 1e20 # detector gets fried # Load and initialize the detector det = ps.Epix10kDetector(geom=geom, run_num=0, beam=beam, cameraConfig='fixedMedium') increase_factor = 0.5 print('BEFORE: detector distance = {} m'.format(det.distance)) print('>>> Increasing the detector distance by a factor of {}'.format(increase_factor)) det.distance = increase_factor*det.distance print('AFTER : detector distance = {} m'.format(det.distance)) # Create particle object(s) particle = ps.Particle() particle.read_pdb(pdbfile, ff='WK') # Perform SPI experiment tic = time.time() experiment = ps.SPIExperiment(det, beam, particle) dp_photons = experiment.generate_image_stack() # generate diffraction field