当前位置: 首页>>代码示例>>Python>>正文


Python Streams.Chatter类代码示例

本文整理汇总了Python中xia2.Handlers.Streams.Chatter的典型用法代码示例。如果您正苦于以下问题:Python Chatter类的具体用法?Python Chatter怎么用?Python Chatter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Chatter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: scale

  def scale(self):
    '''Actually perform the scaling - this is delegated to the
    implementation.'''

    if self._scalr_integraters == { }:
      raise RuntimeError, \
            'no Integrater implementations assigned for scaling'

    xname = self._scalr_xcrystal.get_name()

    while not self.get_scaler_finish_done():
      while not self.get_scaler_done():
        while not self.get_scaler_prepare_done():

          Chatter.banner('Preparing %s' % xname)

          self._scalr_prepare_done = True
          self._scale_prepare()

        Chatter.banner('Scaling %s' % xname)

        self._scalr_done = True
        self._scalr_result = self._scale()

      self._scalr_finish_done = True
      self._scale_finish()

    return self._scalr_result
开发者ID:hainm,项目名称:xia2,代码行数:28,代码来源:Scaler.py

示例2: run

def run():
  try:
    check_environment()
    check()
  except exceptions.Exception, e:
    traceback.print_exc(file = open('xia2.error', 'w'))
    Chatter.write('Status: error "%s"' % str(e))
开发者ID:hainm,项目名称:xia2,代码行数:7,代码来源:index.py

示例3: get_new_scales_file

 def get_new_scales_file(self):
   '''Get the file to which the scales have been written.'''
   if self._new_scales_file:
     if not os.path.isfile(os.path.join(self.get_working_directory(), self._new_scales_file)):
       Chatter.write(
         "Aimless did not scale the data, see log file for more details:\n  %s" %self.get_log_file())
       raise RuntimeError, 'data not scaled'
   return os.path.join(self.get_working_directory(), self._new_scales_file)
开发者ID:hainm,项目名称:xia2,代码行数:8,代码来源:Aimless.py

示例4: run

def run():
  if os.path.exists('xia2-working.phil'):
    sys.argv.append('xia2-working.phil')
  try:
    check_environment()
  except exceptions.Exception, e:
    traceback.print_exc(file = open('xia2.error', 'w'))
    Chatter.write('Status: error "%s"' % str(e))
开发者ID:xia2,项目名称:xia2,代码行数:8,代码来源:rescale.py

示例5: _integrate

  def _integrate(self):
    '''Implement the integrater interface.'''

    # cite the program
    Citations.cite('mosflm')

    images_str = '%d to %d' % tuple(self._intgr_wedge)
    cell_str = '%.2f %.2f %.2f %.2f %.2f %.2f' % tuple(self._intgr_cell)

    if len(self._fp_directory) <= 50:
      dirname = self._fp_directory
    else:
      dirname = '...%s' % self._fp_directory[-46:]

    Journal.block(
        'integrating', self._intgr_sweep_name, 'mosflm',
        {'images':images_str,
         'cell':cell_str,
         'lattice':self.get_integrater_refiner().get_refiner_lattice(),
         'template':self._fp_template,
         'directory':dirname,
         'resolution':'%.2f' % self._intgr_reso_high})

    self._mosflm_rerun_integration = False

    wd = self.get_working_directory()

    try:

      if self.get_integrater_sweep_name():
        pname, xname, dname = self.get_integrater_project_info()

      nproc = PhilIndex.params.xia2.settings.multiprocessing.nproc
      if nproc > 1:
        Debug.write('Parallel integration: %d jobs' %nproc)
        self._mosflm_hklout = self._mosflm_parallel_integrate()
      else:
        self._mosflm_hklout = self._mosflm_integrate()

      # record integration output for e.g. BLEND.

      sweep = self.get_integrater_sweep_name()
      if sweep:
        FileHandler.record_more_data_file(
            '%s %s %s %s INTEGRATE' % (pname, xname, dname, sweep),
            self._mosflm_hklout)

    except IntegrationError, e:
      if 'negative mosaic spread' in str(e):
        if self._mosflm_postref_fix_mosaic:
          Chatter.write(
              'Negative mosaic spread - stopping integration')
          raise BadLatticeError, 'negative mosaic spread'

        Chatter.write(
            'Negative mosaic spread - rerunning integration')
        self.set_integrater_done(False)
        self._mosflm_postref_fix_mosaic = True
