Conversation
|
My suggestion was certainly a bit of a hack, as |
|
I wonder about something like this? if tail:
# is pset parameter - get parameter object from its task
p = p.get().getParObject(tail)
try:
p = self.getParObject(p.name)
except KeyError:
p = copy.deepcopy(p)
self.addParam(p)Some thoughts:
|
|
Ideally, we'd have a test for this, of course (I'd need to look at that later if you want me to add one). Sorry, I messed up slightly above (the deepcopy was a last-minute addition); let me just fix that [done]. |
|
I think the parameter is guaranteed to exist because it was added during init by So, I added a new commit (and set you as the author to both to make clear who gets the merits :-) ). Ofcourse a test would be great so that we can catch a regression if the needs to be changed again. Do you mind to be added as maintainer so that you could modify the PR yourself? Hidden thought is that it is better to have more people with access to the repository to reduce the bus factor 🚌 |
|
Sure, thank you! |
|
@jehturner I tried to formulate a few tests for the PyRAF parameter handling. However, surprisingly for the these tests pass on the main branch but fail in this PR. The test uses a test task, showparams, which accepts one param for int, float, str, bool and ParameterSet, and just prints all the parameters: I would expect that setting In CL, it works as expected. |
|
Digging a bit deeper with the SPP variant: The SPP code psetpar = clopset("psetpar")
call clgpsets (psetpar, "psstrpar", psstrpar, SZ_LINE)
psintpar = clgpseti (psetpar, "psintpar")doesn't work with this PR. This is however the documented way. gfit1d goes a different way: call clgstr ("psstrpar", psstrpar, SZ_LINE)
psintpar = clgeti ("psintpar")which works with this PR. Both work with IRAF CL. I don't know whether the sequence in What also does not work in both cases is i.e. replacing the complete parameter set with another one. This also works for the CL variant. |
|
Ugh. I don't have much insight into this off the top of my head, but will have another look. Presumably this usage was also working in PyRAF 2.2.1 & previously, if it works in the main branch, so the regression might cause real-World problems. While I was using |
Also, this does not try to re-establish a broken link between the main list and the pset; avoiding potential problems with that. The try..excep clause is added for more robustness; the parameter should already exist in the main list.
|
This issue arises because the code manipulates pset parameters both at the top-level and under the pset. I'm a bit fuzzy on the intention & the convoluted mechanics of all this, but it seems clear why my proposed change solves the Before this PR, the code was setting the the Lines 1036 to 1041 in 9607ad7 My change instead sets the Comments in the code suggest that each pset parameter was originally linked by reference to the top-level one, but that link was severed at some point due to architectural problems, leaving these duplicate copies (only one of which has been getting set properly). Adding a second |
|
I added the I also completed the tests for parameter setting, and almost everything works now. Whow! There seems to be one more issue: In IRAF CL it is possible to set all values on one parameter set with the values of another one. With the testpkg: This does not work under PyRAF, and that's why the tests currently fail. However, I have no idea how relevant this is -- if Gemini doesn't use this, I would suggest to just mark these failures with xfail for the moment. I could imagine that this never worked in PyRAF (I could dig out old versions to check through). |
e4e337e to
50a12a1
Compare
|
That case seems to be working for me! 😵💫 Thank you for adding some proper tests 🙏. I was studying this a bit more and the issue was basically that the The most consistent fix would therefore be to have the PS. |
|
I am not sure I can follow... |
|
I just checked out version 2.1.15 (with Python 3) which was the last STScI one. It turns out that it has exactly the same failures as the current main branch:
So we are digging in a really old problem here, if this is a regression at all. |
|
Yes, these are really old problems, but the first one appears to cause a long-standing problem with error propagation for certain instrument modes in Gemini IRAF, which Kathleen only recently identified. I'm not aware of any specific failure on our side related to the second bullet, but indeed it should be working. I think I have some idea what's going on with that (it looked to me like the pset parameter's value is getting changed without reloading the actual |
|
I merged this PR and plan to create a new release. I think @KathleenLabrie mentioned that there are some issues with the 64 bit compatibility of PyRAF compared to IRAF CL. Shall these be resolved before a new release? Then it would be good to have them raised asap. |
|
Thanks, I'll re-run all our tests on this then. One slight concern is that there are code comments suggesting that there could be problems with naming collisions between pset parameter names and local variables in CL scripts (seems unwise), but we'll see what actually happens. Kathleen found a GKI-related issue (in addition to this one) that it looked like you might already have fixed, but I have not yet been able to reproduce it with any version of PyRAF. I had asked her for more input, but she has been quite wrapped up with the next DRAGONS release, given our constraints. I can mention that it may miss a release if not identified soon. |
This implements the suggestion by @jehturner in #192 to explicitly propagate Pset arguments to the main dictionary.
Closes: #192