Exemplo n.º 1
0
    a = 4.065e-10
    E = 10000.
    d = a / np.sqrt(3)  # (111)
    hc = 4.136e-15 * 3.000e8
    theta = np.arcsin(hc / (2 * d * E)) / np.pi * 180
    psize = 55e-6
    distance = .25
    # detector plane: dq = |k| * dtheta(pixel-pixel)
    Q12 = psize * 2 * np.pi / distance / (hc / E) * data.shape[-1]
    Q3 = Q12 / 128 * 25  # about the same Q range as the first in-plane minimum
    dq3 = Q3 / Nj
    Dmax = 60e-9
    print('%e %e' % (Q3, Q12))

    # do the assembly, plotting on each iteration
    data, rolls = pre_align_rolls(data, roll_center=None)
    envelope1 = generate_envelope(Nj,
                                  data.shape[-1],
                                  Q=(Q3, Q12, Q12),
                                  Dmax=(Dmax, 1, 1),
                                  theta=theta)
    envelope2 = generate_envelope(Nj, data.shape[-1], support=(1, .25, .25))
    W = generate_initial(data, Nj)
    p = ProgressPlot()
    errors = []
    for i in range(100):
        print(i)
        W, Pjlk, timing = M(W,
                            data,
                            Nl=Nl,
                            ml=ml,
Exemplo n.º 2
0
        print('now doing subset %u: %s'%(subset, inds,))
        data = data_[inds]

    # physics
    theta = 15
    psize = 55e-6
    distance = .320
    hc = 4.136e-15 * 3.000e8
    E = 10000.
    Q12 = psize * 2 * np.pi / distance / (hc / E) * data.shape[-1]
    Q3 = Q12 / 150 * 30 # first minimum is around 30 pixels across, so Nj=30 should give a 1:1 aspect ratio with the first minimum on the q3 edges
    dq3 = Q3 / Nj
    Dmax = 60e-9

    # do the assembly, plotting on each iteration
    data, rolls = pre_align_rolls(data, roll_center=CENTER)
    envelope = generate_envelope(Nj, data.shape[-1], Q=(Q3, Q12, Q12), Dmax=(Dmax, 1, 1), theta=theta)
    W = generate_initial(data, Nj)
    p = ProgressPlot()
    errors = []
    for i in range(60):
        print(i)
        W, Pjlk, timing = M(W, data, Nl=Nl, ml=ml, beta=fudge,
                            nproc=24,
                            roll_center=CENTER)
        [print(k, '%.3f'%v) for k, v in timing.items()]
        W, error = C(W, envelope)
        errors.append(error)
        p.update(np.log10(W), Pjlk, errors, vmax=1)

        # expand the resolution now and then
Exemplo n.º 3
0
a = 4.065e-10
E = 10000.
d = a / np.sqrt(3)  # (111)
hc = 4.136e-15 * 3.000e8
theta = np.arcsin(hc / (2 * d * E)) / np.pi * 180
psize = 55e-6
distance = .25
# detector plane: dq = |k| * dtheta(pixel-pixel)
Q12 = psize * 2 * np.pi / distance / (hc / E) * data.shape[-1]
Q3 = Q12 / 128 * 25  # first minimum is 25 pixels wide
dq3 = Q3 / Nj
Dmax = 60e-9
print('%e %e' % (Q3, Q12))

# do the assembly, plotting on each iteration
data, rolls = pre_align_rolls(data, roll_center=[200, 64])
envelope1 = generate_envelope(Nj,
                              data.shape[-1],
                              Q=(Q3, Q12, Q12),
                              Dmax=(Dmax, 1, 1),
                              theta=theta)
envelope2 = generate_envelope(Nj, data.shape[-1], support=(1, .25, .25))
W = generate_initial(data, Nj)
p = ProgressPlot()
errors = []
for i in range(50):
    print(i)
    W, Pjlk, timing = M(W,
                        data,
                        Nl=Nl,
                        ml=ml,