Ejemplo n.º 1
0
import numpy as np
from time import *
from setup import SaveIm, SetCorr, GetCorr, SetQuads, GetQuads, GetBeamPos, Dist, GaussProc, cont

while (cont == 'yes'):
	
	#import current state
	#Get initial corrector values
	h13_init, v13_init, h31_init, v31_init= GetCorr()
	#Get initial quad values
	q1_init, q2_init, q3_init, q4_init= GetQuads()

	#Tuning Q1 and Q2

	#take picture with all at init values
	SetQuads(q1_init, q2_init, 0, 0)
	sleep(7)
	all_nom_im= SaveIm('allNom')

	#take picture with all at zero
	SetQuads(0, 0, 0, 0)
	sleep(7) #might need to increase this if the jumps in current are big
	all_zero_im= SaveIm('allZero')

	#take picture with Q1 at half
	SetQuads(q1_init/2, q2_init, 0, 0)
	sleep(7)
	q1_half_im= SaveIm('q1half')

	#take picture with Q2 at half
	SetQuads(q1_init, q2_init/2, 0, 0)
Ejemplo n.º 2
0
        #import current state
        #Get initial quad values
        q1_init, q2_init, q3_init, q4_init = GetQuads()

        #Tuning Q1 and Q2
        #take picture with all at init values
        #SetQuads(q1_init, q2_init, q3_init, q4_init)

        sleep(10)
        all_nom_im = SaveIm('allNom', viewer)
        sleep(2)

        #take picture with all at zero
        #SetQuads(q1_init, q2_init, q3_init*1.3, q4_init)
        SetQuads(q1_init / 2, q2_init, q3_init, q4_init)
        pos_1 = GetBeamPos(all_nom_im, viewer)
        pk_1 = pos_1[2:4]
        if pk_1[0] < int_limit:
            peak_found = False
            SetQuads(q1_init, q2_init, q3_init, q4_init)
            distance = 1000

        if peak_found:
            sleep(
                10
            )  #might need to increase this if the jumps in current are big
            all_zero_im = SaveIm('q1half', viewer)
            sleep(2)

            #take picture with Q1 at half # CHANGED.... Q2 also half
Ejemplo n.º 3
0
    #~ if (abs(b1_nmr_h - b2_nmr_h) > dNMR):
    if (abs(b1_nmr - b2_nmr) >
            dNMR):  # changed b1_nmr_h to b1_nmr and similarly for b2_nmr_h
        matchNMR()
    else:
        print(
            f"Fields: {b1_nmr:.6f}, {b2_nmr:.6f}, dNMR: {((b1_nmr - b2_nmr)/b1_nmr*100):.5f}%"
        )

#compare current dist with previous, once I pass the min, stop, set back to Imin, cycle
    q1_init, q2_init, q3_init, q4_init = GetQuads()
    q5_init = GetMagnet('q5')

    #Tuning Q3 and Q4
    #take picture with all at init values
    SetQuads(q1_init, q2_init, q3_init, q4_init)
    sleep(1)
    all_nom_im = SaveIm('allNom', viewer)

    #take picture with all at zero
    SetQuads(q1_init, q2_init, 90, q4_init)
    pos_1 = GetBeamPos(all_nom_im, viewer)
    sleep(5)  #might need to increase this if the jumps in current are big
    q3_90_im = SaveIm('q3_90', viewer)

    #take picture with Q3 at half
    SetQuads(q1_init, q2_init, q3_init, -90)
    pos_2 = GetBeamPos(q3_90_im, viewer)
    sleep(5)
    q4_90_im = SaveIm('q4_90', viewer)
Ejemplo n.º 4
0
    #~ if (abs(b1_nmr_h - b2_nmr_h) > dNMR):
    if (abs(b1_nmr - b2_nmr) >
            dNMR):  # changed b1_nmr_h to b1_nmr and similarly for b2_nmr_h
        matchNMR()
    else:
        print(
            f"Fields: {b1_nmr:.6f}, {b2_nmr:.6f}, dNMR: {((b1_nmr - b2_nmr)/b1_nmr*100):.5f}%"
        )

#compare current dist with previous, once I pass the min, stop, set back to Imin, cycle
    q1_init, q2_init, q3_init, q4_init = GetQuads()

    #Tuning Q3 and Q4
    #take picture with all at init values
    SetQuads(q1_init, q2_init, q3_init, q4_init)
    sleep(1)
    all_nom_im = SaveIm('allNom', viewer)

    #take picture with all at zero
    SetQuads(q1_init, q2_init, q3_init, -90)
    pos_1 = GetBeamPos(all_nom_im, viewer)
    sleep(5)  #might need to increase this if the jumps in current are big
    all_zero_im = SaveIm('Q4_neg90', viewer)

    #take picture with Q3 at half
    SetQuads(q1_init, q2_init, q3_init * 2 / 3, q4_init)
    pos_2 = GetBeamPos(all_zero_im, viewer)
    sleep(5)
    q3_half_im = SaveIm('q3_2-3', viewer)
Ejemplo n.º 5
0
        #~ sleep(10)
        all_nom_im = SaveIm('allNom', viewer)
        sleep(2)

        #take picture with all at zero
        #~ SetQuads(0, 0, 0, 0)
        #~ SetMagnet('q8', 0)
        #~ SetMagnet('q9', 0)
        #~ pos_1= GetBeamPos(all_nom_im, viewer)
        #~ sleep(10) #might need to increase this if the jumps in current are big
        #~ all_zero_im= SaveIm('allZero', viewer)
        #~ sleep(2)

        #take picture with q1 1/2 and q2 1/2
        SetQuads(q1_init, q2_init / 2, q3_init, q4_init)
        #~ SetMagnet('q1', q8_init*2/3)
        #SetMagnet('q1', -30.0)
        #SetMagnet('q8', q8_init-2.7)
        pos_1 = GetBeamPos(all_nom_im, viewer)
        sleep(10)
        q1q2_half_im = SaveIm('q2half', viewer)
        sleep(2)

        #take picture with q8 2/3 and q9 2/3
        SetQuads(q1_init, q2_init * 3 / 2, q3_init, q4_init)
        #SetMagnet('q2', 90.0) #q2_init/2)
        #SetMagnet('q1', q1_init)
        #~ SetMagnet('q8', q8_init*2/3)
        #~ SetMagnet('q9', q9_init*2/3)
        pos_2 = GetBeamPos(q1q2_half_im, viewer)