Coder Social home page Coder Social logo

Comments (4)

coldfix avatar coldfix commented on July 29, 2024

Hey,

I believe this may be an issue due to the implementation of m.twiss() calling select(clear) under the hood. This is the way it was designed when I initially forked the project, and I'm not sure it's a good thing to do. The solution would be to use instead

m.command.twiss(...)
table = m.get_table('twiss')

Does this help in your case?

from cpymad.

coldfix avatar coldfix commented on July 29, 2024

Hey, somehow your answer was deleted.. (?)

I looked at your code, it seems you're using an old unmaintained version of cpymad!

I recommend you use the current version, available in this repo and also on PyPI:

pip install cpymad

With new cpymad, you will have to do some minor replacements:

# OLD SYNTAX:
from cern import cpymad
m = cpymad.start_madx()
m.twiss('bts', fname='twissfile.txt', ...)

becomes

from cpymad import Madx
m = Madx(command_log="commands.madx")
m.twiss('bts', file='twissfile.txt')

This example also incorporates the possibility to forward all executed MAD-X commands to a text file. I recommend doing this in case of trouble, so you can check if the generated MAD-X file can be executed without cpymad and whether incorrect commands have been generated.

Best,
Thomas

from cpymad.

mina-acc avatar mina-acc commented on July 29, 2024

Hi,
I deleted the post to check the code again and be sure that the output is the same as I reported before. Thanks for your quick response in advance! :)
It seems to work! The MAD-X commands text file was the best source to find the bugs in my code.
Thanks for being so helpful.

Regards,
Mina

from cpymad.

coldfix avatar coldfix commented on July 29, 2024

Okay, great. I'll close then.

from cpymad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.