Comments (9)
Post full minimal example.
Specify set value argument as number, not as string.
from cpymad.
Ah you just took the example from set_value docstring and executed it without even defining a quadrupole element named R1QS1, right? ...
Sorry for being rude, but you are really asking for a lot of stuff, that should be obvious if you had some knowledge about python + madx. If you don't have that, I don't see any reason for you to use this library, and you really should start using plain MAD-X first without cpymad / madgui.
from cpymad.
Hi,
still don't work.
In [46]: madx.set_value('R1QS1->K1', 42)
In [47]: madx.evaluate('R1QS1->K1')
Out[47]:
0.0

from cpymad.
Still didn't post a full example.
from cpymad.
I have learned madx and python for 3 months, but I don't know a lot of cpymad. So, if I trouble you very much, very sorry for that.
I really want to understand cpymad.
from cpymad.
sorry, it is just a simple example from set_value docstring.
from cpymad.
Okay, then please focus more on providing full information, i.e. all the code/files that is needed to reproduce your problem. In this particular case, the example should start with from cpymad.madx import Madx
and end with madx.evaluate(...)
. I don't want to ask you back for all the necessary information everytime.
Initially, I thought, you were working on some sequence, which you didn't post. Now I have to assume, you are executing this without a sequence. But this is still just guessing.
This specific example shows how to set the K1
attribute of a quadrupole named R1QS1
. If you want to set a constant value, just use an identifier name, e.g.:
madx.set_value('EULER', 2.718)
madx.evaluate('EULER')
from cpymad.
If replace R1QS1->K1
with R1QS1
, it works. Why?
In [48]: madx.set_value('R1QS1', 42)
In [49]: madx.evaluate('R1QS1')
Out[49]:
42.0
from cpymad.
From now on, please follow the guidelines here https://github.com/hibtc/cpymad#reporting-issues and you will be fine. Otherwise I will limit my responses to you to only one in a few days, so make sure that your questions can be fully understood without asking back.
from cpymad.
Related Issues (20)
- Element redefinition and twiss HOT 5
- Add support to release Linux AArch64 wheels HOT 7
- EMIT module output is displayed with "delay" HOT 2
- TWISS: no beta0 found HOT 1
- New functions
- Can't run madx instance. TypeError HOT 5
- Build error on Win10 Anaconda 2022.5 HOT 11
- What is the preferred way to retrieve the command (string) with which an Element was created? HOT 3
- libmadx error installing on M1/M2 Apple Silicon HOT 7
- Pitfalls on compiling libmadx/cpymad on Linux HOT 5
- Proposal: specialize tables HOT 8
- Wheel for M1 apple? HOT 2
- Python 3.11 Wheels HOT 4
- Error building cpymad on M1 Apple Silicon - "-march=core2" not supported HOT 5
- call does not work when double slash is present in file path HOT 2
- access default beam HOT 1
- ValueError: TypeError: write() argument must be str HOT 4
- Python 3.12 wheels HOT 2
- Differences in cpymad `table.twiss` and madx `table(twiss, X, X)` when running `use` HOT 7
- Twiss at certain positions HOT 13
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 cpymad.