iraf
iraf copied to clipboard
pvector script cant append
This is copied from iraf.net#1469856 by JCP:
Dear IRAF gurus,
I have a script which repeatedly calls
pvector
and is supposed to put severalpvector
plots in one output FITS file. It works fine on one of my computers (a laptop), but fails on several other computers. Each computer is running Linux Mint 18.0 (or 18.3) and each has IRAF version 2.16.1.I want my students to be able to use the script without me so it's been driving me nuts.
Here are the first 3 lines of the script (only two lines are needed to reproduce failure):
pvector N7727Rbsr.fits xc=1090.91 yc=1067.62 width=1 theta=235 length=140 vec_out=RbsrPVs2 out_typ=image pvector N7727Rbsr.fits xc=1088.91 yc=1067.62 width=1 theta=235 length=140 vec_out=RbsrPVs2 out_typ=image pvector N7727Rbsr.fits xc=1089.91 yc=1067.62 width=1 theta=235 length=140 vec_out=RbsrPVs2 out_typ=image
Here is the behavior when it fails:
ecl> cl < pveesimgR.cl ERROR: Error opening output image. called as: `cl ()'
It does create a FITS file, but it only contains one, 1-D image instead of multiple FITS extensions.
And when it succeeds (on the laptop), it has no error message and produces exactly the kind of multi-extension FITS file I'm expecting. I have tried the script with
append=yes
on each line and it doesn't help. I also useepar
to setappend=yes
in thepvector
pars.I suspect the issue lies with cfitsio or some other libraries but I don't know. Any ideas?
thanks for any help, Jason
I can confirm this: On the original 2.16.1, when I run the first two lines interactively, I get no error:
vocl> pvector dev$pix xc=250 yc=250 theta=235 vec_out=pvec out_typ=image
vocl> pvector dev$pix xc=250 yc=251 theta=235 vec_out=pvec out_typ=image
vocl>
However, when running the test script with the following test:
# plot - Plot package
## pvector - Plot an arbitrary vector in a 2D image
This is a test for [#42](https://github.com/iraf-community/iraf/issues/42)
(originally reported ad [iraf.net](http://iraf.net/forum/viewtopic.php?showtopic=1469841)
```
cl> plot
cl> pvector dev$pix xc=250 yc=250 theta=235 vec_out=pvec out_typ=image
cl> pvector dev$pix xc=250 yc=251 theta=235 vec_out=pvec out_typ=image
```
I get the same error as reported as above. This also happens when I run these lines with the snapshot release (both interactively and non-interactively). The major difference then is the init script.
The output of the first Fits HDU is identical in both cases, so the problem is the re-opening.
There seems to be the "append" mode flag getting lost; the opening fails here:
if (FKS_APPEND(fit) != YES && FKS_OVERWRITE(fit) != YES) {
if (!fnullfile (IM_HDRFILE(im)))
call syserrs (SYS_IKICLOB, IM_HDRFILE(im))
}
FKS_APPEND(fit)
is however several times changed, so this may be difficult to debug...
Horrible code. Why didn't they use (or switch to) cfitsio here?