Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering elements by name #41

Open
rtesse opened this issue Sep 9, 2022 · 0 comments
Open

Filtering elements by name #41

rtesse opened this issue Sep 9, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@rtesse
Copy link

rtesse commented Sep 9, 2022

If I try to filter the line by the name of an element, it doesn't work. For example, let's define the following Input:

import zgoubidoo
from zgoubidoo.commands import *
from zgoubidoo import ureg as _ureg

# Beam definition
k = zgoubidoo.Kinematics(2 * _ureg.GeV)

qf = Multipole('QF', XL=1*_ureg.m, B1=1 * _ureg.tesla, ALE=10*_ureg.degrees, XCE=10*_ureg.cm, YCE=10*_ureg.cm, KPOS=2)
qd = Multipole('QD', XL=1*_ureg.m, B1=-1 * _ureg.tesla, KPOS=2)


zi = zgoubidoo.Input(name='FODO', line=[
    Objet2('BUNCH', BORO=k.brho),
    Proton(),
    Drift(XL=1 * _ureg.m),
    qf,
    Drift(XL=1 * _ureg.m),
    qd,
    Drift(XL=1 * _ureg.m),
])

If I type the command zi.QF, I get the correct definition of the element.

'MULTIPOL' QF
        0
        1.000000000000e+02 1.000000000000e+01 1.000000000000e+01 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
        0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00
        6 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
        0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00 1.000000000000e+00
        6 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
        0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00
        1.0
        2 1.000000000000e+01 1.000000000000e+01 1.745329251994e-01

However, the command zi['QF'] returns nothing.

FODO_filtered_by_QF
        'END' 2448f1a91fef4cc4ab24 

I think the issue is coming from lines 330 - 336 of input.py

@rtesse rtesse added the bug Something isn't working label Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant