Example #1
0
        assert os.path.isfile(params.new_metrology)
        ext = os.path.splitext(params.new_metrology)[1].lower()
        if ext in ['.def', '.cbf']:
            metro_style = "cbf"

            from xfel.cftbx.detector.cspad_cbf_tbx import cbf_file_to_basis_dict
            metro = cbf_file_to_basis_dict(params.new_metrology)

        else:
            metro_style = "flatfile"

            from xfel.cftbx.detector.cspad_cbf_tbx import read_optical_metrology_from_flat_file, asic_dimension, asic_gap

            metro = read_optical_metrology_from_flat_file(params.new_metrology,
                                                          params.detector,
                                                          img['PIXEL_SIZE'],
                                                          asic_dimension,
                                                          asic_gap,
                                                          plot=params.plot)

    for filename in params.pickle_file:
        # Read the pickle file and pull the tiles out of it
        img = easy_pickle.load(filename)

        tiles = {}
        asics = {}
        data = img['DATA']

        if os.path.isdir(params.old_metrology):
            num_sections = len(sections)

            for p in range(num_sections):
Example #2
0
      metro = metro.fetch(sources=[iotbx.phil.parse(arg)])
  else:
    assert os.path.isfile(params.new_metrology)
    ext = os.path.splitext(params.new_metrology)[1].lower()
    if ext in ['.def','.cbf']:
      metro_style = "cbf"

      from xfel.cftbx.detector.cspad_cbf_tbx import cbf_file_to_basis_dict
      metro = cbf_file_to_basis_dict(params.new_metrology)

    else:
      metro_style = "flatfile"

      from xfel.cftbx.detector.cspad_cbf_tbx import read_optical_metrology_from_flat_file, asic_dimension, asic_gap

      metro = read_optical_metrology_from_flat_file(params.new_metrology, params.detector, img['PIXEL_SIZE'],
                                                    asic_dimension, asic_gap, plot=params.plot)

  for filename in params.pickle_file:
    # Read the pickle file and pull the tiles out of it
    img = easy_pickle.load(filename)

    tiles = {}
    asics = {}
    data = img['DATA']

    if os.path.isdir(params.old_metrology):
      num_sections = len(sections)

      for p in xrange(num_sections):
        for s in xrange(len(sections[p])):
Example #3
0
    if (params.metrology_file is None):
        master_phil.show()
        raise Usage(
            "metrology_file must be defined (either metrology_file=XXX, or the file path alone)."
        )
    assert params.detector is not None
    assert params.plot is not None
    assert params.out is not None

    print(params.metrology_file, params.detector)

    from xfel.cftbx.detector.cspad_cbf_tbx import pixel_size

    metro = read_optical_metrology_from_flat_file(
        params.metrology_file,
        params.detector,
        pixel_size,
        asic_dimension,
        asic_gap,
        plot=params.plot,
        old_style_diff_path=params.old_style_diff_path)

    write_cspad_cbf(None,
                    metro,
                    'cbf',
                    None,
                    params.out,
                    None,
                    0,
                    header_only=True)
if (__name__ == "__main__") :
  user_phil = []
  for arg in sys.argv[1:]:
    if (os.path.isfile(arg)) :
      user_phil.append(libtbx.phil.parse("""metrology_file=\"%s\"""" % arg))
    else :
      try :
        user_phil.append(libtbx.phil.parse(arg))
      except RuntimeError, e :
        raise Sorry("Unrecognized argument '%s' (error: %s)" % (arg, str(e)))

  params = master_phil.fetch(sources=user_phil).extract()
  if (params.metrology_file is None) :
    master_phil.show()
    raise Usage("metrology_file must be defined (either metrology_file=XXX, or the file path alone).")
  assert params.detector is not None
  assert params.plot is not None
  assert params.out is not None

  print params.metrology_file, params.detector

  from xfel.cftbx.detector.cspad_cbf_tbx import pixel_size

  metro = read_optical_metrology_from_flat_file(params.metrology_file, params.detector,
                                                pixel_size,asic_dimension,asic_gap,
                                                plot=params.plot,old_style_diff_path=params.old_style_diff_path)

  write_cspad_cbf(None, metro, 'cbf', None, params.out, None, 0, header_only=True)