#print Twiss parameters of transformed distribution print("Transformed phase space (x,x\') covariance matrix\n", bunch.covariance_matrix(['x', 'x\''])) print('Transformed RMS beta ', bunch.get_beta(['x']), 'mm') print('Transformed RMS alpha ', bunch.get_alpha(['x'])) print('Transformed RMS gamma ', bunch.get_gamma(['x']), 'mm^{-1}') print('Transformed RMS emittance', bunch.get_emittance(['x']), 'mm') #plot x x' and amplitude distribution after - the point being that the x x' distribution is radically different, #but the amplitude distribution is the same; what one would expect from an ideal transfer line bunch.root_scatter_graph('x', 'x\'', 'MeV/c', 'MeV/c', include_weightless=False) bunch.root_histogram('amplitude x', 'mm') #translate to z=0 print('Mean z at start', bunch.mean(['z'])['z']) bunch.translate({'z': -bunch.mean(['z'])['z']}) print('Mean z at end ', bunch.mean(['z'])['z']) #write out as an ICOOL for003 file bunch.hit_write_builtin('icool_for003', 'for003_test.dat', 'for003 file generated by XBOA') print('Press <return> key to finish') input() Bunch.clear_global_weights()