separateXY=True)[1] #return quads to original values SetMagnet(quad_pair[0], q0_init) SetMagnet(quad_pair[1], q1_init) sleep(5) for i, m in enumerate(magnet_list): magnet_values[i] = caget(corr_set_pvs[m]) print("Correctors set.") else: if count == 0: magnet_values = [random.uniform(-10, 10) for m in magnet_list] #magnet_values = [random.uniform(-15,15) for m in magnet_list] #magnet_values = [7.73 for m in magnet_list] distance = gp.returnObservations(magnet_values) print(f"Dist= {distance:.5f}") #save corrector values and distance to file f = open(f"GP_results/correctorValues_Distance_{timestamp}.txt", "a+") f.write('%s' % ' '.join(map('{:.4f}'.format, magnet_values)) + ' {0:.4f}\n'.format(distance)) f.close() #increase counter count = count + 1 count_iter = count_iter + 1 #################### ####GaussProc###### ####################
pos_init = GetBeamPos(init_im, viewer) #widths (+/- 34.13%) wid_init = (pos_init[5] - pos_init[4]) wid_gp = wid_init else: magnet_values = [random.uniform(-10, 10) for q in magnet_list] spaceArray = [{ 'name': q, 'type': 'continuous', 'domain': (-10, 10) } for q in magnet_list] space = Design_space(spaceArray) wid_gp = gp.returnObservations(magnet_values) else: if sandbox != 'y': #starting with this state magnet_values = [GetMagnet(q) for q in magnet_list] gp_im = SaveIm('gp', viewer) sleep(2) pos_gp = GetBeamPos(gp_im, viewer) #widths (+/- 34.13%) wid_gp = pos_gp[5] - pos_gp[4] else: