Example #1
0
def pixmap(Isize1,Isize2,this_frame_phi_deg,pixel_size,size1,size2,spot_convention,procid):
  # returms a list of data points in a chunk of each image with info to calculate the h,k,l
  from spotfinder.applications.xfel import cxi_phil
  from iotbx.detectors.context.spot_xy_convention import spot_xy_convention
  SXYC = spot_xy_convention(pixel_size*size1,pixel_size*size2)
  from spotfinder.math_support import pixels_to_mmPos
  # for parallel running; calculate the range that will be worked on by this process
  chunksize = int(Isize2/nproc)
  if (Isize2 % nproc !=  0):
    chunksize += 1
  y1 = procid*chunksize
  y2 = y1 + chunksize
  if (y2>Isize2):
    y2=Isize2
  # now walk through the pixels and create the list of data points
  raw_spot_input = flex.vec3_double()
  for y in xrange(y1,y2): # slow dimension
    for x in xrange(Isize1): # fast dimension
      mmPos = pixels_to_mmPos(x,y,pixel_size)
      rawspot = (mmPos[0],mmPos[1],this_frame_phi_deg)
      transpot = SXYC.select(rawspot,spot_convention)
      raw_spot_input.append(transpot)
  return raw_spot_input
Example #2
0
def pixmap(Isize1,Isize2,this_frame_phi_deg,pixel_size,size1,size2,spot_convention,procid):
  # returms a list of data points in a chunk of each image with info to calculate the h,k,l
  from spotfinder.applications.xfel import cxi_phil
  from iotbx.detectors.context.spot_xy_convention import spot_xy_convention
  SXYC = spot_xy_convention(pixel_size*size1,pixel_size*size2)
  from spotfinder.math_support import pixels_to_mmPos
  # for parallel running; calculate the range that will be worked on by this process
  chunksize = int(Isize1/nproc)
  if (Isize1 % nproc !=  0):
    chunksize += 1
  x1 = procid*chunksize
  x2 = x1 + chunksize
  if (x2>Isize1):
    x2=Isize1
  # now walk through the pixels and create the list of data points
  raw_spot_input = flex.vec3_double()
  for x in xrange(x1,x2): # slow dimension
    for y in xrange(Isize2): # fast dimension
      mmPos = pixels_to_mmPos(x,y,pixel_size)
      rawspot = (mmPos[0],mmPos[1],this_frame_phi_deg)
      transpot = SXYC.select(rawspot,spot_convention)
      raw_spot_input.append(transpot)
  return raw_spot_input
Example #3
0
        # parse the input file line into a diffuse image file name and scale factor
        words = line.split()

        imgname = os.path.join(procpath + "/" + words[1])
        scale = float(words[2])

        print "processing file %s with scale factor %f" % (imgname, scale)
        I = QuickImage(imgname)
        I.read()
        DATA = I.linearintdata

        print "transform pixel numbers to mm positions and rotational degrees"
        from iotbx.detectors.context.spot_xy_convention import spot_xy_convention
        SF = results.spotfinder_results
        SXYC = spot_xy_convention(SF.pixel_size * SF.size1,
                                  SF.pixel_size * SF.size2)
        from spotfinder.math_support import pixels_to_mmPos
        this_frame_phi_deg = I.deltaphi / 2.0 + I.osc_start

        print "Creating pixel map in parallel..."
        t0 = clock()
        raw_spot_input_all = flex.vec3_double()
        Isize1 = I.size1
        Isize2 = I.size2
        pixel_size = SF.pixel_size
        # prepare the list of arguments to run pixmap in parallel
        pixmap_tasks = [
            (Isize1, Isize2, this_frame_phi_deg, SF.pixel_size, SF.size1,
             SF.size2, results.horizons_phil.spot_convention, procid)
            for procid in range(nproc)
        ]
Example #4
0
    # parse the input file line into a diffuse image file name and scale factor
    words = line.split()

    imgname = words[1]
    scale = float(words[2])

    print "processing file %s with scale factor %f"%(imgname,scale)
    I = QuickImage(imgname)
    I.read()
    DATA = I.linearintdata
  
    print "transform pixel numbers to mm positions and rotational degrees"
    from iotbx.detectors.context.spot_xy_convention import spot_xy_convention
    SF = results.spotfinder_results
    SXYC = spot_xy_convention(SF.pixel_size*SF.size1,SF.pixel_size*SF.size2)
    from spotfinder.math_support import pixels_to_mmPos
    this_frame_phi_deg = I.deltaphi/2.0+I.osc_start

    print "Creating pixel map in parallel..."
    t0 = clock()
    raw_spot_input_all = flex.vec3_double()
    Isize1 = I.size1
    Isize2 = I.size2
    pixel_size = SF.pixel_size
    # prepare the list of arguments to run pixmap in parallel
    pixmap_tasks = [(Isize1,Isize2,this_frame_phi_deg,SF.pixel_size,SF.size1,SF.size2,results.horizons_phil.spot_convention,procid) for procid in range(nproc)]
    # run pixmap in parallel and collect results
    raw_spot_input_it = pool.map(pixmapstar,pixmap_tasks)
    # gather pixmap results into a single collection of data points
    for raw_spot_input_this in raw_spot_input_it: