def analyze_prior_results(self, analysis_source): """ Runs analysis of previous grid search / integration results, used in an analyze-only mode """ from prime.iota.iota_analysis import Analyzer from libtbx import easy_pickle as ep if os.path.isdir(analysis_source): int_folder = os.path.abspath(analysis_source) else: try: int_folder = os.path.abspath(os.path.join(os.curdir, 'integration/{}/image_objects'.format(analysis_source))) except ValueError: print 'Run #{} not found'.format(analysis_source) if os.path.isdir(int_folder): int_list = [os.path.join(int_folder, i) for i in os.listdir(int_folder)] img_objects = [ep.load(i) for i in int_list] analysis = Analyzer(img_objects, None, self.iver, self.now) analysis.print_results() analysis.unit_cell_analysis(self.params.analysis.cluster_threshold, int_folder, False) analysis.print_summary(None) analysis.show_heatmap() else: print 'No results found in {}'.format(int_folder)
ep.dump('iota.ini', init) misc.iota_exit(iota_version, True) else: if os.path.isfile('iota.ini'): init = ep.load('iota.ini') else: print 'This run not initialized. Use "--mpi init" option' misc.iota_exit(iota_version, True) if 'ana' in args.mpi: img_objects = [ep.load(os.path.join(init.obj_base, i)) for i in os.listdir(init.obj_base)] int_objects = [i for i in img_objects if i.fail == None] if len(int_objects) != 0: # Analysis of integration results analysis = Analyzer(int_objects, init.logfile, iota_version, init.now) analysis.print_results() analysis.unit_cell_analysis(init.params.analysis.cluster_threshold, init.int_base) analysis.print_summary(init.int_base) analysis.make_prime_input(init.int_base) else: print "No images integrated" else: if 'imp' in args.mpi: inp_list = init.input_list msg = "Importing {} images".format(len(inp_list)) elif 'gri' in args.mpi:
cmd.Command.end("Processing {} images -- DONE ".format(len(img_objects))) # DIALS TESTING SWITCH if init.params.advanced.integrate_with == 'dials': print '\n DIALS trial finished, exiting... \n' misc.iota_exit(iota_version) # Analysis of integration results final_objects = [i for i in img_objects if i.fail == None] if len(final_objects) == 0: print 'No images successfully integrated!' misc.iota_exit(iota_version) analysis = Analyzer(img_objects, init.logfile, iota_version, init.now) analysis.print_results() analysis.unit_cell_analysis(init.params.analysis.cluster_threshold, init.int_base) analysis.print_summary(init.int_base) analysis.make_prime_input(init.int_base) # Spotfinding heatmap if init.params.analysis.heatmap != None: hm_file = "{}/{}".format(init.viz_base, 'heatmap.pdf') if init.params.analysis.heatmap == 'show': analysis.show_heatmap() elif init.params.analysis.heatmap == 'file': analysis.show_heatmap(show=False, hm_file=hm_file) elif init.params.analysis.heatmap == 'both': analysis.show_heatmap(hm_file=hm_file)