TD.plot_resonance(fig1) ax1.plot([0.29], [0.31], 'r.', markersize=20) ax2 = plt.subplot(1, 2, 2) Q_arr = np.empty_like(xy) k = 0 for q1 in Q_arr: for q2 in q1: B = tfs.open(trackdir + 'track.obs0001.p{0:04d}'.format(k + 1)) Bx = B['x'][np.isfinite(B['x'])] By = B['y'][np.isfinite(B['y'])] qx1 = NAFFlib.get_tune(Bx) qy1 = NAFFlib.get_tune(By) #print('{0:d} {1:.3f} {2:.3f} '.format(k, qx1, qy1)) q2[0] = qx1 q2[1] = qy1 k += 1 ax1.plot([0.29], [0.31], 'r.', markersize=20) ax2.plot(xy[:, :, 0], xy[:, :, 1], 'b.') footprint.draw_footprint(Q_arr, fig1, 0) footprint.draw_footprint(xy, fig1, 1) ax1.set_xlabel('$Q_x$') ax1.set_ylabel('$Q_y$') #ax1.set_xlim(0.25,0.30) #ax1.set_ylim(0.28,0.315) ax2.set_xlabel('$x$') ax2.set_ylabel('$y$') plt.show(False) input()
Qy = np.zeros(n_part) for i_part in range(n_part): Qx[i_part] = NAFFlib.get_tune(x_tbt[:, i_part]) Qy[i_part] = NAFFlib.get_tune(y_tbt[:, i_part]) Qxy_fp = np.zeros_like(xy_norm) Qxy_fp[:, :, 0] = np.reshape(Qx, Qxy_fp[:, :, 0].shape) Qxy_fp[:, :, 1] = np.reshape(Qy, Qxy_fp[:, :, 1].shape) plt.close('all') fig3 = plt.figure(3, figsize=(5, 5)) axcoord = fig3.add_subplot(1, 1, 1) footprint.draw_footprint(xy_norm, axis_object=axcoord, linewidth=1) axcoord.set_xlim(right=np.max(xy_norm[:, :, 0])) axcoord.set_ylim(top=np.max(xy_norm[:, :, 1])) axcoord.set_xlabel('px (sigma)') axcoord.set_ylabel('py (sigma)') fig4 = plt.figure(4, figsize=(5, 5)) axFP = fig4.add_subplot(1, 1, 1) footprint.draw_footprint(Qxy_fp, axis_object=axFP, linewidth=1) # fig4.suptitle(info) axFP.set_xlabel('Qx') axFP.set_ylabel('Qy') axFP.set_xlim(0, 0.25) axFP.set_ylim(0, 0.25) plt.show()
raise ValueError('What?!') n_part = x_tbt.shape[1] Qx = np.zeros(n_part) Qy = np.zeros(n_part) for i_part in range(n_part): Qx[i_part] = NAFFlib.get_tune(x_tbt[:, i_part]) Qy[i_part] = NAFFlib.get_tune(y_tbt[:, i_part]) Qxy_fp = np.zeros_like(xy_norm) Qxy_fp[:, :, 0] = np.reshape(Qx, Qxy_fp[:, :, 0].shape) Qxy_fp[:, :, 1] = np.reshape(Qy, Qxy_fp[:, :, 1].shape) plt.close('all') fig3 = plt.figure(3) axcoord = fig3.add_subplot(1, 1, 1) footprint.draw_footprint(xy_norm, axis_object=axcoord) axcoord.set_xlim(right=np.max(xy_norm[:, :, 0])) axcoord.set_ylim(top=np.max(xy_norm[:, :, 1])) fig4 = plt.figure(4) axFP = fig4.add_subplot(1, 1, 1) footprint.draw_footprint(Qxy_fp, axis_object=axFP) # axFP.set_xlim(right=np.max(Qxy_fp[:, :, 0])) # axFP.set_ylim(top=np.max(Qxy_fp[:, :, 1])) fig4.suptitle(track_with) plt.show()
raise ValueError('What?!') n_part = x_tbt.shape[1] Qx = np.zeros(n_part) Qy = np.zeros(n_part) for i_part in range(n_part): Qx[i_part] = NAFFlib.get_tune(x_tbt[:, i_part]) Qy[i_part] = NAFFlib.get_tune(y_tbt[:, i_part]) Qxy_fp = np.zeros_like(xy_norm) Qxy_fp[:, :, 0] = np.reshape(Qx, Qxy_fp[:, :, 0].shape) Qxy_fp[:, :, 1] = np.reshape(Qy, Qxy_fp[:, :, 1].shape) plt.close('all') fig3 = plt.figure(3) axcoord = fig3.add_subplot(1, 1, 1) footprint.draw_footprint(xy_norm, axis_object=axcoord, linewidth = 1) axcoord.set_xlim(right=np.max(xy_norm[:, :, 0])) axcoord.set_ylim(top=np.max(xy_norm[:, :, 1])) fig4 = plt.figure(4) axFP = fig4.add_subplot(1, 1, 1) footprint.draw_footprint(Qxy_fp, axis_object=axFP, linewidth = 1) # axFP.set_xlim(right=np.max(Qxy_fp[:, :, 0])) # axFP.set_ylim(top=np.max(Qxy_fp[:, :, 1])) fig4.suptitle(info) plt.show()
#! /usr/bin/env Python