data, hklrefin, pixel_size_mm, target_unit_cell, \ d_min, d_max = read_input(args = sys.argv[1:]) frame_files = read_pickles(data) for pickle_filename in frame_files: observations_pickle = read_frame(pickle_filename) pickle_filename_arr = pickle_filename.split('/') pickle_filename_only = pickle_filename_arr[len(pickle_filename_arr) - 1] mxh = mx_handler() flag_hklisoin_found, miller_array_iso = mxh.get_miller_array_from_reflection_file( hklrefin) observations = observations_pickle["observations"][0] #check if the uc is good flag_good_unit_cell = good_unit_cell( observations.unit_cell().parameters(), None, uc_tol, target_unit_cell=target_unit_cell) #update lambda_set lambda_set = lambda_template + observations_pickle["wavelength"] crystal_init_orientation = observations_pickle["current_orientation"][ 0] detector_distance_mm = observations_pickle['distance'] mm_predictions = pixel_size_mm * ( observations_pickle['mapped_predictions'][0]) xbeam = observations_pickle["xbeam"] ybeam = observations_pickle["ybeam"] alpha_angle = flex.double([math.atan(abs(pred[0]-xbeam)/abs(pred[1]-ybeam)) \ for pred in mm_predictions]) spot_pred_x_mm = flex.double( [pred[0] - xbeam for pred in mm_predictions])
ry, rz, re, rotx, roty = (0, 0, 0.008, 0, 0) flag_beam_divergence = False lambda_template = flex.double(range(-50,50,1))/1000 #0 .read input parameters and frames (pickle files) data, hklrefin, pixel_size_mm, target_unit_cell, \ d_min, d_max = read_input(args = sys.argv[1:]) frame_files = read_pickles(data) for pickle_filename in frame_files: observations_pickle = pickle.load(open(pickle_filename,"rb")) pickle_filename_arr = pickle_filename.split('/') pickle_filename_only = pickle_filename_arr[len(pickle_filename_arr)-1] mxh = mx_handler() flag_hklisoin_found, miller_array_iso = mxh.get_miller_array_from_reflection_file(hklrefin) observations = observations_pickle["observations"][0] #check if the uc is good flag_good_unit_cell = good_unit_cell(observations.unit_cell().parameters(), None, uc_tol, target_unit_cell=target_unit_cell) #update lambda_set lambda_set = lambda_template + observations_pickle["wavelength"] crystal_init_orientation = observations_pickle["current_orientation"][0] detector_distance_mm = observations_pickle['distance'] mm_predictions = pixel_size_mm*(observations_pickle['mapped_predictions'][0]) xbeam = observations_pickle["xbeam"] ybeam = observations_pickle["ybeam"] alpha_angle = flex.double([math.atan(abs(pred[0]-xbeam)/abs(pred[1]-ybeam)) \ for pred in mm_predictions]) spot_pred_x_mm = flex.double([pred[0]-xbeam for pred in mm_predictions]) spot_pred_y_mm = flex.double([pred[1]-ybeam for pred in mm_predictions]) #resoultion filter i_sel_res = observations.resolution_filter_selection(d_min=d_min, d_max=d_max) observations = observations.select(i_sel_res) alpha_angle = alpha_angle.select(i_sel_res)