TetragonalManager = None Crystal = None sqr = None Fhkl_guess = wavelens = None if has_mpi: glob = comm.bcast(glob) diff_rot = comm.bcast(diff_rot) compare_with_ground_truth = comm.bcast(compare_with_ground_truth, root=0) args = comm.bcast(args, root=0) RefineAllMultiPanel = comm.bcast(RefineAllMultiPanel, root=0) Fhkl_guess = comm.bcast(Fhkl_guess, root=0) #if args.startwithtruth and args.sad: if args.sad: from cxid9114.sf.struct_fact_special import load_4bs7_sf Fhkl_guess = load_4bs7_sf() wavelens = comm.bcast(wavelens, root=0) Crystal = comm.bcast(Crystal, root=0) sqr = comm.bcast(sqr, root=0) CSPAD = comm.bcast(CSPAD, root=0) nanoBragg_beam = comm.bcast(nanoBragg_beam, root=0) nanoBragg_crystal = comm.bcast(nanoBragg_crystal, root=0) SimData = comm.bcast(SimData, root=0) #beam_from_dict = comm.bcast(beam_from_dict, root=0) #det_from_dict = comm.bcast(det_from_dict, root=0) h5py_File = comm.bcast(h5py_File, root=0) Integrator = comm.bcast(Integrator, root=0) array = comm.bcast(array, root=0) sqrt = comm.bcast(sqrt, root=0) percentile = comm.bcast(percentile, root=0) np_zeros = comm.bcast(np_zeros, root=0)
# get the original indexing directory name indexdirname = args.indexdirname if args.indexdirname is None: indexdirname = os.path.dirname(args.filteredexpt) if not os.path.exists(args.o) and rank == 0: os.makedirs(args.o) MPI.COMM_WORLD.Barrier() # load the bs7 default array bs7_mil_ar = struct_fact_special.sfgen( WAVELEN_HIGH, "../sim/4bs7.pdb", yb_scatter_name="../sf/scanned_fp_fdp.tsv") datasf_mil_ar = struct_fact_special.load_4bs7_sf() all_paths = [] all_Amats = [] odir = args.o if args.bgname is not None: background = h5py.File(args.bgname, "r")['bigsim_d9114'][()] writer = h5py.File(os.path.join(odir, "process_rank%d.h5" % rank), "w") n_processed = 0 for i_shot in range(Nexper): if i_shot % size != rank: continue
# bs7_100kspec.h5: 79955100000.0 from cxid9114.parameters import ENERGY_CONV, ENERGY_LOW, WAVELEN_LOW, ENERGY_HIGH, WAVELEN_HIGH if args.sad: print("Rank %d: Loading 4bs7 structure factors!" % rank) if args.p9: data_sf = struct_fact_special.load_p9() elif args.bs7 or args.bs7real: data_sf = struct_fact_special.sfgen( WAVELEN_HIGH, "./4bs7.pdb", yb_scatter_name="../sf/scanned_fp_fdp.tsv") data_sf = data_sf.as_amplitude_array() else: data_sf = struct_fact_special.load_4bs7_sf() data_sf = [data_sf] if args.sad: if args.p9: data_energies = np.array([12660.5]) BEAM.set_wavelength(0.9793) elif args.bs7: data_energies = np.array([ENERGY_HIGH]) BEAM.set_wavelength(WAVELEN_HIGH) else: data_energies = np.array([ENERGY_LOW]) BEAM.set_wavelength(WAVELEN_LOW) if args.mad: data_sf_dict, _ = struct_fact_special.load_sfall(