Esempio n. 1
0
        def calculate_observations(detector, goniometer, oscillation):
            calculate_miller_rings(detector)
            import time

            t = time.clock()
            r = tools.determine_miller_ring_sectors(detector, goniometer, s0,
                                                    possible_hkl_flex,
                                                    crystal_A)

            sc = scorings
            print(
                map(
                    lambda x: tools.geometric_scoring(
                        [hkl_to_id[hkl] for hkl in x], sc)["total"],
                    r,
                ))
            sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[4]],
                                         scorings)["scorings"]
            sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[5]],
                                         sc)["scorings"]
            sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[6]],
                                         sc)["scorings"]
            print(
                map(
                    lambda x: tools.geometric_scoring(
                        [hkl_to_id[hkl] for hkl in x], sc)["total"],
                    r,
                ))
            print(time.clock() - t)

            print(map(len, r))
            sys.exit(0)
Esempio n. 2
0
    def calculate_observations(detector, goniometer, oscillation):
      calculate_miller_rings(detector)
      import time
      t = time.clock()
      r = tools.determine_miller_ring_sectors(detector, goniometer, s0, possible_hkl_flex, crystal_A)

      sc = scorings
      print map(lambda(x): tools.geometric_scoring([hkl_to_id[hkl] for hkl in x], sc)['total'], r)
      sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[4]], scorings)['scorings']
      sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[5]], sc)['scorings']
      sc = tools.geometric_scoring([hkl_to_id[hkl] for hkl in r[6]], sc)['scorings']
      print map(lambda(x): tools.geometric_scoring([hkl_to_id[hkl] for hkl in x], sc)['total'], r)
      print time.clock() -t


      print map(len, r)
      sys.exit(0)
Esempio n. 3
0
        def calculate_miller_rings(detector):
            import time

            t = time.clock()
            mrings = {}
            for scan_axis in ["phi", "omega"]:
                mrings[scan_axis] = {}
                for other_axis in range(0, 360, 10):
                    gonio = goniometer_factory.make_kappa_goniometer(
                        alpha=54.7356,  # fixed magic angle
                        kappa=0,  # fixed 0 kappa
                        phi=0 if scan_axis == "phi" else other_axis,
                        omega=0 if scan_axis == "omega" else other_axis,
                        direction="-y",
                        scan_axis=scan_axis,
                    )
                    ring = tools.determine_miller_ring_sectors(
                        detector, gonio, s0, possible_hkl_flex, crystal_A)
                    mrings[scan_axis][other_axis] = ring

            print(time.clock() - t)
            print(list(mrings.iterkeys()))
            print([list(x.iterkeys()) for x in mrings.itervalues()])

            t = time.clock()
            sc = scorings
            all_scorings = {
                "%s:%s:%s" % (scan, str(x1), str(x2)): tools.geometric_scoring(
                    [hkl_to_id[hkl] for hkl in mrings[scan][x1][x2]],
                    sc)["total"]
                for scan in mrings.iterkeys()
                for x1 in mrings[scan].iterkeys() for x2 in range(0, 36)
            }
            #     print list(all_scorings.itervalues())
            print(
                len(list(all_scorings.itervalues())),
                min(all_scorings.itervalues()),
                max(all_scorings.itervalues()),
                sum(all_scorings.itervalues()) /
                len(list(all_scorings.itervalues())),
            )
            print(time.clock() - t)

            sys.exit(0)
Esempio n. 4
0
    def calculate_miller_rings(detector):
      import time
      t = time.clock()
      mrings = {}
      for scan_axis in ['phi', 'omega']:
        mrings[scan_axis] = {}
        for other_axis in range(0, 360, 10):
          gonio = goniometer_factory.make_kappa_goniometer(alpha=54.7356, # fixed magic angle
                                                           kappa=0,       # fixed 0 kappa
                                                           phi=0 if scan_axis == "phi" else other_axis,
                                                           omega=0 if scan_axis == "omega" else other_axis,
                                                           direction="-y",
                                                           scan_axis=scan_axis)
          ring = tools.determine_miller_ring_sectors(detector, gonio, s0, possible_hkl_flex, crystal_A)
          mrings[scan_axis][other_axis] = ring

      print time.clock() - t
      print list(mrings.iterkeys())
      print [ list(x.iterkeys()) for x in mrings.itervalues() ]