开发者ID:xia2,项目名称:xia2,代码行数:58,代码来源:MosflmIntegrater.py

示例6: run

def run():
  from libtbx.utils import Sorry
  if len(sys.argv) < 2 or '-help' in sys.argv or '--help' in sys.argv:
    help()
    sys.exit()

  try:
    check_environment()
  except exceptions.Exception, e:
    traceback.print_exc(file = open('xia2.error', 'w'))
    Chatter.write('Status: error "%s"' % str(e))
开发者ID:xia2,项目名称:xia2,代码行数:11,代码来源:xia2_main.py

示例7: _index_prepare

  def _index_prepare(self):
    Chatter.banner('Spotfinding %s' %self.get_indexer_sweep_name())
    super(XDSIndexerII, self)._index_prepare()

    from dials.array_family import flex
    from dials.util.ascii_art import spot_counts_per_image_plot
    reflection_pickle = spot_xds_to_reflection_pickle(
      self._indxr_payload['SPOT.XDS'],
      working_directory=self.get_working_directory())
    refl = flex.reflection_table.from_pickle(reflection_pickle)
    Chatter.write(spot_counts_per_image_plot(refl), strip=False)
开发者ID:xia2,项目名称:xia2,代码行数:11,代码来源:XDSIndexerII.py

示例8: eliminate

  def eliminate(self, indxr_print = True):
    '''Eliminate the highest currently allowed lattice.'''

    if len(self._sorted_list) <= 1:
      raise RuntimeError, 'cannot eliminate only solution'

    if indxr_print:
      Chatter.write('Eliminating indexing solution:')
      Chatter.write(self.repr()[0])

    self._sorted_list = self._sorted_list[1:]
开发者ID:xia2,项目名称:xia2,代码行数:11,代码来源:Indexer.py

示例9: which

def which(pgm, debug=False):
  # python equivalent to the 'which' command
  # http://stackoverflow.com/questions/9877462/is-there-a-python-equivalent-to-the-which-command
  # FIXME this will not work on Windows as you need to check that there is a
  # .bat or a .exe extension
  # FIXME also this is implemented in Driver/DriverHelper.py:executable_exists
  path = os.getenv('PATH')
  for p in path.split(os.path.pathsep):
    p = os.path.join(p, pgm)
    if debug:
      Chatter.write('Seeking %s' % p)
    if os.path.exists(p) and os.access(p, os.X_OK):
      return p
开发者ID:xia2,项目名称:xia2,代码行数:13,代码来源:Environment.py

示例10: run

    def run(self):
      from xia2.Handlers.Streams import Chatter, Debug
      Debug.write('Running dials.refine')

      self.clear_command_line()
      self.add_command_line(self._experiments_filename)
      self.add_command_line(self._indexed_filename)
      self.add_command_line('scan_varying=%s' % self._scan_varying)
      if self._close_to_spindle_cutoff is not None:
        self.add_command_line(
          'close_to_spindle_cutoff=%f' %self._close_to_spindle_cutoff)
      if self._outlier_algorithm:
        self.add_command_line('outlier.algorithm=%s' % self._outlier_algorithm)
      self._refined_experiments_filename = os.path.join(
        self.get_working_directory(),
        '%s_refined_experiments.json' % self.get_xpid())
      self.add_command_line(
        'output.experiments=%s' % self._refined_experiments_filename)
      self._refined_filename = os.path.join(
        self.get_working_directory(), '%s_refined.pickle' % self.get_xpid())
      self.add_command_line('output.reflections=%s' % self._refined_filename)
      if self._reflections_per_degree is not None:
        self.add_command_line(
          'reflections_per_degree=%i' %self._reflections_per_degree)
      if self._interval_width_degrees is not None:
        self.add_command_line(
          'unit_cell.smoother.interval_width_degrees=%i' % self._interval_width_degrees)
        self.add_command_line(
          'orientation.smoother.interval_width_degrees=%i' % self._interval_width_degrees)
      if self._detector_fix:
        self.add_command_line('detector.fix=%s' % self._detector_fix)
      if self._beam_fix:
        self.add_command_line('beam.fix=%s' % self._beam_fix)
      if self._phil_file is not None:
        self.add_command_line('%s' %self._phil_file)

      self.start()
      self.close_wait()

      if not os.path.isfile(self._refined_filename) or \
         not os.path.isfile(self._refined_experiments_filename):
        Chatter.write(
          "DIALS did not refine the data, see log file for more details:\n  %s" %self.get_log_file())
        raise RuntimeError, 'data not refined'
      for record in self.get_all_output():
        if 'Sorry: Too few reflections to' in record:
          raise RuntimeError, record.strip()

      self.check_for_errors()
      return
