コード例 #1
0
def main(distance=150):
    thickness = 0.32

    from parallax import (
        derive_absorption_coefficient_Si,
        compute_offset,
        compute_offset_dectris,
    )

    t0_cm = 0.032
    pixel_cm = 0.0172

    for energy_ev in range(8000, 16001, 4000):

        mu_cm = derive_absorption_coefficient_Si(energy_ev * 0.001)

        wavelength = 12.3985 / (energy_ev * 0.001)
        theta_o = run_xds_xycorr(distance, wavelength, thickness)

        fout = open("p%d.dat" % energy_ev, "w")
        for theta in sorted(theta_o):
            model = compute_offset(t0_cm, theta, mu_cm) / pixel_cm
            model_d = compute_offset_dectris(t0_cm, theta, mu_cm) / pixel_cm
            fout.write("%.3f %.3f %.3f %.3f\n" %
                       (theta, theta_o[theta], model, model_d))
        fout.close()
コード例 #2
0
def main_plot(distance, energy_ev):
    thickness = 0.32

    from parallax import (
        derive_absorption_coefficient_Si,
        compute_offset,
        compute_offset_dectris,
    )

    t0_cm = 0.032
    pixel_cm = 0.0172

    mu_cm = derive_absorption_coefficient_Si(energy_ev * 0.001)

    wavelength = 12.3985 / (energy_ev * 0.001)
    theta_o = run_xds_xycorr(distance, wavelength, thickness)

    import math

    displacement = []
    xds = []
    m_gw = []
    m_dec = []

    for theta in sorted(theta_o):
        model = compute_offset(t0_cm, theta, mu_cm) / pixel_cm
        model_d = compute_offset_dectris(t0_cm, theta, mu_cm) / pixel_cm
        displacement.append(distance * math.tan(theta))
        xds.append(theta_o[theta])
        m_gw.append(model)
        m_dec.append(model_d)

    import matplotlib

    matplotlib.use("Agg")
    from matplotlib import pyplot

    p1, p2, p3 = pyplot.plot(displacement, xds, displacement, m_gw,
                             displacement, m_dec)
    pyplot.xlabel("Displacement, pixels")
    pyplot.ylabel("Offset, pixels")
    pyplot.title("Parallax correction offsets at %deV" % energy_ev)
    pyplot.legend([p1, p2, p3],
                  ["Calculated by XDS", "GW model", "Dectris model"],
                  loc=2)
    pyplot.savefig("%d.png" % energy_ev)
コード例 #3
0
def main_plot(distance, energy_ev):
  thickness = 0.32

  from parallax import derive_absorption_coefficient_Si, compute_offset, \
     compute_offset_dectris

  t0_cm = 0.032
  pixel_cm = 0.0172

  mu_cm = derive_absorption_coefficient_Si(energy_ev * 0.001)

  wavelength = 12.3985  / (energy_ev * 0.001)
  theta_o = run_xds_xycorr(distance, wavelength, thickness)

  import math
  displacement = []
  xds = []
  m_gw = []
  m_dec = []

  for theta in sorted(theta_o):
    model = compute_offset(t0_cm, theta, mu_cm) / pixel_cm
    model_d = compute_offset_dectris(t0_cm, theta, mu_cm) / pixel_cm
    displacement.append(distance * math.tan(theta))
    xds.append(theta_o[theta])
    m_gw.append(model)
    m_dec.append(model_d)

  import matplotlib
  matplotlib.use('Agg')
  from matplotlib import pyplot
  p1, p2, p3 = pyplot.plot(displacement, xds, displacement, m_gw,
                           displacement, m_dec)
  pyplot.xlabel('Displacement, pixels')
  pyplot.ylabel('Offset, pixels')
  pyplot.title('Parallax correction offsets at %deV' % energy_ev)
  pyplot.legend([p1, p2, p3], ['Calculated by XDS', 'GW model', 'Dectris model'],
                loc=2)
  pyplot.savefig('%d.png' % energy_ev)
コード例 #4
0
def main(distance=150):
  thickness = 0.32

  from parallax import derive_absorption_coefficient_Si, compute_offset, \
     compute_offset_dectris

  t0_cm = 0.032
  pixel_cm = 0.0172

  for energy_ev in range(8000, 16001, 4000):

    mu_cm = derive_absorption_coefficient_Si(energy_ev * 0.001)

    wavelength = 12.3985  / (energy_ev * 0.001)
    theta_o = run_xds_xycorr(distance, wavelength, thickness)

    fout = open('p%d.dat' % energy_ev, 'w')
    for theta in sorted(theta_o):
      model = compute_offset(t0_cm, theta, mu_cm) / pixel_cm
      model_d = compute_offset_dectris(t0_cm, theta, mu_cm) / pixel_cm
      fout.write('%.3f %.3f %.3f %.3f\n' % (theta, theta_o[theta], model, model_d))
    fout.close()