Covert fits file into imh using rfits
Nick Devereux wrote on Nov 11, 2009
Hi,
I just re-installed PyRaf following a hard drive failure.
Everything seemed to be going swimmingly until I tried to do an rfits - it complained
that it can not open a pixel file.
I got the following error message when trying to convert
a fits spectrum that I created using the IRAF task apall into a an IRAF image
(so I could then look at it in specfit).
Task rfits is running...
File: M84ext5.5sc_sx1.fits -> M84ext5.5sc_sx1.imh MSCOMB175GY[1/1] size=1201
bitpix=-32 scaling=none pixtype=real
Warning: Cannot open pixel file (M84ext5.5sc_sx1.imh)
I can plot the fits file in splot and the spectrum looks fine.
Any ideas?
thanks in anticipation
Nick
I just re-installed PyRaf following a hard drive failure.
Everything seemed to be going swimmingly until I tried to do an rfits - it complained
that it can not open a pixel file.
I got the following error message when trying to convert
a fits spectrum that I created using the IRAF task apall into a an IRAF image
(so I could then look at it in specfit).
Task rfits is running...
File: M84ext5.5sc_sx1.fits -> M84ext5.5sc_sx1.imh MSCOMB175GY[1/1] size=1201
bitpix=-32 scaling=none pixtype=real
Warning: Cannot open pixel file (M84ext5.5sc_sx1.imh)
I can plot the fits file in splot and the spectrum looks fine.
Any ideas?
thanks in anticipation
Nick
Mike Fitzpatrick wrote on Nov 11, 2009
First, you can use the FITS files directly as you point out. Most likely, you just need to do a MKIRAF to recreate your login.cl file, this is where the 'imdir' environment variable saying where the .pix files are stored in written.
If you had a hard drive failure then be sure you've also rerun the IRAF install script which sets things like the global 'imdir' and creates links to various commands. If the disk was restored but with a different partitioning system, the old imdir may no longer be valid and a MKIRAF will fix it.
-Mike
If you had a hard drive failure then be sure you've also rerun the IRAF install script which sets things like the global 'imdir' and creates links to various commands. If the disk was restored but with a different partitioning system, the old imdir may no longer be valid and a MKIRAF will fix it.
-Mike
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
unfortunately the mkiraf command did not help
I get the same error message:
Task rfits is running...
File: M84ext5.5sc_sx1.fits -> M84ext5.5sc_sx1.imh MSCOMB175GY[1/1] size=1201
bitpix=-32 scaling=none pixtype=real
Warning: Cannot open pixel file (M84ext5.5sc_sx1.imh)
Mike, just to get you in the picture here, I reinstalled PyRaf on a new disk,
the old one is completey gone.
The PyRaf install went fine and I have been using it for a few days now
with no issues until today.
I'm a bit confused. I want to use specfit, but specfit requires a .imh file.
I extracted a spectrum using APALL and it created a .fits file, I can't seem
to make it creat a .imh file if the input file is fits.
So, thats how I ended up trying to use rfits to convert the fits to imh.
I followed your suggestion of doing a mkiraf in my home directory.
This did not change anything as I already said. Besides, the login.cl
file is automatically created when I install PyRaf and I don't remember
having to type MKIRAF the last time I installed PyRaf.
But now I have 2 login.cl files, one in my home directory (created by the
most recent MKIRAF command) and the other one is in my iraf directory
created a few days ago when I installed PyRaf.
Can you please help me !
thanks
Nick
unfortunately the mkiraf command did not help
I get the same error message:
Task rfits is running...
File: M84ext5.5sc_sx1.fits -> M84ext5.5sc_sx1.imh MSCOMB175GY[1/1] size=1201
bitpix=-32 scaling=none pixtype=real
Warning: Cannot open pixel file (M84ext5.5sc_sx1.imh)
Mike, just to get you in the picture here, I reinstalled PyRaf on a new disk,
the old one is completey gone.
The PyRaf install went fine and I have been using it for a few days now
with no issues until today.
I'm a bit confused. I want to use specfit, but specfit requires a .imh file.
I extracted a spectrum using APALL and it created a .fits file, I can't seem
to make it creat a .imh file if the input file is fits.
So, thats how I ended up trying to use rfits to convert the fits to imh.
I followed your suggestion of doing a mkiraf in my home directory.
This did not change anything as I already said. Besides, the login.cl
file is automatically created when I install PyRaf and I don't remember
having to type MKIRAF the last time I installed PyRaf.
But now I have 2 login.cl files, one in my home directory (created by the
most recent MKIRAF command) and the other one is in my iraf directory
created a few days ago when I installed PyRaf.
Can you please help me !
thanks
Nick
Mike Fitzpatrick wrote on Nov 11, 2009
I'm a bit confused. I want to use specfit, but specfit requires a .imh file.
SPECFIT is a run-on-the-mill SPP IRAF task, it should accept FITS files just fine unless you're using binaries that pre-date the FITS kernel.
I extracted a spectrum using APALL and it created a .fits file, I can't seem
to make it creat a .imh file if the input file is fits.
You can reset your 'imtype' environment variable to be 'imh' to create IMH images, e.g. "cl> reset imtype = 'imh'" before you run APALL. However, you'll likely see the same error message about the imdir until that problem gets fixed.
I followed your suggestion of doing a mkiraf in my home directory.
This did not change anything as I already said. Besides, the login.cl
file is automatically created when I install PyRaf and I don't remember
having to type MKIRAF the last time I installed PyRaf.
I don't remember PyRAF creating the login.cl, only that it reads it. If your PyRAF install creates the file for you it doesn't mean it properly/at-all set the imdir variable correctly. If you say "show imdir" is the path something that exists on your machine? Can you write to that directory?
But now I have 2 login.cl files, one in my home directory (created by the
most recent MKIRAF command) and the other one is in my iraf directory
created a few days ago when I installed PyRaf.
The one file IRAF cares about is the one in the directory where you start IRAF. If you normally start iraf/pyraf from your 'iraf' directory do the MKIRAF agaiin in there, otherwise if you start things form your home directory with the new file, does it work?
-Mike
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
sorry this is becoming such a hastle.
the path is
--> show imdir
/tmp/Nick/
No!
I tried that and got a longer list of error messages;
Task rfits is running...
Killing IRAF task `rfits'
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/stsci/pyssg/Python-2.5.1/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1052, in execute
self.runTask()
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1415, in runTask
self._taskParsObj.run(mode='h', _save=1)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 277, in run
self._run(redirKW, specialKW)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 719, in _run
"\n" + str(value))
IrafError: Error running IRAF task rfits
IRAF task terminated abnormally
ERROR (1, "T_RFITS: Illegal file/extensions number list")
Any ideas?
Thanks in anticipation
Nick
sorry this is becoming such a hastle.
If you say "show imdir" is the path something that exists on your machine? Can you write to that directory?
the path is
--> show imdir
/tmp/Nick/
The one file IRAF cares about is the one in the directory where you start IRAF. If you normally start iraf/pyraf from your 'iraf' directory do the MKIRAF agaiin in there, otherwise if you start things form your home directory with the new file, does it work?
No!
You can reset your 'imtype' environment variable to be 'imh' to create IMH images, e.g. "cl> reset imtype = 'imh'" before you run APALL. However, you'll likely see the same error message about the imdir until that problem gets fixed.
I tried that and got a longer list of error messages;
Task rfits is running...
Killing IRAF task `rfits'
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/stsci/pyssg/Python-2.5.1/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1052, in execute
self.runTask()
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1415, in runTask
self._taskParsObj.run(mode='h', _save=1)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 277, in run
self._run(redirKW, specialKW)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 719, in _run
"\n" + str(value))
IrafError: Error running IRAF task rfits
IRAF task terminated abnormally
ERROR (1, "T_RFITS: Illegal file/extensions number list")
Any ideas?
Thanks in anticipation
Nick
Mike Fitzpatrick wrote on Nov 11, 2009
In general, /tmp is a bad place for an imdir because system reboots usually wipe it out and you'd lose your .pix files. Does using SPECFIT on the FITS image directly work at all?
Otherwise, how did you call RFITS in the first place. The error message indicates a problem in how you specified the input FITS file, not that it could write an output IMH image (progress????)
-Mike
Otherwise, how did you call RFITS in the first place. The error message indicates a problem in how you specified the input FITS file, not that it could write an output IMH image (progress????)
-Mike
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
sorry I got a couple of issues mixed up
If I type cl> reset imtype = 'imh'" before I run APALL. i do indeed create a .imh file so that's good.
However, the issue with rfits remains. I just tested it again on a different image
and got this long error message;Task rfits is running...
Killing IRAF task `rfits'
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/stsci/pyssg/Python-2.5.1/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1052, in execute
self.runTask()
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1415, in runTask
self._taskParsObj.run(mode='h', _save=1)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 277, in run
self._run(redirKW, specialKW)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 719, in _run
"\n" + str(value))
IrafError: Error running IRAF task rfits
IRAF task terminated abnormally
ERROR (1, "T_RFITS: Illegal file/extensions number list")
Any ideas?
thanks
Nick
sorry I got a couple of issues mixed up
If I type cl> reset imtype = 'imh'" before I run APALL. i do indeed create a .imh file so that's good.
However, the issue with rfits remains. I just tested it again on a different image
and got this long error message;Task rfits is running...
Killing IRAF task `rfits'
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/stsci/pyssg/Python-2.5.1/lib/python2.5/lib-tk/Tkinter.py", line 1403, in __call__
return self.func(*args)
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1052, in execute
self.runTask()
File "/usr/stsci/pyssg/2.5.1/pytools/editpar.py", line 1415, in runTask
self._taskParsObj.run(mode='h', _save=1)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 277, in run
self._run(redirKW, specialKW)
File "/usr/stsci/pyssg/2.5.1/pyraf/iraftask.py", line 719, in _run
"\n" + str(value))
IrafError: Error running IRAF task rfits
IRAF task terminated abnormally
ERROR (1, "T_RFITS: Illegal file/extensions number list")
Any ideas?
thanks
Nick
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
I did a bit more investigating on the "Cannot open pixel fileâ error.
I get this error with any operation involving .imh files
In my login.cl I have the following path
set imdir = "/iraf/imdirs/Nick/"
however, I can not find this directory. There is an iraf directory listed along with my
home directory. For example when I do an âlsâ I get
Nick Shared iraf
However, I do not have permission to get into that iraf directory, and I canât get in even when I use âsudoâ
Hereâs the first few lines of my login.cl
# LOGIN.CL -- User login file for the IRAF command language.
# Identify login.cl version (checked in images.cl).
if (defpar ("logver"))
logver = "IRAF V2.13 March 2006"
set home = "/Users/Nick/iraf/"
set imdir = "/iraf/imdirs/Nick/"
set uparm = "home$uparm/"
set userid = "Nick"
This login.cl used to work on my old hard drive, I just copied it over.
Any ideas on whats going on?
Thanks
Nick
I did a bit more investigating on the "Cannot open pixel fileâ error.
I get this error with any operation involving .imh files
In my login.cl I have the following path
set imdir = "/iraf/imdirs/Nick/"
however, I can not find this directory. There is an iraf directory listed along with my
home directory. For example when I do an âlsâ I get
Nick Shared iraf
However, I do not have permission to get into that iraf directory, and I canât get in even when I use âsudoâ
Hereâs the first few lines of my login.cl
# LOGIN.CL -- User login file for the IRAF command language.
# Identify login.cl version (checked in images.cl).
if (defpar ("logver"))
logver = "IRAF V2.13 March 2006"
set home = "/Users/Nick/iraf/"
set imdir = "/iraf/imdirs/Nick/"
set uparm = "home$uparm/"
set userid = "Nick"
This login.cl used to work on my old hard drive, I just copied it over.
Any ideas on whats going on?
Thanks
Nick
Mike Fitzpatrick wrote on Nov 11, 2009
On my way to the airport so real quick: the iraf install script will create the /iraf/imdirs part of the path and opening an image should create the last bit so long as /iraf/imdirs actually exists. I don't know what your Pyraf installer did but check that /iraf/imdirs exists and is writable, i.e. can you manually create a 'Nick' subdirectory there? Alternatively, you could edit your login.cl to read
and a 'pix' subdirectory will be created wherever the .imh header is.
-Mike
reset imdir = "HDR$pix/"and a 'pix' subdirectory will be created wherever the .imh header is.
-Mike
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
what is the "iraf install script" ?
Still no joy fixing my problem.
I created an imdirs directory
did a mkiraf
nothing seems to be making any difference.
So, I'm still stuck.
Nick
what is the "iraf install script" ?
Still no joy fixing my problem.
I created an imdirs directory
did a mkiraf
nothing seems to be making any difference.
So, I'm still stuck.
Nick
Nick Devereux wrote on Nov 11, 2009
Hi Mike,
I am having a conceptual difficulty here.
I thought that if I installed PyRaf I got all the STSDAS s/w and IRAF.
So, why then would I need to run an IRAF install script?
I don't get it, but I'm going to need more details.
thanks
Nick
I am having a conceptual difficulty here.
I thought that if I installed PyRaf I got all the STSDAS s/w and IRAF.
So, why then would I need to run an IRAF install script?
I don't get it, but I'm going to need more details.
thanks
Nick
Nick Devereux wrote on Nov 11, 2009
Mike,
I think I really messed things up now.
I tracked down some IRAF installation instructions at Mac Singularity.
I followed the steps to run the install script, logged in to the 'iraf User' account.
I could not open a terminal window to run the install script.
The error I got was:
"You are not authorized to run this application, the administrator has set your shell to an illegal value".
So, I logged out of iraf user, logged in as Nick, deleted the iraf user account
and tried to create another one, but I was denied that because
"the account name 'iraf' is not available"
So, I'm really stuck now as I have no iraf account nor an I able to create one.
I think you had better call me 928 273 9069
Thanks
Nick
I think I really messed things up now.
I tracked down some IRAF installation instructions at Mac Singularity.
I followed the steps to run the install script, logged in to the 'iraf User' account.
I could not open a terminal window to run the install script.
The error I got was:
"You are not authorized to run this application, the administrator has set your shell to an illegal value".
So, I logged out of iraf user, logged in as Nick, deleted the iraf user account
and tried to create another one, but I was denied that because
"the account name 'iraf' is not available"
So, I'm really stuck now as I have no iraf account nor an I able to create one.
I think you had better call me 928 273 9069
Thanks
Nick
Mike Fitzpatrick wrote on Nov 11, 2009
Nick,
PyRAF simply replaces/extends the functionality of the CL, it still requires an underlying IRAF/STSDAS installation for things that aren't purely Python. Secondly, and 'iraf' user account is not strictly required for installation, you can do this as yourself and simply prepend the word 'sudo' to any installation commands so it'll be done with root privs.
The Mac Singularity installers are, I believe, no longer supported (at least, it's been a long while since they were updated). If you want an all-in-one installation, have a look instead at the SciSoft OSX distro (http://web.mac.com/npirzkal/Scisoft/Scisoft.html) or the DMG file available from STScI (http://www.stsci.edu/resources/software_hardware/pyraf/stsci_python/current/download). Take note of the platform requirements in either case, if you still have problems post back.
-Mike
PyRAF simply replaces/extends the functionality of the CL, it still requires an underlying IRAF/STSDAS installation for things that aren't purely Python. Secondly, and 'iraf' user account is not strictly required for installation, you can do this as yourself and simply prepend the word 'sudo' to any installation commands so it'll be done with root privs.
The Mac Singularity installers are, I believe, no longer supported (at least, it's been a long while since they were updated). If you want an all-in-one installation, have a look instead at the SciSoft OSX distro (http://web.mac.com/npirzkal/Scisoft/Scisoft.html) or the DMG file available from STScI (http://www.stsci.edu/resources/software_hardware/pyraf/stsci_python/current/download). Take note of the platform requirements in either case, if you still have problems post back.
-Mike
Last post on Nov 11, 2009