error when running xdimsum tasks in PyRAF
Chris Lidman wrote on May 27, 2010
I've been using xdimsum to process near-IR data successfully for a
number of years now. Until recently, I've been running xdimsum tasks via
the cl command line. I'd now like to switch to PyRAF; however, I am
running into problems.
An example is given below.
xfirstpass(inlist='@xfirstpass_357728_CHIP1.list',referen='HAWKI_IMG_OBS_AutoJitter237_0001_CHIP1',output='test',expmap='.exp',statsec='[200:1800,200:1800]',nmean='11',nskymin='8',nreject='2',bpmask='bad_CHIP1.pl',badpixu='yes',mkshift='yes',chkshif='no',shiftli='test.offset')
start xfirstpass
Traceback (innermost last):
File "<console>", line 1, in <module>
File "<CL script xdimsum.xfirstpass>", line 73, in xfirstpass
iraf.time('')
TypeError: time() takes no arguments (1 given)
By examining the xfirstpass cl script, I can see where the error comes from
and can fix it. However, one soon encounters other errors, which leads
me to suspect that xdimsum does not work in the PyRAF environment.
I'm using IRAF version 2.14
Chris.
number of years now. Until recently, I've been running xdimsum tasks via
the cl command line. I'd now like to switch to PyRAF; however, I am
running into problems.
An example is given below.
xfirstpass(inlist='@xfirstpass_357728_CHIP1.list',referen='HAWKI_IMG_OBS_AutoJitter237_0001_CHIP1',output='test',expmap='.exp',statsec='[200:1800,200:1800]',nmean='11',nskymin='8',nreject='2',bpmask='bad_CHIP1.pl',badpixu='yes',mkshift='yes',chkshif='no',shiftli='test.offset')
start xfirstpass
Traceback (innermost last):
File "<console>", line 1, in <module>
File "<CL script xdimsum.xfirstpass>", line 73, in xfirstpass
iraf.time('')
TypeError: time() takes no arguments (1 given)
By examining the xfirstpass cl script, I can see where the error comes from
and can fix it. However, one soon encounters other errors, which leads
me to suspect that xdimsum does not work in the PyRAF environment.
I'm using IRAF version 2.14
Chris.
Mike Fitzpatrick wrote on May 27, 2010
Right, in XDIMSUM the TIME task is actually a CL builtin command but it is used repeatedly in the package as
You'll need to change each instance in the various tasks. The package author apparently isn't a pyraf user but this is the first report we've had of any incompatability.
time ("")You'll need to change each instance in the various tasks. The package author apparently isn't a pyraf user but this is the first report we've had of any incompatability.
Chris Lidman wrote on May 27, 2010
Thanks for the quick reply.
In addition to the task failing when the time is called (which I could fix relatively
easily), the task fails when it tries to access task parameters, such as the parameter "nimages" in
the task "section". It seems that Pyraf is interpreting "nimages" as an attribute to the string "sections".
xfirstpass(inlist='@xfirstpass_357728_CHIP1.list',referen='HAWKI_IMG_OBS_AutoJitter237_0001_CHIP1',output='test',expmap='.exp',statsec='[200:1800,200:1800]',nmean='11',nskymin='8',nreject='2',bpmask='bad_CHIP1.pl',badpixu='yes',mkshift='yes',chkshif='no',shiftli='test.offset')
start xfirstpass
Fri 12:24:48 28-May-2010
Traceback (innermost last):
File "<console>", line 1, in <module>
File "<CL script xdimsum.xfirstpass>", line 80, in xfirstpass
Vars.nin = int(Vars.sections.nimages)
AttributeError: 'str' object has no attribute 'nimages'
Is there a quick fix?
Since much of the code in xdimsum is written in cl, there may be other problems down the line. Generically speaking, should I expect cl code to work when called via the Pyraf command line, or am I expecting too much.
In addition to the task failing when the time is called (which I could fix relatively
easily), the task fails when it tries to access task parameters, such as the parameter "nimages" in
the task "section". It seems that Pyraf is interpreting "nimages" as an attribute to the string "sections".
xfirstpass(inlist='@xfirstpass_357728_CHIP1.list',referen='HAWKI_IMG_OBS_AutoJitter237_0001_CHIP1',output='test',expmap='.exp',statsec='[200:1800,200:1800]',nmean='11',nskymin='8',nreject='2',bpmask='bad_CHIP1.pl',badpixu='yes',mkshift='yes',chkshif='no',shiftli='test.offset')
start xfirstpass
Fri 12:24:48 28-May-2010
Traceback (innermost last):
File "<console>", line 1, in <module>
File "<CL script xdimsum.xfirstpass>", line 80, in xfirstpass
Vars.nin = int(Vars.sections.nimages)
AttributeError: 'str' object has no attribute 'nimages'
Is there a quick fix?
Since much of the code in xdimsum is written in cl, there may be other problems down the line. Generically speaking, should I expect cl code to work when called via the Pyraf command line, or am I expecting too much.
Mike Fitzpatrick wrote on May 27, 2010
In this case I think the problem is a bug in PyRAF. The code in question is something like
which says to set the script variable 'nin' to the value of the SECTIONS task 'nimages' parameter, this is perfectly legal CL syntax. The confusion I think is coming from the fact that the XFIRSTPASS script also defines 'sections' as a hidden string param, disambiguating the task from the parameter in the script should fix it.
I don't think pyraf ever claimed to be 100% compatible with CL syntax and there *are* known (and unknown) issues. (Personally, though, I do have some issues about some claims that *have* been made, but that's another thread). In general, we make NO claims that any and all scripts will/should run under pyraf, problems will need to be dealt with as they arise.
nin = sections.nimageswhich says to set the script variable 'nin' to the value of the SECTIONS task 'nimages' parameter, this is perfectly legal CL syntax. The confusion I think is coming from the fact that the XFIRSTPASS script also defines 'sections' as a hidden string param, disambiguating the task from the parameter in the script should fix it.
Since much of the code in xdimsum is written in cl, there may be other problems down the line.
Generically speaking, should I expect cl code to work when called via the Pyraf command line, or am
I expecting too much.
I don't think pyraf ever claimed to be 100% compatible with CL syntax and there *are* known (and unknown) issues. (Personally, though, I do have some issues about some claims that *have* been made, but that's another thread). In general, we make NO claims that any and all scripts will/should run under pyraf, problems will need to be dealt with as they arise.
Chris Lidman wrote on May 27, 2010
Thank you for the finding the solution. :D
I had to edit several of the scripts (logged below), and in doing so have found some bugs that were not part of the original thread.
I have not checked all the scripts, just the ones that I use.
Thanks again.
Chris.
diff xfirstpass.cl xfirstpass.cl.orig
51c51
< string seccorn {".corners", prompt="The output sections list file or suffix"}
---
> string sections {".corners", prompt="The output sections list file or suffix"}
74c74
< time()
---
> time("")
99c99
< tsections = seccorn
---
> tsections = sections
180c180
< time()
---
> time("")
199c199
< time()
---
> time("")
214c214
< time()
---
> time("")
233c233
< time()
---
> time("")
280c280
< time()
---
> time("")
308c308
< time()
---
> time("")
diff maskdereg.cl maskdereg.cl.orig
5c5
< procedure maskdereg (omask, seccor, outlist)
---
> procedure maskdereg (omask, sections, outlist)
12c12
< string seccor {prompt="The input sections file written by xnregistar"}
---
> string sections {prompt="The input sections file written by xnregistar"}
33c33
< tsections = seccor
---
> tsections = sections
diff makemask.cl makemask.cl.orig
198c198
< zloreject=INDEF, zhireject=INDEF, unmap+,
---
> zloreject=INDEF, zloreject=INDEF, unmap+,
diff xmskcombine.cl xmskcombine.cl.orig
140c140
< hedit (img, "REJMASK", tbpmask, add+, delete-, verify-,
---
> hedit (img, "REJMASK", tbpmask, ,add+, delete-, verify-,
276,277c276,277
< imexpr ("repl(a,b)", rmaskname, "1", ixdim, dims=ixdim//"."//iydim,
< intype="auto", outtype="auto",
---
> imexpr ("repl(a,b)", rmaskname, "1", ixdim, dims="auto",
> intype="auto", outtype="auto", dims=ixdim//","//iydim,
280d279
< print("Here I am JH")
305c304
< hedit (img, "REJMASK", rmaskname, add+, delete-, verify-,
---
> hedit (img, "REJMASK", rmaskname, ,add+, delete-, verify-,
diff xnregistar.cl xnregistar.cl.orig
3c3
< procedure xnregistar (inlist, rmasks, output, expmap, seccor)
---
> procedure xnregistar (inlist, rmasks, output, expmap, sections)
9c9
< string seccor {"", prompt="The optional output sections file"}
---
> string sections {"", prompt="The optional output sections file"}
60c60
< tsections = seccor
---
> tsections = sections
392c392
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-, show-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-, show-,
407c407
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-, show-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-, show-,
424c424
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-,
434c434
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-,
442c442
< hedit (timg, "BPM", rmskname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rmskname, ,add+, delete-, verify-,
diff xmaskpass.cl xmaskpass.cl.orig
14c14
< procedure xmaskpass (input, inexpmap, seccorn, output, outexpmap)
---
> procedure xmaskpass (input, inexpmap, sections, output, outexpmap)
24c24
< string seccorn {"", prompt="The input first pass sections file"}
---
> string sections {"", prompt="The input first pass sections file"}
99c99
< time ()
---
> time ("")
113c113
< usections = seccorn
---
> usections = sections
332c332
< time ()
---
> time ("")
378c378
< time ()
---
> time ("")
388c388
< time ()
---
> time ("")
424c424
< time ()
---
> time ("")
434c434
< time ()
---
> time ("")
458c458
< time ()
---
> time ("")
479c479
< time ()
---
> time ("")
500c500
< time ()
---
> time ("")
528c528
< time ()
---
> time ("")
576c576
< time ()
---
> time ("")
I had to edit several of the scripts (logged below), and in doing so have found some bugs that were not part of the original thread.
I have not checked all the scripts, just the ones that I use.
Thanks again.
Chris.
diff xfirstpass.cl xfirstpass.cl.orig
51c51
< string seccorn {".corners", prompt="The output sections list file or suffix"}
---
> string sections {".corners", prompt="The output sections list file or suffix"}
74c74
< time()
---
> time("")
99c99
< tsections = seccorn
---
> tsections = sections
180c180
< time()
---
> time("")
199c199
< time()
---
> time("")
214c214
< time()
---
> time("")
233c233
< time()
---
> time("")
280c280
< time()
---
> time("")
308c308
< time()
---
> time("")
diff maskdereg.cl maskdereg.cl.orig
5c5
< procedure maskdereg (omask, seccor, outlist)
---
> procedure maskdereg (omask, sections, outlist)
12c12
< string seccor {prompt="The input sections file written by xnregistar"}
---
> string sections {prompt="The input sections file written by xnregistar"}
33c33
< tsections = seccor
---
> tsections = sections
diff makemask.cl makemask.cl.orig
198c198
< zloreject=INDEF, zhireject=INDEF, unmap+,
---
> zloreject=INDEF, zloreject=INDEF, unmap+,
diff xmskcombine.cl xmskcombine.cl.orig
140c140
< hedit (img, "REJMASK", tbpmask, add+, delete-, verify-,
---
> hedit (img, "REJMASK", tbpmask, ,add+, delete-, verify-,
276,277c276,277
< imexpr ("repl(a,b)", rmaskname, "1", ixdim, dims=ixdim//"."//iydim,
< intype="auto", outtype="auto",
---
> imexpr ("repl(a,b)", rmaskname, "1", ixdim, dims="auto",
> intype="auto", outtype="auto", dims=ixdim//","//iydim,
280d279
< print("Here I am JH")
305c304
< hedit (img, "REJMASK", rmaskname, add+, delete-, verify-,
---
> hedit (img, "REJMASK", rmaskname, ,add+, delete-, verify-,
diff xnregistar.cl xnregistar.cl.orig
3c3
< procedure xnregistar (inlist, rmasks, output, expmap, seccor)
---
> procedure xnregistar (inlist, rmasks, output, expmap, sections)
9c9
< string seccor {"", prompt="The optional output sections file"}
---
> string sections {"", prompt="The optional output sections file"}
60c60
< tsections = seccor
---
> tsections = sections
392c392
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-, show-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-, show-,
407c407
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-, show-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-, show-,
424c424
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-,
434c434
< hedit (timg, "BPM", rtmpname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rtmpname, ,add+, delete-, verify-,
442c442
< hedit (timg, "BPM", rmskname ,add+, delete-, verify-,
---
> hedit (timg, "BPM", rmskname, ,add+, delete-, verify-,
diff xmaskpass.cl xmaskpass.cl.orig
14c14
< procedure xmaskpass (input, inexpmap, seccorn, output, outexpmap)
---
> procedure xmaskpass (input, inexpmap, sections, output, outexpmap)
24c24
< string seccorn {"", prompt="The input first pass sections file"}
---
> string sections {"", prompt="The input first pass sections file"}
99c99
< time ()
---
> time ("")
113c113
< usections = seccorn
---
> usections = sections
332c332
< time ()
---
> time ("")
378c378
< time ()
---
> time ("")
388c388
< time ()
---
> time ("")
424c424
< time ()
---
> time ("")
434c434
< time ()
---
> time ("")
458c458
< time ()
---
> time ("")
479c479
< time ()
---
> time ("")
500c500
< time ()
---
> time ("")
528c528
< time ()
---
> time ("")
576c576
< time ()
---
> time ("")
Last post on May 27, 2010