Beispiel #1
0
    def prep_output(self):
        ''' Assign output paths to image object (will be used by various modules
    to write out files in appropriate locations) '''

        # Get bases
        input_base = self.info.input_base if self.info else self.init.input_base
        obj_base = self.info.obj_base if self.info else self.init.obj_base
        fin_base = self.info.fin_base if self.info else self.init.fin_base
        log_base = self.info.log_base if self.info else self.init.log_base
        viz_base = self.info.viz_base if self.info else self.init.viz_base

        # Object path (may not need)
        self.img_object.obj_path = util.make_image_path(
            self.img_object.img_path, input_base, obj_base)
        fname = util.make_filename(self.img_object.img_path, new_ext='int')
        self.img_object.obj_file = os.path.join(self.img_object.obj_path,
                                                fname)

        # Final integration pickle path
        self.img_object.int_path = util.make_image_path(
            self.img_object.img_path, input_base, fin_base)
        fname = util.make_filename(self.img_object.img_path,
                                   prefix='int',
                                   new_ext='pickle')
        self.img_object.int_file = os.path.join(self.img_object.int_path,
                                                fname)

        # Processing log path for image
        self.img_object.log_path = util.make_image_path(
            self.img_object.img_path, input_base, log_base)
        fname = util.make_filename(self.img_object.img_path, new_ext='log')
        self.img_object.int_log = os.path.join(self.img_object.log_path, fname)

        # Visualization path (may need to deprecate)
        self.img_object.viz_path = util.make_image_path(
            self.img_object.img_path, input_base, viz_base)
        fname = util.make_filename(self.img_object.img_path,
                                   prefix='int',
                                   new_ext='png')
        self.viz_file = os.path.join(self.img_object.viz_path, fname)

        # Make paths if they don't exist already
        for path in [
                self.img_object.obj_path, self.img_object.int_path,
                self.img_object.log_path, self.img_object.viz_path
        ]:
            try:
                os.makedirs(path)
            except OSError:
                pass

        # Populate the 'final' dictionary
        self.img_object.final['final'] = self.img_object.int_file
        self.img_object.final['img'] = self.img_object.img_path
  def prep_output(self):
    ''' Assign output paths to image object (will be used by various modules
    to write out files in appropriate locations) '''

    # Object path (may not need)
    self.img_object.obj_path = util.make_image_path(self.img_object.img_path,
                                                    self.init.input_base,
                                                    self.init.obj_base)
    fname = util.make_filename(self.img_object.img_path, new_ext='int')
    self.img_object.obj_file = os.path.join(self.img_object.obj_path, fname)

    # Final integration pickle path
    self.img_object.int_path = util.make_image_path(self.img_object.img_path,
                                                    self.init.input_base,
                                                    self.init.fin_base)
    fname = util.make_filename(self.img_object.img_path, prefix='int',
                               new_ext='pickle')
    self.img_object.int_file = os.path.join(self.img_object.int_path, fname)

    # Processing log path for image
    self.img_object.log_path = util.make_image_path(self.img_object.img_path,
                                                    self.init.input_base,
                                                    self.init.log_base)
    fname = util.make_filename(self.img_object.img_path, new_ext='tmp')
    self.img_object.int_log = os.path.join(self.img_object.log_path, fname)

    # Visualization path (may need to deprecate)
    self.img_object.viz_path = util.make_image_path(self.img_object.img_path,
                                                    self.init.input_base,
                                                    self.init.viz_base)
    fname = util.make_filename(self.img_object.img_path, prefix='int',
                               new_ext='png')
    self.viz_file = os.path.join(self.img_object.viz_path, fname)

    # Populate the 'final' dictionary
    self.img_object.final['final'] = self.img_object.int_file
    self.img_object.final['img'] = self.img_object.img_path
 def rename_converted_image(self, filepath):
     # Generate converted image pickle filename
     rename_choice = str(
         self.params.cctbx_ha14.image_conversion.rename_pickle).lower()
     if rename_choice in ("keep_file_structure", "none"):
         img_dir = util.make_image_path(filepath, self.input_base,
                                        self.conv_base)
         img_filename = util.make_filename(filepath, new_ext='pickle')
     else:
         self.input_base = self.conv_base
         if rename_choice == "auto_filename":
             prefix = self.init.user_id
         elif rename_choice == "custom_filename":
             prefix = self.params.cctbx_ha14.image_conversion.rename_pickle_prefix
         else:
             prefix = 'iota'
         img_dir = self.conv_base
         number = int(os.path.basename(self.conv_base))
         img_filename = "{}_{}_{:05d}.pickle" \
                    "".format(prefix, number, self.img_object.img_index)
     return os.path.abspath(os.path.join(img_dir, img_filename))
