xsuite icon indicating copy to clipboard operation
xsuite copied to clipboard

Issue with survey table

Open giadarol opened this issue 2 years ago • 0 comments

Reported by @sterbini

import numpy as np
import xobjects as xo
import xtrack as xt
import xpart as xp

## Generate a simple line
line = xt.Line(
    elements=[xt.Drift(length=2.),
              xt.Multipole(knl=[0, 1.], ksl=[0,0]),
              xt.Drift(length=1.),
              xt.Multipole(knl=[0, -1.], ksl=[0,0])],
    element_names=['drift_0', 'quad_0', 'drift_1', 'quad_1'])

line.particle_ref = xp.Particles(p0c=6500e9, #eV
                                 q0=1, mass0=xp.PROTON_MASS_EV)

## Choose a context
context = xo.ContextCpu()         # For CPU


## Transfer lattice on context and compile tracking code
line.build_tracker(_context=context)

# %%
my_twiss = line.twiss(method='4d')
my_twiss[:,'quad_0']

# %% PROBLEM HERE
########################
my_survey = line.survey()
my_survey[:,'quad_0']
########################


# %% WORK-AROUND HERE
my_survey = line.survey()
my_survey[['X','Y','Z'],'quad_0']

giadarol avatar Jul 14 '23 16:07 giadarol