Example #1
0
  def module_parameters(self,object):
    param = object.parameters
    #unchanged parameters first:
    result = {}
    for item in ['DISTANCE', 'PHI', 'WAVELENGTH',
    'TWOTHETA', 'OSC_RANGE',
    'CCD_IMAGE_SATURATION', 'OSC_START', 'DETECTOR_SN', 'PIXEL_SIZE',
    ]:
      result[item]=copy.copy(param[item])

    #other parameters keep a record of parent settings; but child
    # settings are deduced on-the-fly once the data are read.
    for item in ['SIZE1','SIZE2','BEAM_CENTER_X','BEAM_CENTER_Y',
    ]:
      result["PARENT_"+item]=copy.copy(param[item])

    #the final parameters require a knowledge of the module boundaries.
    # In this implementation, these boundaries are determined on the fly
    # from the raw data, implying an up-front file read.
    # The only way to avoid this (not implemented here) is to encode
    # the vendor- & model-specific module boundaries.

    object.read()
    nullvalue = vendor_specific_null_value(object)
    ID = image_divider(data = object.linearintdata, nullvalue=nullvalue)
    print "module slow interval",ID.tile_slow_interval(self.moduleindex).first, ID.tile_slow_interval(self.moduleindex).last
    print "module fast interval",ID.tile_fast_interval(self.moduleindex).first, ID.tile_fast_interval(self.moduleindex).last
    result["SIZE1"] = ID.tile_slow_interval(self.moduleindex).size()
    result["SIZE2"] = ID.tile_fast_interval(self.moduleindex).size()
    print "size1",result["SIZE1"],"size2",result["SIZE2"]
    return result
Example #2
0
 def slice_callback_with_object_data(self):
     self.object.read()
     nullvalue = self.object.vendor_specific_null_value
     ID = image_divider(data=self.object.linearintdata, nullvalue=nullvalue)
     assert 0 <= self.moduleindex < ID.module_count()
     new_data_array = ID.tile_data(self.moduleindex)
     if self.object.linearintdata.__dict__.get("bin2by2") == True:
         new_data_array.bin2by2 = True
     del self.object  #once the data are copied, no need to keep the original
     return new_data_array
Example #3
0
 def slice_callback_with_object_data(self):
   self.object.read()
   nullvalue = self.object.vendor_specific_null_value
   ID = image_divider(data = self.object.linearintdata, nullvalue=nullvalue)
   assert 0 <= self.moduleindex < ID.module_count()
   new_data_array = ID.tile_data(self.moduleindex)
   if self.object.linearintdata.__dict__.get("bin2by2")==True:
     new_data_array.bin2by2=True
   del self.object #once the data are copied, no need to keep the original
   return new_data_array
Example #4
0
  def set_beam_center_convention(self,beam_center_convention):

    #previously part of the module_parameters function
    #from iotbx.detectors.context.config_detector import beam_center_convention_from_image_object
    #beam_center_convention = beam_center_convention_from_image_object(object)
    print "CC",beam_center_convention
    assert self.object.beam_center_reference_frame == "instrument"
    nullvalue = self.object.vendor_specific_null_value
    ID = image_divider(data = self.object.linearintdata, nullvalue=nullvalue)
    from iotbx.detectors.beam_center_convention import convert_beam_instrument_to_module
    self.parameters['BEAM_CENTER_X'],self.parameters['BEAM_CENTER_Y'] = convert_beam_instrument_to_module(
      self.object, ID, self.moduleindex, beam_center_convention)
    self.beam_center_reference_frame = "imageblock"
    self.beam_center_convention = beam_center_convention
    print "old beam center",self.object.parameters['BEAM_CENTER_X'],self.object.parameters['BEAM_CENTER_Y']
    print "for module",   self.moduleindex,"beam x,y is", self.parameters['BEAM_CENTER_X'],self.parameters['BEAM_CENTER_Y']
Example #5
0
    def module_parameters(self, object):
        param = object.parameters
        #unchanged parameters first:
        result = {}
        for item in [
                'DISTANCE',
                'PHI',
                'WAVELENGTH',
                'TWOTHETA',
                'OSC_RANGE',
                'CCD_IMAGE_SATURATION',
                'OSC_START',
                'DETECTOR_SN',
                'PIXEL_SIZE',
        ]:
            result[item] = copy.copy(param[item])

        #other parameters keep a record of parent settings; but child
        # settings are deduced on-the-fly once the data are read.
        for item in [
                'SIZE1',
                'SIZE2',
                'BEAM_CENTER_X',
                'BEAM_CENTER_Y',
        ]:
            result["PARENT_" + item] = copy.copy(param[item])

        #the final parameters require a knowledge of the module boundaries.
        # In this implementation, these boundaries are determined on the fly
        # from the raw data, implying an up-front file read.
        # The only way to avoid this (not implemented here) is to encode
        # the vendor- & model-specific module boundaries.

        object.read()
        nullvalue = vendor_specific_null_value(object)
        ID = image_divider(data=object.linearintdata, nullvalue=nullvalue)
        print("module slow interval",
              ID.tile_slow_interval(self.moduleindex).first,
              ID.tile_slow_interval(self.moduleindex).last)
        print("module fast interval",
              ID.tile_fast_interval(self.moduleindex).first,
              ID.tile_fast_interval(self.moduleindex).last)
        result["SIZE1"] = ID.tile_slow_interval(self.moduleindex).size()
        result["SIZE2"] = ID.tile_fast_interval(self.moduleindex).size()
        print("size1", result["SIZE1"], "size2", result["SIZE2"])
        return result