Beispiel #4
0
  def prep_output(self):
    ''' Assign output paths to image object (will be used by various modules
    to write out files in appropriate locations) '''

    # Get bases
    input_base = self.info.input_base if self.info else self.init.input_base
    obj_base = self.info.obj_base if self.info else self.init.obj_base
    fin_base = self.info.fin_base if self.info else self.init.fin_base
    log_base = self.info.log_base if self.info else self.init.log_base
    dials_log_base = self.info.dials_log_base if self.info else None
    viz_base = self.info.viz_base if self.info else self.init.viz_base

    # Set prefix (image index in multi-image files, or None otherwise)
    if self.img_object.is_multi_image:
      image_index = self.img_object.img_index
    else:
      image_index = None

    # Object path (may not need)
    self.img_object.obj_path = util.make_image_path(self.img_object.img_path,
                                                    input_base, obj_base)
    fname = util.make_filename(prefix=image_index,
                               path=self.img_object.img_path,
                               new_ext='int')
    self.img_object.obj_file = os.path.join(self.img_object.obj_path, fname)

    # DIALS process filepaths
    # Indexed reflections
    ridx_path = util.make_filename(
      prefix=image_index,
      path=self.img_object.img_path,
      suffix='indexed',
      new_ext='refl'
    )
    self.img_object.ridx_path = os.path.join(self.img_object.obj_path,
                                             ridx_path)

    # Spotfinding (strong) reflections
    rspf_path = util.make_filename(
      prefix=image_index,
      path=self.img_object.img_path,
      suffix='strong',
      new_ext='refl'
    )
    self.img_object.rspf_path = os.path.join(self.img_object.obj_path,
                                             rspf_path)

    # Refined experiments
    eref_path = util.make_filename(
      prefix=image_index,
      path=self.img_object.img_path,
      suffix='refined',
      new_ext='expt'
    )
    self.img_object.eref_path = os.path.join(self.img_object.obj_path,
                                             eref_path)

    # Integrated experiments
    eint_path = util.make_filename(
      prefix=image_index,
      path=self.img_object.img_path,
      suffix='integrated',
      new_ext='expt'
    )
    self.img_object.eint_path = os.path.join(self.img_object.obj_path,
                                             eint_path)

    # Integrated reflections
    rint_path = util.make_filename(
      prefix=image_index,
      path=self.img_object.img_path,
      suffix='integrated',
      new_ext='refl'
    )
    self.img_object.rint_path = os.path.join(self.img_object.obj_path,
                                             rint_path)


    # Final integration pickle path
    self.img_object.int_path = util.make_image_path(self.img_object.img_path,
                                                    input_base, fin_base)
    fname = util.make_filename(path=self.img_object.img_path,
                               prefix='int',
                               suffix=image_index,
                               new_ext='pickle')
    self.img_object.int_file = os.path.join(self.img_object.int_path, fname)

    # Processing log path for image
    self.img_object.log_path = util.make_image_path(self.img_object.img_path,
                                                    input_base, log_base)
    fname = util.make_filename(prefix=image_index,
                               path=self.img_object.img_path,
                               new_ext='log')
    self.img_object.int_log = os.path.join(self.img_object.log_path, fname)

    # DIALS log path for image
    if dials_log_base:
      self.img_object.dials_log_path = util.make_image_path(
        self.img_object.img_path, input_base, dials_log_base)
      fname = util.make_filename(prefix=image_index,
                                 path=self.img_object.img_path,
                                 new_ext='log')
      self.img_object.dials_log = os.path.join(
        self.img_object.dials_log_path, fname)

    # Visualization path (may need to deprecate)
    self.img_object.viz_path = util.make_image_path(self.img_object.img_path,
                                                    input_base, viz_base)
    fname = util.make_filename(prefix='int',
                               suffix=image_index,
                               path=self.img_object.img_path,
                               new_ext='png')
    self.viz_file = os.path.join(self.img_object.viz_path, fname)

    # Make paths if they don't exist already
    for path in [self.img_object.obj_path, self.img_object.int_path,
                 self.img_object.log_path, self.img_object.viz_path,
                 self.img_object.dials_log_path]:
      try:
        os.makedirs(path)
      except OSError:
        pass

    # Populate the 'final' dictionary
    self.img_object.final['final'] = self.img_object.int_file
    self.img_object.final['img'] = self.img_object.img_path