Comments (4)
Hi @T-Nicholls. Are you sure that:
- you use the last version of AT
- you call the python
get_mcf
withddp=1.E-6
, which is what Matlab uses - you run on the same machine
I get an agreement with 15 digits for dp=0, and with 10 digits for dp!= 0
0.00 8.506669244225616e-05
0.01 8.820785279e-05
-0.01 8.2317973893e-05
Which agrees with your Matlab results !!!
(running on MacOSX 10.14, python 2.7 and 3.6, Matlab R2018a)
from at.
@lfarv my apologies, a change I made caused the difference.
Ok, I have found the source of the problem:
- I was using a branch where the
py_hmba
fixture had a scope session, i.e.@pytest.fixture(scope='session') def py_hmba(): return Lattice(load_mat(utils.hmba_ring, key='RING'), keep_all=True)
- We turn on radiation in the lattice in
test_ohmi_envelope
:# Python call py_lattice.radiation_on() py_emit0, py_beamdata, py_emit = physics.ohmi_envelope(py_lattice, refpts)
- The same lattice is used and the radiation is not turned off. Adding a line to turn it off fixes the issue:
# test momentum compaction factor py_lattice.radiation_off() py_mcf = py_lattice.get_mcf(dp, ddp=1.E-6) # Matlab uses ddp=1.E-6
Should we be ensuring the radiation state of the lattice, as we do for linopt
and ohmi_envelope
, or is get_mcf
designed to be run in both states and the difference to be expected?
from at.
get_mcf
is based on find_orbit4
. Strictly speaking, this is valid if there is no longitudinal motion (radiation off), though many people use it in any condition (as you could see, the results are not very different). The get_mcf
function works for any sequence of elements and cannot be protected, but the get_mcf
method of the Lattice
object could be, as it is done for linopt
.
from at.
@lfarv thank you for the clarification, I will protect the get_mcf
method on Lattice
then.
from at.
Related Issues (20)
- at.fast_ring functions need to be cleaned up HOT 4
- haissinski module needs to be rewritten
- Two pass methods are not working in Matlab HOT 1
- patpass number of cpu in a pool HOT 3
- Frequency map with PyNAFF and patpass HOT 1
- wrong tune in atplot when lattice contains an IdTablePass (matlab) HOT 9
- lattice_pass modifies initial coordinates HOT 2
- lattice operators: function and documentation HOT 1
- pyat get_lifetime modifies the given refpts HOT 8
- atreforbit and rotation errors HOT 1
- Merging pull requests HOT 8
- AT does not compile with OpenMP=1 HOT 6
- atreduce transforms rbend in sbend HOT 3
- regular expression instead of fnmatch? HOT 15
- Observables and variables HOT 2
- get_unit32_index , get_bool_index names? HOT 12
- include fast_ring generation from a list of machine parameters (tunes, chromaticities, ac, U0, etc) HOT 5
- plot_beta help HOT 1
- plot_beta does not seem to have an option to display magnets names/indexes HOT 2
- modification to get_lifetime HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from at.