-
Notifications
You must be signed in to change notification settings - Fork 2
Allow floating point values #34
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
base: main
Are you sure you want to change the base?
Conversation
All constants will be floats
|
I made a change to wavegen.py which allows constants to print as floats. All constants will now be floats. If that is not acceptable then we'll need another solution. |
| outfilehandle.write("[CONSTANT#]\n") | ||
| for const in Constants: | ||
| outfilehandle.write("%s=%d\n" % (const, Constants[const])) | ||
| outfilehandle.write("%s=%f\n" % (const, Constants[const])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what you were missing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this can't be an f-string?
astronomerdave
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All constants will now be floats. If that is not acceptable then we'll need another solution.
|
constants are allowed to be integers by the archon, but I don't really know why you'd use it that way so I don't see a problem here. We also need an implementation allowing a constant to appear as either a voltage or a slew rate in any SET statement, and allowing same to appear as the named slew rate in driver module definitions. |
|
@weatherhead99: We have I think the capability that you want. You can define "constants" in the .def file such as |
|
Hi @astronomerdave I'm well aware we can do that. But it doesn't provide the functionality I want, that's the whole reason for the issue. Say I have a constant defined at the preprocessor level. In order to programmatically change the value of that, I need to (from my program), sed the WDL source code, shell out to the WDL compiler, reload the whole acf into archon. This is acceptable for e.g. slew rates. But not for e.g. parallel clock levels. If I have them defined as a "constant" within the archon itself, for excample say I have CONSTANT1=LLEL_HIGH=9.0 or similar. And in the timing script somewhere I have a state which references "LLEL_HIGH". I then just need to overwrite a single archon config line, and do an "APPLYTIMING" to have the value of that voltage adjusted. Which is a trivial operation from a driver program. |
|
let's say for example I want to run a test where I take 3 images at each of 30 different parallel clock settings... |
|
p.s. I believe I'm using all the functionality available (and quite a bit more e.g. using GPP's #exec directive to shell out to an externnal calculator to calculate the values for slew rates.... if I'm missing something here please do point it out, trake a look at https://github.com/CaltechOpticalObservatories/wdlfiles/blob/deimos_coincident/src/deimos/deimos.seq and see what you think, it can likely be done a lot more elegantly |
OK, I understand now. |
|
@prkrtg was this supposed to be working? I can define a const but not use it. |
|
seems to almost but not quite work. Here is the test case I tried first: gives the following error: so I added a semicolon, and tried this test case: which gives: note that I ran this through the CLI tool I made in my branch, rather than directly into |
|
here is a test case which I believe shows all relevant uses of constants that we care about |
503513d to
f22a3e5
Compare
|
so this does appear now to allow me to define constants and use them in the places I expect. However, it breaks previously used module definitions, in particular the XVBIAS definition. The following code was valid on my branch: but now breaks with a parsing error on this PR branch |
|
(BTW I actually have no idea why the syntax is like that maybe @astronomerdave can shed some light. It would make as much sense to me if it was spelled as
|
Other than "that's the way it is", I don't have any explanation as to why |
|
I did check by the way and it gives me the same parsing error if I write e.g.
so that is not actually the issue with this particular situation |
|
this now appears to work for everything I need in the short term. Maybe we should document the fact that const definitions cannot appear in a .mod file, and only in .seq file (and .waveform file???) |
weatherhead99
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all LGTM, tested on my branch building current DEIMOS waveform definitions and all appears working as intended. Suggest merging this into main as it shouldn't break anything existing that wasn't already broken.
| outfilehandle.write("[CONSTANT#]\n") | ||
| for const in Constants: | ||
| outfilehandle.write("%s=%d\n" % (const, Constants[const])) | ||
| outfilehandle.write("%s=%f\n" % (const, Constants[const])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this can't be an f-string?
No description provided.