示例#1
0
    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
        if i and (Nj<Nj_max) and (i % increase_every) == 0:
            W = np.pad(W, ((2,2),(0,0),(0,0)))
            Nj = W.shape[0]
            Q3 = dq3 * Nj
            envelope = generate_envelope(Nj, data.shape[-1], Q=(Q3, Q12, Q12), Dmax=(Dmax, 1, 1), theta=theta)
            print('increased Nj to %u and Q3 to %.2e'%(Nj, Q3))
        if i and (fudge < fudge_max) and (i % increase_every) == 0:
            fudge *= 2**(1/2)
示例#2
0
    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)
    envelope2 = generate_envelope(Nj, data.shape[-1], support=(1, .25, .25))
    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,
                            force_continuity=3,
                            nproc=24,
                            roll_center=CENTER)
        [print(k, '%.3f' % v) for k, v in timing.items()]
        if i < 30:
            W, error = C(W, envelope * envelope2)
        else:
            W, error = C(W, envelope)  #*envelope2)
        errors.append(error)
        p.update(np.log10(W), Pjlk, errors, vmax=1)

        # expand the resolution now and then
        if i and (Nj < Nj_max) and (i % increase_Nj_every) == 0:
            W = np.pad(W, ((2, 2), (0, 0), (0, 0)))
            Nj = W.shape[0]
示例#3
0
    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,
                            beta=fudge,
                            force_continuity=(6 if i < 50 else 10),
                            nproc=24,
                            find_direction=(i > 10))
        [print(k, '%.3f' % v) for k, v in timing.items()]
        W, error = C(W, envelope1)  #*envelope2)
        errors.append(error)
        p.update(np.log10(W), Pjlk, errors, vmax=1)

        # expand the resolution now and then
        if i and (Nj < Nj_max) and (i % increase_Nj_every) == 0:
            W = np.pad(W, ((2, 2), (0, 0), (0, 0)))
            Nj = W.shape[0]
            Q3 = dq3 * Nj
            envelope1 = generate_envelope(Nj,
                                          data.shape[-1],
示例#4
0
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,
                        beta=fudge,
                        force_continuity=True,
                        nproc=24,
                        roll_center=[200, 64])
    [print(k, '%.3f' % v) for k, v in timing.items()]
    W, error = C(W, envelope1 * envelope2)
    errors.append(error)
    p.update(W, Pjlk, errors)

    # expand the resolution now and then
    if i and (Nj < Nj_max) and (i % increase_Nj_every) == 0:
        W = np.pad(W, ((2, 2), (0, 0), (0, 0)))
        Nj = W.shape[0]
        Q3 = dq3 * Nj
        envelope1 = generate_envelope(Nj,
                                      data.shape[-1],