开发者ID:xia2,项目名称:xia2,代码行数:50,代码来源:Refine.py

示例11: integrate

  def integrate(self):
    '''Actually perform integration until we think we are done...'''

    while not self.get_integrater_finish_done():
      while not self.get_integrater_done():
        while not self.get_integrater_prepare_done():

          Debug.write('Preparing to do some integration...')
          self.set_integrater_prepare_done(True)

          # if this raises an exception, perhaps the autoindexing
          # solution has too high symmetry. if this the case, then
          # perform a self._intgr_indexer.eliminate() - this should
          # reset the indexing system

          try:
            self._integrate_prepare()

          except BadLatticeError, e:

            Journal.banner('eliminated this lattice', size = 80)

            Chatter.write('Rejecting bad lattice %s' % str(e))
            self._intgr_refiner.eliminate()
            self._integrater_reset()

        # FIXME x1698 - may be the case that _integrate() returns the
        # raw intensities, _integrate_finish() returns intensities
        # which may have been adjusted or corrected. See #1698 below.

        Debug.write('Doing some integration...')

        self.set_integrater_done(True)

        template = self.get_integrater_sweep().get_template()

        if self._intgr_sweep_name:
          if PhilIndex.params.xia2.settings.show_template:
            Chatter.banner('Integrating %s (%s)' % \
                           (self._intgr_sweep_name, template))
          else:
            Chatter.banner('Integrating %s' % \
                           (self._intgr_sweep_name))
        try:

          #1698
          self._intgr_hklout_raw = self._integrate()

        except BadLatticeError, e:
          Chatter.write('Rejecting bad lattice %s' % str(e))

          Journal.banner('eliminated this lattice', size = 80)

          self._intgr_refiner.eliminate()
          self._integrater_reset()
开发者ID:xia2,项目名称:xia2,代码行数:55,代码来源:Integrater.py

示例12: run_one_sweep

    def run_one_sweep(args):

      from xia2.Handlers.Streams import Debug

      assert len(args) == 3
      s, failover, job_type = args

      if job_type:
        DriverFactory.set_driver_type(job_type)

      Chatter.cache()
      Debug.cache()

      try:
        s.get_integrater_intensities()
      except Exception, e:
        if failover:
          Chatter.write('Processing sweep %s failed: %s' % \
                        (s.get_name(), str(e)))
          s = None
        else:
          raise
开发者ID:xia2,项目名称:xia2,代码行数:22,代码来源:XWavelength.py

示例13: make_logfile_html

def make_logfile_html(logfile):
    tables = extract_loggraph_tables(logfile)
    if not tables:
      return

    rst = []

    for table in tables:
      try:
        #for graph_name, html in table_to_google_charts(table).iteritems():
        for graph_name, html in table_to_c3js_charts(table).iteritems():
          #rst.append('.. __%s:\n' %graph_name)
          rst.append('.. raw:: html')
          rst.append('\n    '.join(html.split('\n')))
      except StandardError, e:
        Chatter.write('=' * 80)
        Chatter.write('Error (%s) while processing table' % str(e))
        Chatter.write("  '%s'" % table.title)
        Chatter.write('in %s' % logfile)
        Chatter.write('=' * 80)
        Debug.write('Exception raised while processing log file %s, table %s' % (logfile, table.title))
        Debug.write(traceback.format_exc())
开发者ID:xia2,项目名称:xia2,代码行数:22,代码来源:html.py

