def get_values(invert_y): from dxtbx.model.beam import beam_factory beam = beam_factory.simple(wavelength=1) if invert_y: y_direction = "-y" else: y_direction = "+y" from dxtbx.model.detector import detector_factory detector = detector_factory.simple( sensor=detector_factory.sensor("PAD"), distance=100, beam_centre=[50, 50], fast_direction="+x", slow_direction=y_direction, pixel_size=[0.1, 0.1], image_size=[1000, 1000]) from dxtbx.model import ParallaxCorrectedPxMmStrategy from cctbx.eltbx import attenuation_coefficient wavelength = beam.get_wavelength() thickness = 0.5 table = attenuation_coefficient.get_table("Si") mu = table.mu_at_angstrom(wavelength) / 10.0 t0 = thickness for panel in detector: panel.set_px_mm_strategy(ParallaxCorrectedPxMmStrategy(mu, t0)) v1 = detector[0].pixel_to_millimeter((0, 0)) v2 = detector[0].pixel_to_millimeter((1000, 1000)) return v1, v2
def __init__(self,params): import cPickle as pickle from dxtbx.model.beam import beam_factory from dxtbx.model.detector import detector_factory from dxtbx.model.crystal import crystal_model from cctbx.crystal_orientation import crystal_orientation,basis_type from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList from scitbx import matrix self.experiments = ExperimentList() self.unique_file_names = [] self.params = params data = pickle.load(open(self.params.output.prefix+"_frame.pickle","rb")) frames_text = data.split("\n") for item in frames_text: tokens = item.split(' ') wavelength = float(tokens[order_dict["wavelength"]]) beam = beam_factory.simple(wavelength = wavelength) detector = detector_factory.simple( sensor = detector_factory.sensor("PAD"), # XXX shouldn't hard code for XFEL distance = float(tokens[order_dict["distance"]]), beam_centre = [float(tokens[order_dict["beam_x"]]), float(tokens[order_dict["beam_y"]])], fast_direction = "+x", slow_direction = "+y", pixel_size = [self.params.pixel_size,self.params.pixel_size], image_size = [1795,1795], # XXX obviously need to figure this out ) reciprocal_matrix = matrix.sqr([float(tokens[order_dict[k]]) for k in [ 'res_ori_1','res_ori_2','res_ori_3','res_ori_4','res_ori_5','res_ori_6','res_ori_7','res_ori_8','res_ori_9']]) ORI = crystal_orientation(reciprocal_matrix, basis_type.reciprocal) direct = matrix.sqr(ORI.direct_matrix()) crystal = crystal_model( real_space_a = matrix.row(direct[0:3]), real_space_b = matrix.row(direct[3:6]), real_space_c = matrix.row(direct[6:9]), space_group_symbol = "P63", # XXX obviously another gap in the database paradigm mosaicity = float(tokens[order_dict["half_mosaicity_deg"]]), ) crystal.domain_size = float(tokens[order_dict["domain_size_ang"]]) #if isoform is not None: # newB = matrix.sqr(isoform.fractionalization_matrix()).transpose() # crystal.set_B(newB) self.experiments.append(Experiment(beam=beam, detector=None, #dummy for now crystal=crystal)) self.unique_file_names.append(tokens[order_dict["unique_file_name"]]) self.show_summary()
def __init__(self, filename, experiment, HKL, i_sigi, measurements, params): from libtbx import adopt_init_args adopt_init_args(self, locals()) self.stash_type = None self.stash_res_filter = None from dxtbx.model.detector import detector_factory self.dummy_detector = detector_factory.simple( sensor=detector_factory.sensor("PAD"), distance=100, beam_centre=[1000, 1000], fast_direction="+x", slow_direction="+y", pixel_size=[0.2, 0.2], image_size=[2000, 2000], )
def prepare_dxtbx_models(self,setting_specific_ai,sg,isoform=None): from dxtbx.model.beam import beam_factory beam = beam_factory.simple(wavelength = self.inputai.wavelength) from dxtbx.model.detector import detector_factory detector = detector_factory.simple( sensor = detector_factory.sensor("PAD"), distance = setting_specific_ai.distance(), beam_centre = [setting_specific_ai.xbeam(), setting_specific_ai.ybeam()], fast_direction = "+x", slow_direction = "+y", pixel_size = [self.pixel_size,self.pixel_size], image_size = [self.inputpd['size1'],self.inputpd['size1']], ) direct = matrix.sqr(setting_specific_ai.getOrientation().direct_matrix()) from dxtbx.model.crystal import crystal_model crystal = crystal_model( real_space_a = matrix.row(direct[0:3]), real_space_b = matrix.row(direct[3:6]), real_space_c = matrix.row(direct[6:9]), space_group_symbol = sg, mosaicity = setting_specific_ai.getMosaicity() ) if isoform is not None: newB = matrix.sqr(isoform.fractionalization_matrix()).transpose() crystal.set_B(newB) from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList experiments = ExperimentList() experiments.append(Experiment(beam=beam, detector=detector, crystal=crystal)) print beam print detector print crystal return experiments
def __init__(self, params): import cPickle as pickle from dxtbx.model.beam import beam_factory from dxtbx.model.detector import detector_factory from dxtbx.model.crystal import crystal_model from cctbx.crystal_orientation import crystal_orientation, basis_type from dxtbx.model.experiment.experiment_list import Experiment, ExperimentList from scitbx import matrix self.experiments = ExperimentList() self.unique_file_names = [] self.params = params data = pickle.load( open(self.params.output.prefix + "_frame.pickle", "rb")) frames_text = data.split("\n") for item in frames_text: tokens = item.split(' ') wavelength = float(tokens[order_dict["wavelength"]]) beam = beam_factory.simple(wavelength=wavelength) detector = detector_factory.simple( sensor=detector_factory.sensor( "PAD"), # XXX shouldn't hard code for XFEL distance=float(tokens[order_dict["distance"]]), beam_centre=[ float(tokens[order_dict["beam_x"]]), float(tokens[order_dict["beam_y"]]) ], fast_direction="+x", slow_direction="+y", pixel_size=[self.params.pixel_size, self.params.pixel_size], image_size=[1795, 1795], # XXX obviously need to figure this out ) reciprocal_matrix = matrix.sqr([ float(tokens[order_dict[k]]) for k in [ 'res_ori_1', 'res_ori_2', 'res_ori_3', 'res_ori_4', 'res_ori_5', 'res_ori_6', 'res_ori_7', 'res_ori_8', 'res_ori_9' ] ]) ORI = crystal_orientation(reciprocal_matrix, basis_type.reciprocal) direct = matrix.sqr(ORI.direct_matrix()) crystal = crystal_model( real_space_a=matrix.row(direct[0:3]), real_space_b=matrix.row(direct[3:6]), real_space_c=matrix.row(direct[6:9]), space_group_symbol=self.params.target_space_group.type(). lookup_symbol(), mosaicity=float(tokens[order_dict["half_mosaicity_deg"]]), ) crystal.domain_size = float(tokens[order_dict["domain_size_ang"]]) #if isoform is not None: # newB = matrix.sqr(isoform.fractionalization_matrix()).transpose() # crystal.set_B(newB) self.experiments.append( Experiment( beam=beam, detector=None, #dummy for now crystal=crystal)) self.unique_file_names.append( tokens[order_dict["unique_file_name"]]) self.show_summary()