ocelot.adaptors.astra2ocelot

Module Contents

Functions

exact_xp_2_xxstg_mad(xp, gamref)

exact_xxstg_2_xp_mad(xxstg, gamref)

exact_xp_2_xxstg_dp(xp, gamref)

exact_xxstg_2_xp_dp(xxstg, gamref)

exact_xp_2_xxstg_de(xp, gamref)

exact_xxstg_2_xp_de(xxstg, gamref)

astraBeam2particleArray(filename, print_params=True)

function convert Astra beam distribution to Ocelot format - ParticleArray.

particleArray2astraBeam(p_array, filename='tytest.ast')

function convert Ocelot’s ParticleArray to Astra beam distribution and save to “filename”.

emittance_analysis(fileprefix='Exfel', trace_space=True, s_offset=None)

To calculate emittance in the trace space the flag “Tr_EmitS=.T” is needed.

ocelot.adaptors.astra2ocelot.exact_xp_2_xxstg_mad(xp, gamref)
ocelot.adaptors.astra2ocelot.exact_xxstg_2_xp_mad(xxstg, gamref)
ocelot.adaptors.astra2ocelot.exact_xp_2_xxstg_dp(xp, gamref)
ocelot.adaptors.astra2ocelot.exact_xxstg_2_xp_dp(xxstg, gamref)
ocelot.adaptors.astra2ocelot.exact_xp_2_xxstg_de(xp, gamref)
ocelot.adaptors.astra2ocelot.exact_xxstg_2_xp_de(xxstg, gamref)
ocelot.adaptors.astra2ocelot.astraBeam2particleArray(filename, print_params=True)

function convert Astra beam distribution to Ocelot format - ParticleArray. Note that downloading ParticleArray from the astra file and saving it back does not give the same distribution. The difference arises because the array of particles does not have a reference particle, and in this case the first particle is used as a reference.

Parameters

print_params

Returns

ParticleArray

ocelot.adaptors.astra2ocelot.particleArray2astraBeam(p_array, filename='tytest.ast')

function convert Ocelot’s ParticleArray to Astra beam distribution and save to “filename”.

Note that downloading ParticleArray from the astra file and saving it back does not give the same distribution. The difference arises because the array of particles does not have a reference particle, and in this case the first particle is used as a reference.

Parameters
  • p_array

  • filename

Returns

ocelot.adaptors.astra2ocelot.emittance_analysis(fileprefix='Exfel', trace_space=True, s_offset=None)

To calculate emittance in the trace space the flag “Tr_EmitS=.T” is needed.

The phase space is (x, px, y, py, z, pz) The trace space is (x, x’, y, y’, z, z’) :param fileprefix: file prefix to read files: fileprefix + ‘.Xemit.001’,

fileprefix + ‘.Yemit.001’, fileprefix + ‘.Zemit.001’, fileprefix + ‘.TRemit.001’

Parameters
  • trace_space – True, to calculate emittance in the trace space

  • s_offset – None, if None use s coordinates from a file, if not None the s coordinate starts from “s_offset”

Returns

list of the twiss objects