Example #6
0
    def set_beam_center_convention(self, beam_center_convention):

        #previously part of the module_parameters function
        #from iotbx.detectors.context.config_detector import beam_center_convention_from_image_object
        #beam_center_convention = beam_center_convention_from_image_object(object)
        print "CC", beam_center_convention
        assert self.object.beam_center_reference_frame == "instrument"
        nullvalue = self.object.vendor_specific_null_value
        ID = image_divider(data=self.object.linearintdata, nullvalue=nullvalue)
        from iotbx.detectors.beam_center_convention import convert_beam_instrument_to_module
        self.parameters['BEAM_CENTER_X'], self.parameters[
            'BEAM_CENTER_Y'] = convert_beam_instrument_to_module(
                self.object, ID, self.moduleindex, beam_center_convention)
        self.beam_center_reference_frame = "imageblock"
        self.beam_center_convention = beam_center_convention
        print "old beam center", self.object.parameters[
            'BEAM_CENTER_X'], self.object.parameters['BEAM_CENTER_Y']
        print "for module", self.moduleindex, "beam x,y is", self.parameters[
            'BEAM_CENTER_X'], self.parameters['BEAM_CENTER_Y']
Example #7
0
def do_main(filepath, force_binning, convention, host, port):
    absfile = os.path.abspath(filepath)
    Q = get_labelit_image_object(absfile, convention)
    if force_binning:
        Q.setBin(2)
        Q.show_header()
    get_spotfinder_url(Q, host, port)

    from iotbx.detectors import image_divider
    number_of_modules = image_divider(
        Q.linearintdata, Q.vendor_specific_null_value).module_count()

    for x in range(number_of_modules):
        file = "file://%s?slice=%d" % (absfile, x)
        Q = get_labelit_image_object(file, convention)
        if force_binning:
            Q.setBin(2)
            Q.show_header()
        get_spotfinder_url(Q, host, port)
Example #8
0
    def effective_tiling_as_flex_int_impl(self, **kwargs):
        assert self.reference_image is not None

        IT = flex.int()
        from iotbx.detectors import image_divider
        if self.reference_image.linearintdata is None:
            self.reference_image.readHeader()
            self.reference_image.read()
        null_value = self.reference_image.vendor_specific_null_value
        divider = image_divider(self.reference_image.linearintdata, null_value)

        for i in range(divider.module_count()):
            slow = divider.tile_slow_interval(i)
            fast = divider.tile_fast_interval(i)
            IT.append(slow.first)
            IT.append(fast.first)
            IT.append(slow.last + 1)
            IT.append(fast.last + 1)

        return IT
Example #9
0
def do_main(filepath, force_binning, convention, host, port):
  absfile = os.path.abspath(filepath)
  Q = get_labelit_image_object(absfile, convention)
  if force_binning:
    Q.setBin(2)
    Q.show_header()
  get_spotfinder_url(Q,host,port)

  from iotbx.detectors import image_divider
  number_of_modules = image_divider(
                        Q.linearintdata,
                        Q.vendor_specific_null_value
                      ).module_count()

  for x in xrange(number_of_modules):
    file = "file://%s?slice=%d"%(absfile,x)
    Q = get_labelit_image_object(file, convention)
    if force_binning:
      Q.setBin(2)
      Q.show_header()
    get_spotfinder_url(Q,host,port)
Example #10
0
  def effective_tiling_as_flex_int_impl(self, **kwargs):
    assert self.reference_image is not None

    IT = flex.int()
    from iotbx.detectors import image_divider
    if self.reference_image.linearintdata is None:
      self.reference_image.readHeader()
      self.reference_image.read()
    null_value = self.reference_image.vendor_specific_null_value
    divider = image_divider(
      self.reference_image.linearintdata,
      null_value
      )

    for i in range(divider.module_count()):
      slow = divider.tile_slow_interval(i)
      fast = divider.tile_fast_interval(i)
      IT.append(slow.first)
      IT.append(fast.first)
      IT.append(slow.last+1)
      IT.append(fast.last+1)

    return IT