atcollab / at

Accelerator Toolbox
Apache License 2.0
48 stars 31 forks source link

problem with display of correctly initialised VariableMultipole element #751

Open lcarver opened 3 months ago

lcarver commented 3 months ago

I initalise a VariableMultipole element

var = at.VariableMultipole('h_acd', AmplitudeB = [0.0, 0.0, 1e-6], FuncB=kick_list, MaxOrder=2, Periodic=True, mode=ACMode.ARBITRARY) In ipython, python interactive shell or with python script.py, if I run print(var) I get the correct output.

In ipython or an interactive python shell:

var

returns an error saying AmplitudeA or AmplitudeB must be defined. It seems like at some point when generating the string to print in the interactive shells it calls the init again which creates the error.

Full test script is pasted below.


import at
import numpy as np
from at import ACMode

ring = at.load_mat('/machfs/carver/Repo/EBSlattices/AT/S28F.mat', mat_key='LOW_EMIT_RING_INJ')

ring.disable_6d()
qx,qy = ring.get_tune()

Nturns = 1000

kick_list = np.sin(2*np.pi*np.arange(Nturns)*(qx))

var = at.VariableMultipole('h_acd', AmplitudeB = [0.0, 0.0, 1e-6], FuncB=kick_list, MaxOrder=2, Periodic=True, mode=ACMode.ARBITRARY)
var
lcarver commented 2 months ago

I have a fix incoming as part of a larger improvement to VariableMultipole.