imaccess specification
Jason Quinn wrote on Dec 18, 2008
Where can I read the language specification for imaccess? I have a situation where I added some bad-pixel mask support to a script. Since there are now two extensions corresponding to each image filename (one for a fits file and the other for the pl mask), the logic of the script is now no longer correct because it returns "no" when I expect it to return yes. Here is a snippet showing the problem.
The workaround solution would be for me to just use some other name for the bad-pixel mask. But knowing exactly how imaccess produces its output would be useful. There doesn't appear to be a help page like with access.
If I had to speculate on how the behavior should work, I would guess that, when the extension is left off the filename, imaccess should always print "yes" or "no" depending on the existence of a file using the imtype value for the file extension. If imaccess also considers other known image extensions, it just makes the logic of the program too messy when there exists several images with the same prefix but multiple extensions.
Jason
PS The imaccess function doesn't appear in the help list for the language package ("help language").
language> touch jason.fits
language> print(imaccess("jason.fits")
yes
language> print(imaccess("jason"))
yes
language> touch jason.pl
language> print(imaccess("jason"))
no
The workaround solution would be for me to just use some other name for the bad-pixel mask. But knowing exactly how imaccess produces its output would be useful. There doesn't appear to be a help page like with access.
If I had to speculate on how the behavior should work, I would guess that, when the extension is left off the filename, imaccess should always print "yes" or "no" depending on the existence of a file using the imtype value for the file extension. If imaccess also considers other known image extensions, it just makes the logic of the program too messy when there exists several images with the same prefix but multiple extensions.
Jason
PS The imaccess function doesn't appear in the help list for the language package ("help language").
Mike Fitzpatrick wrote on Dec 18, 2008
Hi Jason,
I just added a help page for the next release. The function is supposed to mimic the same function in the SPP code, however the CL imaccess() is a boolean and the SPP version is an integer function. For the SPP code, the func returns YES/NO/ERR where ERR is the return value when the image name may be ambiguous (e.g. a foo.fits and foo.pl in the same directory). As currently implemented, a 'yes' is returned by the CL function only when the image exists and is unambiguous, so by supplying the extension you should also be able to get the expected answer.
I'm not sure whether the behavior should be changed or not since an ambiguous filename is an error that may be triggered later, so the thinking is that having imaccess() fail provides more control over your error checking. I can tell you how to easily change this if you're interested.
Cheers,
-Mike
I just added a help page for the next release. The function is supposed to mimic the same function in the SPP code, however the CL imaccess() is a boolean and the SPP version is an integer function. For the SPP code, the func returns YES/NO/ERR where ERR is the return value when the image name may be ambiguous (e.g. a foo.fits and foo.pl in the same directory). As currently implemented, a 'yes' is returned by the CL function only when the image exists and is unambiguous, so by supplying the extension you should also be able to get the expected answer.
I'm not sure whether the behavior should be changed or not since an ambiguous filename is an error that may be triggered later, so the thinking is that having imaccess() fail provides more control over your error checking. I can tell you how to easily change this if you're interested.
Cheers,
-Mike
Last post on Dec 18, 2008