fv scripting
What for?
With an fv script, one can automate some of the interactive
procedures in fv. e.g. using an fv script file, one can open a
FITS file, and display the header of the third extension, or
plot X and Y column in the table on the fourth extension, or do
them both.
Writing an fv script
Fv scripting is designed in an object-oriented fashion. But
you don't have to know much about OO to use it. The only thing
you need to know is that you have to create a FITS object first,
and then ask the FITS object to do the things you want it to do.
All the commands need to be saved in an ASCII file with the
".fv" extension.
Creating a FITS object
To create a FITS object, use the command:
FVFile object_name
where object_name is of your choice. The first two things
you need to do after that are:
- object_name setFileName file_name
- object_name setFileMode file_mode
where file_name is the name of the file and
file_mode is an integer flag specifying how to open the
file. The file name can be a simple path on your local machine,
or a URL of a file on a remote host (see File Selection). To access files on
a remote ftp site, you need to write file_name in the
form of
ftp://username:password@host.domain/directory/filename
If the remote host is an anonymous ftp site, one can replace the
username and password with "anonymous" and one's email
address.
The values and meaning of file_mode are as follows:
- 0: open pre-existing file as read/write
- 1: open pre-existing file as read only
- 2: create a new FITS file
Available actions
The scripting capability is currently rather limited and is deprecated
in preference to a newer, more powerful
interface. Right now, you can only do the following
- object_name setExtension ext_number
- object_name displayTable
- object_name displayImage
- object_name setXColumn column_name
- object_name setYColumn column_name
- object_name setXErrorColumn column_name
- object_name setYErrorColumn column_name
- object_name plotTable # do the above four commands
first (Only setXColumn and setYColumn are required).
Go to About fv.