Beispiel #1
0
    def run_analysis(self):
        """Run analysis of integrated images."""
        from iota.components.iota_analysis import Analyzer

        analysis = Analyzer(info=self.info, params=self.params)
        self.info = analysis.run_all()
        self.info.export_json()
Beispiel #2
0
    def update_info(self, info):
        # # Determine chunk of image objects to check for existing
        # if self.n_proc:
        #   chunk = self.n_proc
        # else:
        #   chunk = 25
        # if len(self.info.unread_files) < chunk:
        #   chunk = len(self.info.unread_files)
        #
        # # Create filelist of written image objects
        # filelist = []
        # for fp in self.info.unread_files[:chunk]:
        #   if os.path.isfile(fp):
        #     filelist.append(fp)
        #     self.info.unread_files.pop(fp)
        #
        # # Perform stat extraction
        # if filelist:
        #   from iota.components.iota_analysis import Analyzer
        #   analyzer = Analyzer(info=self.info)
        #   stats_OK = analyzer.get_results(filelist=filelist)
        #   if stats_OK:
        #     self.info = analyzer.info
        #     self.obs = analyzer.obs

        finished_objects = info.get_finished_objects_from_file()
        if finished_objects:
            analyzer = Analyzer(info=info, gui_mode=True)
            stats_OK = analyzer.run_get_results(
                finished_objects=finished_objects)
            if stats_OK:
                return analyzer.info
        return None
 def run_analysis(self):
   """ Run analysis of integrated images """
   from iota.components.iota_analysis import Analyzer
   analysis = Analyzer(init=self.init, all_objects=self.img_objects)
   analysis.print_results()
   analysis.unit_cell_analysis()
   analysis.print_summary()
   analysis.make_prime_input()
Beispiel #4
0
 def run_analysis(self):
   ''' Run analysis of integrated images '''
   cmd.Command.start("Analyzing results ")
   analysis = Analyzer(self.init, self.img_objects, iota_version)
   cmd.Command.end("Analyzing results -- DONE")
   analysis.print_results()
   analysis.unit_cell_analysis()
   analysis.print_summary()
   analysis.make_prime_input()
Beispiel #5
0
 def run_analysis(self):
     ''' Run analysis of integrated images '''
     cmd.Command.start("Analyzing results ")
     analysis = Analyzer(init=self.init,
                         all_objects=self.img_objects,
                         gui_mode=False)
     cmd.Command.end("Analyzing results -- DONE")
     analysis.print_results()
     analysis.unit_cell_analysis()
     analysis.print_summary()
     analysis.make_prime_input()
Beispiel #6
0
  def analyze_prior_results(self, analysis_source):
    """ Runs analysis of previous grid search / integration results, used in an
        analyze-only mode """

    from iota.components.iota_analysis import Analyzer

    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):

      cmd.Command.start("Analyzing results in {}".format(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 if i.endswith('.int')]
      cmd.Command.end("Analyzing results -- DONE")

      self.logfile = os.path.abspath(os.path.join(int_folder, 'iota.log'))
      self.viz_base = os.path.join('/'.join(int_folder.split('/')),
                                   'vizualization')

      analysis = Analyzer(self, img_objects, self.iver)
      analysis.print_results()
      analysis.unit_cell_analysis(write_files=False)
      analysis.print_summary(write_files=False)
    else:
      print 'No results found in {}'.format(int_folder)
Beispiel #7
0
  def analyze_prior_results(self, analysis_source):
    """ Runs analysis of previous grid search / integration results, used in an
        analyze-only mode """

    from iota.components.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 if i.endswith('.int')]
      self.logfile = os.path.abspath(os.path.join(int_folder, 'iota.log'))

      analysis = Analyzer(self, img_objects, self.iver)
      analysis.print_results()
      analysis.unit_cell_analysis(write_files=False)
      analysis.print_summary(write_files=False)
    else:
      print 'No results found in {}'.format(int_folder)
Beispiel #8
0
    def prepare_PRIME_input(self):
        """ Prepare the list of integrated pickles as well as pertinent
    parameters; create a PRIME input file """

        # Check if any pg/uc information is available; pg/uc info from UI
        # supercedes pg/uc from Cluster

        if self.best_pg is None:
            self.best_pg = self.info.best_pg

        if self.best_uc is None:
            self.best_uc = self.info.best_uc
        else:
            uc_params = str(self.best_uc).rsplit()
            self.best_uc = [float(i) for i in uc_params]

        # Only run PRIME if both pg and uc are provided
        if self.best_pg and self.best_uc:
            from iota.components.iota_analysis import Analyzer

            # Create a file with list of integrated pickles (overwrite old file)
            int_pickles_file = os.path.join(self.info.int_base,
                                            'int_pickles.lst')
            with open(int_pickles_file, 'w') as ff:
                ff.write('\n'.join(self.info.categories['integrated'][0]))

            # Create PRIME input file
            analyzer = Analyzer(info=self.info, params=self.params)
            analyzer.prime_data_path = int_pickles_file
            analyzer.best_pg = self.best_pg
            analyzer.best_uc = self.best_uc

            prime_phil = analyzer.make_prime_input(filename='live_prime.phil',
                                                   run_zero=True)
            self.pparams = prime_phil.extract()

            # Modify specific options based in IOTA settings
            # Queue options
            if (self.params.mp.method == 'lsf'
                    and self.params.mp.queue is not None):
                self.pparams.queue.mode = 'bsub'
                self.pparams.queue.qname = self.params.mp.queue

            # Number of processors (automatically, 1/2 of IOTA procs)
            self.pparams.n_processors = int(self.params.mp.n_processors / 2)

            # Generate command args
            cmd_args_list = [
                'n_postref_cycle=0',
                'queue.mode={}'.format(self.pparams.queue.mode),
                'queue.qname={}'.format(self.pparams.queue.qname),
                'n_processors={}'.format(self.pparams.n_processors)
            ]
            if self.pparams.queue.mode == 'bsub':
                cmd_args_list.append('timeout_seconds=120')
            cmd_args = ' '.join(cmd_args_list)

            return cmd_args
        else:
            return None