def plot_generator(): for i, thick in enumerate([0, 60, 400, 1000, 1500]): # for i, thick in enumerate([0, ]): shadow.modify_input(start01, ('THICK(1)', str(thick * 1e-4))) filename = 'filt%04imum' % thick plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text('filter\nthickness\n%s $\mu$m' % thick) yield 0
def plot_generator(): for rmaj in np.logspace(-1, 1, 7, base=1.5) * rmaj0: shadow.modify_input(start04, ('R_MAJ', str(rmaj))) filename = 'VFM_R%07i' % rmaj plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textToSet = 'focusing mirror\nmeridional radius\n$R =$ %.1f km'\ % (rmaj * 1e-5) textPanel1.set_text(textToSet) yield
def plot_generator(): for rmirr in np.logspace(-1., 1., 7, base=1.5) * rmirr0: shadow.modify_input(start01, ('RMIRR', str(rmirr))) filename = 'VCM_R%07i' % rmirr filename03 = '03' + filename filename04 = '04' + filename plot1.title = filename03 plot2.title = filename04 plot1.saveName = [filename03 + '.pdf', filename03 + '.png'] plot2.saveName = [filename04 + '.pdf', filename04 + '.png'] # plot1.persistentName = filename03 + '.pickle' # plot2.persistentName = filename04 + '.pickle' textToSet = 'collimating\nmirror\n$R =$ %.1f km' % (rmirr * 1e-5) textPanel1.set_text(textToSet) textPanel2.set_text(textToSet) yield
def plot_generator(): shadow.modify_input(start01, ('F_REFLEC', '1')) for angle in np.linspace(4.1e-3, 5.3e-3, 7): rmirr = 744680 * 4.7e-3 / angle shadow.modify_input(start01, ('RMIRR', str(rmirr))) r_maj = 476597 * 4.7e-3 / angle shadow.modify_input(start04, ('R_MAJ', str(r_maj))) tIncidence = 90 - angle * 180 / np.pi shadow.modify_input(start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) shadow.modify_input(start04, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) filename04 = '04' + stripe + '_pitch_%.1f' % (angle * 1e3) plot2.title = filename04 plot2.saveName = \ [filename04 + '.pdf', filename04 + '.png', filename04 + '.svg'] # plot2.persistentName = filename04 + '.pickle' textPanel2.set_text(stripe + ' coating,\nangle\n%.1f mrad' % (angle * 1e3)) yield 0
def main(): plot1 = xrtp.XYCPlot('star.03') plot1.xaxis.limits = [-15, 15] plot1.yaxis.limits = [-15, 15] plot1.yaxis.factor *= -1 textPanel = plot1.fig.text(0.88, 0.8, '', transform=plot1.fig.transFigure, size=14, color='r', ha='center') #========================================================================== threads = 4 #========================================================================== start01 = shadow.files_in_tmp_subdirs('start.01', threads) start02 = shadow.files_in_tmp_subdirs('start.02', threads) start03 = shadow.files_in_tmp_subdirs('start.03', threads) shadow.modify_input(start01, ('THICK(1)', str(60 * 1e-4))) shadow.modify_input(start01, ('FILE_REFL', 'Rh_refl.dat')) shadow.modify_input(start02, ('F_CENTRAL', '0')) shadow.modify_input(start03, ('F_CENTRAL', '0')) def plot_generator(): for crystal in ['Si111', 'Si311']: theta0 = 19.234 theta1 = 19.246 if crystal == 'Si311': theta0 = np.arcsin(np.sin(theta0*np.pi/180) * np.sqrt(11.0/3)) * 180 / np.pi theta1 = np.arcsin(np.sin(theta1*np.pi/180) * np.sqrt(11.0/3)) * 180 / np.pi shadow.modify_input(start02, ('FILE_REFL', crystal + '.rc')) shadow.modify_input(start03, ('FILE_REFL', crystal + '.rc')) for theta in np.linspace(theta0, theta1, 7): shadow.modify_input(start02, ('T_INCIDENCE', str(90 - theta)), ('T_REFLECTION', str(90 - theta))) shadow.modify_input(start03, ('T_INCIDENCE', str(90 - theta)), ('T_REFLECTION', str(90 - theta))) filename = crystal + '_%5i' % (theta * 1e4) plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] # plot1.persistentName = filename + '.pickle' textPanel.set_text( crystal + '\nBragg angle\n$\\theta =$ %.3f$^o$' % theta) yield 0 xrtr.run_ray_tracing( plot1, repeats=640, updateEvery=2, energyRange=[5998, 6003], generator=plot_generator, threads=threads, globalNorm=True, backend='shadow')
def main(): plot2 = xrtp.XYCPlot('star.04') plot2.caxis.offset = 6000 plot2.xaxis.limits = [-4, 4] plot2.yaxis.limits = [-4, 4] plot2.yaxis.factor *= -1 textPanel2 = plot2.fig.text(0.88, 0.8, '', transform=plot2.fig.transFigure, size=12, color='r', ha='center') #========================================================================== threads = 4 #========================================================================== start01 = shadow.files_in_tmp_subdirs('start.01', threads) start04 = shadow.files_in_tmp_subdirs('start.04', threads) shadow.modify_input(start01, ('THICK(1)', str(60 * 1e-4))) stripe = 'Rh' shadow.modify_input(start01, ('FILE_REFL', stripe + '_refl.dat')) shadow.modify_input(start04, ('FILE_REFL', stripe + '_refl.dat')) def plot_generator(): shadow.modify_input(start01, ('F_REFLEC', '1')) for angle in np.linspace(4.1e-3, 5.3e-3, 7): rmirr = 744680 * 4.7e-3 / angle shadow.modify_input(start01, ('RMIRR', str(rmirr))) r_maj = 476597 * 4.7e-3 / angle shadow.modify_input(start04, ('R_MAJ', str(r_maj))) tIncidence = 90 - angle * 180 / np.pi shadow.modify_input(start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) shadow.modify_input(start04, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) filename04 = '04' + stripe + '_pitch_%.1f' % (angle * 1e3) plot2.title = filename04 plot2.saveName = \ [filename04 + '.pdf', filename04 + '.png', filename04 + '.svg'] # plot2.persistentName = filename04 + '.pickle' textPanel2.set_text(stripe + ' coating,\nangle\n%.1f mrad' % (angle * 1e3)) yield 0 xrtr.run_ray_tracing(plot2, repeats=640, updateEvery=2, threads=threads, energyRange=[5998, 6002], generator=plot_generator, globalNorm=True, backend='shadow')
def plot_generator(): for crystal in ['Si111', 'Si311']: theta0 = 19.234 theta1 = 19.246 if crystal == 'Si311': theta0 = np.arcsin(np.sin(theta0*np.pi/180) * np.sqrt(11.0/3)) * 180 / np.pi theta1 = np.arcsin(np.sin(theta1*np.pi/180) * np.sqrt(11.0/3)) * 180 / np.pi shadow.modify_input(start02, ('FILE_REFL', crystal + '.rc')) shadow.modify_input(start03, ('FILE_REFL', crystal + '.rc')) for theta in np.linspace(theta0, theta1, 7): shadow.modify_input(start02, ('T_INCIDENCE', str(90 - theta)), ('T_REFLECTION', str(90 - theta))) shadow.modify_input(start03, ('T_INCIDENCE', str(90 - theta)), ('T_REFLECTION', str(90 - theta))) filename = crystal + '_%5i' % (theta * 1e4) plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] # plot1.persistentName = filename + '.pickle' textPanel.set_text( crystal + '\nBragg angle\n$\\theta =$ %.3f$^o$' % theta) yield 0
def main(): plot1 = xrtp.XYCPlot('star.04') plot1.caxis.offset = 6000 plot1.xaxis.limits = [-1, 1] plot1.yaxis.limits = [-1, 1] plot1.yaxis.factor *= -1 textPanel1 = plot1.fig.text(0.86, 0.8, '', transform=plot1.fig.transFigure, size=12, color='r', ha='center') #========================================================================== threads = 4 #========================================================================== start01 = shadow.files_in_tmp_subdirs('start.01', threads) start04 = shadow.files_in_tmp_subdirs('start.04', threads) rmirr0 = 744680. shadow.modify_input(start01, ('RMIRR', str(rmirr0))) angle = 4.7e-3 tIncidence = 90 - angle * 180 / np.pi shadow.modify_input(start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) shadow.modify_input(start04, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) rmaj0 = 476597.0 def plot_generator(): for rmaj in np.logspace(-1, 1, 7, base=1.5) * rmaj0: shadow.modify_input(start04, ('R_MAJ', str(rmaj))) filename = 'VFM_R%07i' % rmaj plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textToSet = 'focusing mirror\nmeridional radius\n$R =$ %.1f km'\ % (rmaj * 1e-5) textPanel1.set_text(textToSet) yield xrtr.run_ray_tracing(plot1, repeats=640, updateEvery=2, threads=threads, energyRange=[5998, 6002], generator=plot_generator, globalNorm=True, backend='shadow')
def plot_generator(): shadow.modify_input(start01, ('F_REFLEC', '0')) tIncidence = 90 - angles[0] * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) filename = 'VCM0_nomirror' plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text('no mirror') yield 0 shadow.modify_input(start01, ('F_REFLEC', '1')) for angle in angles: tIncidence = 90 - angle * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) for stripe in [stripes[0], ]: shadow.modify_input(start01, ('FILE_REFL', stripe+'_refl.dat')) filename = 'VCM_' + str(angle * 1e4) + '_' + stripe plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text( stripe + ' coating,\npitch angle\n%.1f mrad' % (angle * 1e3)) yield 0 for angle in [angles[0], ]: tIncidence = 90 - angle * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) for stripe in [stripes[1], stripes[2]]: shadow.modify_input(start01, ('FILE_REFL', stripe+'_refl.dat')) filename = 'VCM_' + str(angle * 1e4) + '_' + stripe plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text( stripe + ' coating,\npitch angle\n%.1f mrad' % (angle * 1e3)) yield 0
def main(): plot1 = xrtp.XYCPlot('star.01') plot1.caxis.fwhmFormatStr = None plot1.xaxis.limits = [-15, 15] plot1.yaxis.limits = [-15, 15] textPanel = plot1.fig.text(0.88, 0.8, '', transform=plot1.fig.transFigure, size=14, color='r', ha='center') #========================================================================== processes = 4 #========================================================================== start01 = shadow.files_in_tmp_subdirs('start.01', processes) shadow.modify_input(start01, ('THICK(1)', str(60 * 1e-4))) stripes = ['Si', 'Rh', 'Pt'] angles = np.linspace(4.5e-3, 1.5e-3, 7) def plot_generator(): shadow.modify_input(start01, ('F_REFLEC', '0')) tIncidence = 90 - angles[0] * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) filename = 'VCM0_nomirror' plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text('no mirror') yield 0 shadow.modify_input(start01, ('F_REFLEC', '1')) for angle in angles: tIncidence = 90 - angle * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) for stripe in [stripes[0], ]: shadow.modify_input(start01, ('FILE_REFL', stripe+'_refl.dat')) filename = 'VCM_' + str(angle * 1e4) + '_' + stripe plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text( stripe + ' coating,\npitch angle\n%.1f mrad' % (angle * 1e3)) yield 0 for angle in [angles[0], ]: tIncidence = 90 - angle * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) for stripe in [stripes[1], stripes[2]]: shadow.modify_input(start01, ('FILE_REFL', stripe+'_refl.dat')) filename = 'VCM_' + str(angle * 1e4) + '_' + stripe plot1.title = filename plot1.saveName = [filename + '.pdf', filename + '.png'] textPanel.set_text( stripe + ' coating,\npitch angle\n%.1f mrad' % (angle * 1e3)) yield 0 xrtr.run_ray_tracing( plot1, repeats=160, updateEvery=4, processes=processes, energyRange=[2400, 22400], generator=plot_generator, globalNorm=True, backend='shadow')
def main(): plot1 = xrtp.XYCPlot('star.03') plot1.caxis.offset = 6000 plot2 = xrtp.XYCPlot('star.04') plot2.caxis.offset = 6000 plot1.xaxis.limits = [-15, 15] plot1.yaxis.limits = [-15, 15] plot1.yaxis.factor *= -1 plot2.xaxis.limits = [-1, 1] plot2.yaxis.limits = [-1, 1] plot2.yaxis.factor *= -1 textPanel1 = plot1.fig.text( 0.89, 0.82, '', transform=plot1.fig.transFigure, size=14, color='r', ha='center') textPanel2 = plot2.fig.text( 0.89, 0.82, '', transform=plot2.fig.transFigure, size=14, color='r', ha='center') #========================================================================== threads = 4 #========================================================================== start01 = shadow.files_in_tmp_subdirs('start.01', threads) start04 = shadow.files_in_tmp_subdirs('start.04', threads) rmaj0 = 476597.0 shadow.modify_input(start04, ('R_MAJ', str(rmaj0))) angle = 4.7e-3 tIncidence = 90 - angle * 180 / np.pi shadow.modify_input( start01, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) shadow.modify_input( start04, ('T_INCIDENCE', str(tIncidence)), ('T_REFLECTION', str(tIncidence))) rmirr0 = 744680. def plot_generator(): for rmirr in np.logspace(-1., 1., 7, base=1.5) * rmirr0: shadow.modify_input(start01, ('RMIRR', str(rmirr))) filename = 'VCM_R%07i' % rmirr filename03 = '03' + filename filename04 = '04' + filename plot1.title = filename03 plot2.title = filename04 plot1.saveName = [filename03 + '.pdf', filename03 + '.png'] plot2.saveName = [filename04 + '.pdf', filename04 + '.png'] # plot1.persistentName = filename03 + '.pickle' # plot2.persistentName = filename04 + '.pickle' textToSet = 'collimating\nmirror\n$R =$ %.1f km' % (rmirr * 1e-5) textPanel1.set_text(textToSet) textPanel2.set_text(textToSet) yield def after(): # import subprocess # subprocess.call(["python", "05-VFM-bending.py"], # cwd='/home/kklementiev/Alba/Ray-tracing/with Python/05-VFM-bending') pass xrtr.run_ray_tracing( [plot1, plot2], repeats=640, updateEvery=2, energyRange=[5998, 6002], generator=plot_generator, threads=threads, globalNorm=True, afterScript=after, backend='shadow')