Code Monkey home page Code Monkey logo

Comments (2)

swhite2401 avatar swhite2401 commented on August 21, 2024

Hello @lmalina ,

r_in is a python object and is modified in place just as it is done in the underlying C code. This is not unexpected, however documentation could be improved.

In the short term to fix it you may use:
T = lattice_pass(SC.RING, Zin.copy(), nTurns, refOrds, keep_lattice=False)

On the longer term, we may add the flag as you suggest to use a copy of r_in or not but changing the output format is strongly discouraged as it may impact other users codes and internal AT functions.

However, there is a need to refurbish the tracking function in my opinion right now it is a bit spread out between lattice_pass, patpass with variable outputs whether you activate losses or not, etc...
A good clean up would help and your request could be integrated.

@lfarv, what do you think? I would like to suggest introducing a new general tracking function (keep the old ones for backward compatibility) and integrate to the output a structured array as is done in get_optics that would allow the function to evolve and integrate request as this one without changing its interface.

from at.

lfarv avatar lfarv commented on August 21, 2024

@lmalina and @swhite2401 : lattice_pass is such for efficiency reason, and as @swhite2401 mentioned, we should not change its interface because it's the basic tracking function used in many places. The documentation clearly states that r_in is modified in-place. This allows for instance to perform a long tracking by repeatedly calling lattice_pass for one or a few turns: this way, you can monitor the tracking turn-by-turn, without needing a huge space for the output of the many turns. By putting refpts=[], you even suppress all output ! And this avoids any data copy.

But I agree that a new function on top of lattice_pass could offer a more convenient interface, wile keeping lattice_pass where performance is critical.

from at.

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.