示例14: index

  def index(self):

    if not self.get_indexer_finish_done():
      f = inspect.currentframe().f_back.f_back
      m = f.f_code.co_filename
      l = f.f_lineno

      Debug.write('Index in %s called from %s %d' %
                  (self.__class__.__name__, m, l))

    while not self.get_indexer_finish_done():
      while not self.get_indexer_done():
        while not self.get_indexer_prepare_done():

          # --------------
          # call prepare()
          # --------------

          self.set_indexer_prepare_done(True)
          self._index_prepare()

        # --------------------------------------------
        # then do the proper indexing - using the best
        # solution already stored if available (c/f
        # eliminate above)
        # --------------------------------------------

        self.set_indexer_done(True)

        if self.get_indexer_sweeps():
          xsweeps = [ s.get_name() for s in self.get_indexer_sweeps() ]
          if len(xsweeps) > 1:
            # find "SWEEPn, SWEEP(n+1), (..), SWEEPm" and aggregate to "SWEEPS n-m"
            xsweeps = map(lambda x: (int(x[5:]), int(x[5:])) if x.startswith('SWEEP') else x, xsweeps)
            xsweeps[0] = [xsweeps[0]]
            def compress(seen, nxt):
              if isinstance(seen[-1], tuple) and isinstance(nxt, tuple) and (seen[-1][1] + 1 == nxt[0]):
                seen[-1] = (seen[-1][0], nxt[1])
              else:
                seen.append(nxt)
              return seen
            xsweeps = reduce(compress, xsweeps)
            xsweeps = map(lambda x: ('SWEEP%d' % x[0] if x[0] == x[1] else
                                     'SWEEPS %d to %d' % (x[0], x[1])) if isinstance(x, tuple)
                                     else x, xsweeps)
          if len(xsweeps) > 1:
            sweep_names = ', '.join(xsweeps[:-1])
            sweep_names += ' & ' + xsweeps[-1]
          else:
            sweep_names = xsweeps[0]

          if PhilIndex.params.xia2.settings.show_template:
            template = self.get_indexer_sweep().get_template()
            Chatter.banner(
              'Autoindexing %s (%s)' %(sweep_names, template))
          else:
            Chatter.banner('Autoindexing %s' %sweep_names)


        if not self._indxr_helper:

          result = self._index()

          if not self._indxr_done:
            Debug.write(
              'Looks like indexing failed - try again!')
            continue

          solutions = { }
          for k in self._indxr_other_lattice_cell.keys():
            solutions[k] = self._indxr_other_lattice_cell[k][
              'cell']

          # create a helper for the indexer to manage solutions
          self._indxr_helper = _IndexerHelper(solutions)

          solution = self._indxr_helper.get()

          # compare these against the final solution, if different
          # reject solution and return - correct solution will
          # be used next cycle

          if self._indxr_lattice != solution[0] and \
             not self._indxr_input_cell and \
             not PhilIndex.params.xia2.settings.integrate_p1:
            Chatter.write('Rerunning indexing lattice %s to %s' %
                          (self._indxr_lattice, solution[0]))
            Debug.write(
              'Rerunning indexing with target lattice %s' % \
              solution[0])
            self.set_indexer_done(False)

        else:
          # rerun autoindexing with the best known current solution

          solution = self._indxr_helper.get()
          self._indxr_input_lattice = solution[0]
          self._indxr_input_cell = solution[1]
          result = self._index()

#.........这里部分代码省略.........
开发者ID:xia2,项目名称:xia2,代码行数:101,代码来源:Indexer.py

示例15: run

from xia2.Applications.xia2 import check, check_cctbx_version, check_environment
from xia2.Applications.xia2 import get_command_line, write_citations, help


def run():
  if os.path.exists('xia2-working.phil'):
    sys.argv.append('xia2-working.phil')
  try:
    check_environment()
    check()
  except exceptions.Exception, e:
    traceback.print_exc(file = open('xia2.error', 'w'))
    Chatter.write('Status: error "%s"' % str(e))

  # print the version
  Chatter.write(Version)
  Citations.cite('xia2')

  start_time = time.time()

  assert os.path.exists('xia2.json')
  from xia2.Schema.XProject import XProject
  xinfo = XProject.from_json(filename='xia2.json')

  crystals = xinfo.get_crystals()
  for crystal_id, crystal in crystals.iteritems():
    #cwd = os.path.abspath(os.curdir)
    from libtbx import Auto
    scale_dir = PhilIndex.params.xia2.settings.scale.directory
    if scale_dir is Auto:
      scale_dir = 'scale'
开发者ID:hainm,项目名称:xia2,代码行数:31,代码来源:rescale.py


注:本文中的xia2.Handlers.Streams.Chatter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。