Esempio n. 1
0
def workup():
    trive.exp.set_coord(trive.d1, 100.)
    trive.exp.set_coord(trive.d2, 200.)
    trive.exp.set_coord(trive.ss, 50.)
    # hamiltonian
    H0.tau_ag = 50.
    H0.tau_2aa = 50.
    H0.tau_2ag = 50.
    H = H0.Omega()
    H.out_group = [[5, 6]]
    # scan
    w1 = trive.w1
    w1.points = np.linspace(5000, 9000, 41)
    w2 = trive.w2
    w2.points = np.linspace(5000, 9000, 41)
    scan = trive.exp.scan(w1, w2, H=H)
    scan.run(mp=False, autosave=False)
    # measure
    mono = m.Mono()
    mono.slitwidth = 120  # wn
    sld = m.SLD()
    measure = m.Measure(scan, mono, sld)
    measure.run()
    # data
    data = wt.data.from_NISE(measure)
    data.transpose()
    data.scale()  # stored as amplitude level
    data.normalize()
    # save
    data.save(out_path)
    return data, data.copy()
Esempio n. 2
0
def workup():
    trive.exp.set_coord(trive.d1, 100.)
    trive.exp.set_coord(trive.d2, 200.)
    trive.exp.set_coord(trive.ss, 50.)
    # hamiltonian
    H0.tau_ag = 50.
    H0.tau_2aa = 50.
    H0.tau_2ag = 50.
    H = H0.Omega()
    H.out_group = [[5, 6]]
    # scan
    w1 = trive.w1
    w1.points = np.linspace(5000, 9000, 41)
    w2 = trive.w2
    w2.points = np.linspace(5000, 9000, 41)
    scan = trive.exp.scan(w1, w2, H=H)
    scan.run(mp=False, autosave=False)
    # kernal
    # currently no way to NOT do this in multiprocessing
    # additionally this spams my NISE/data folder :-(
    if __name__ == '__main__':
        scan.smear(0, 1, 500, 1e-3, theta=np.pi/4, save=False)
    # measure
    mono = m.Mono()
    mono.slitwidth = 120  # wn
    sld = m.SLD()
    measure = m.Measure(scan, mono, sld)
    measure.run()
    # data
    data = wt.data.from_NISE(measure)
    data.transpose()
    data.scale()  # stored as amplitude level
    data.normalize()
    # save
    data.save(out_path)
    return data, data.copy()
Esempio n. 3
0
        out1.run(autosave=autosave, mp=True, chunk=False)
        t.exp.set_coord(dzs, 1.5e-5)
        out2 = t.exp.scan(w1, w2, d1, H=H, inhom_object=inhom_object)
        out2.run(autosave=autosave, mp=True, chunk=False)

    if add_nrb:
        for obj in [out1, out2]:
            nrb1 = obj.nrb()
            print nrb1.shape
            print obj.sig.shape
            nrb1_max = np.abs(nrb1).max()
            obj_smax = np.abs(obj.sig.sum(axis=-2)).max()
            #print nrb1_max, out1_smax
            nrb1 *= obj_smax / nrb1_max * nrb_level
            #print np.abs(nrb1).max(), np.abs(out1.sig).max()
            # careful...don't collapse the out_groups axis
            obj.sig = obj.sig.sum(axis=-2)[..., None, :]
            obj.sig += nrb1[..., None, :]

    m1 = m.Measure(out1, m.Mono, m.SLD)
    m.Mono.slitwidth = slitwidth
    m2 = m.Measure(out2, m.Mono, m.SLD)
    m.Mono.slitwidth = slitwidth

    if plot1:
        m1.run()
        m1.plot(0, yaxis=1, zoom=1)
    if plot2:
        m2.run()
        m2.plot(0, yaxis=1, zoom=1)
Esempio n. 4
0
    out2.run()
    #trive.set_coord(d1, 0.)
    #trive.set_coord(d2, 0.)
    #out1 = trive.scan(w1, w2)

# manually plotting the output of out2
sig2o = (np.abs(out2.sig.sum(axis=-2))**2).sum(axis=-1) * out2.timestep
plt.figure()
plt.subplot(131)
plt.contourf(trive.d1.points, trive.d2.points, sig2o, 200)
plt.title('sig2 manual')
plt.grid()
plt.colorbar()

# using measure processes - shoudl be equivalent to sig2o
sig2 = m.Measure(out2, m.SLD)
sig2.run()
plt.subplot(132)
plt.contourf(trive.d1.points, trive.d2.points, sig2.pol, 200)
plt.title('sig2 measure')
plt.grid()
plt.colorbar()

ratio1 = sig2.pol / sig2o
print ratio1.min(), ratio1.max()

# using measure processes, but with a mono
sig2m = m.Measure(out2, m.Mono, m.SLD)
# should be equivalent to the others if we set mono to pass
m.Mono.slitwidth = slitwidth
sig2m.run()
Esempio n. 5
0
        inhom_object = inhom.Inhom()
    H = H_1.Omega()
    out1 = tsf.exp.scan(w1, w2, H=H, inhom_object=inhom_object)
    out1.run(autosave=autosave)

if add_nrb:
    """
    need to rewrite this part?  maybe not rigorously correct...
    """
    nrb1 = out1.nrb()
    print nrb1.shape
    print out1.sig.shape
    nrb1_max = np.abs(nrb1).sum(axis=-1).max()
    out1_smax = np.abs(out1.sig).sum(axis=-1).max()
    #print nrb1_max, out1_smax
    nrb1 *= out1_smax / nrb1_max * nrb_level
    #print np.abs(nrb1).max(), np.abs(out1.sig).max()
    out1.sig = out1.sig.sum(axis=-2)[..., None, :]
    out1.sig += nrb1[..., None, :]

sig1 = m.Measure(out1, m.Mono, m.SLD)
# should be equivalent to the others if we set mono to pass
m.Mono.slitwidth = slitwidth
sig1.run()

print sig1.pol.shape
# run out1.axes() if you forgot which axis is which
sig1.plot(0, yaxis=1, zoom=3)
#sig1.plot(0,yaxis=2)
#sig1.plot(1,yaxis=2)
Esempio n. 6
0
             inhom_object = inhom.Inhom(inhom_sampling='linear',
                                        num=100,
                                        sigma=100.0,
                                        zeta_bound=2)
     else:
         inhom_object = inhom.Inhom()
     H = H_1.Omega()
     H.TOs = TOs
     trive.exp.late_buffer = 250.
     out1 = trive.exp.scan(w1, w2, d2, H=H, inhom_object=inhom_object)
     #out1 = trive.exp.scan(d1, d2, H=H, inhom_object=inhom_object)
     if mp:
         out1.run(autosave=autosave, mp=True, chunk=False)
     else:
         out1.run(autosave=autosave, mp=False)
 sig1 = m.Measure(out1, m.Mono, m.SLD)
 m.Mono.slitwidth = slitwidth
 if plot1:
     sig1.run()
     sig1.plot(0, yaxis=1, zoom=2)
     #sig1.plot(0,yaxis=2)
 if imported_after:
     filepath = r''.join([folder_path, rel_path2])
     out2 = trive.S.Scan._import(filepath)
 else:
     out1.smear(0, 1, smear_extent, 20, theta=angle)
     out2 = out1
 if view_kernel:
     pass
     """
     import matplotlib.pyplot as plt