ArcVIEW can be handled almost completely by external clients which connects to it. In this case, we will describe how the system can be handles using any type of external scripting or programming language.
There is an important PlugIn called PI_ScriptServer. This PlugIns
is an interface between the internal ArcVIEW (Client-Server) protocol and
any external ascii-based strings.
Even when all the messages inside ArcVIEW are ascii ones, there are some protocol mechanism involved (callbacks, etc.), so the script server translates basic ascii command into ArcVIEW messages.
The Script Server have two ways of communicating with the external world:
Sockets: This are the most used. The ScriptServer is listening in a socket
(currently is a fixed port: 1314).
Files: In the event that a user can use file-based mechanism instead of socket, it can be done. The ScriptServer will receive the command from a file, and will give the answer on another file. This is the simplest way of handling it, since does not involve using socket or any special protocol
The ScriptServer will receive any command , it is going to send that command to the Server, and it is going to send the response to the caller. If a "callback" mechanism is involved, there is two ways of handling it: in block or unblock mode. In block mode, the ScriptServer will not send any response until the Callback message has arrived. In unblocked, it will send the "OK" immediately after the firs "immediate" response was received from the Server.
Examples of Cshell scripts can be found on
Here are examples for taking images using Csh scripts through both a file
and a socket.
For accessing this scripts, the user just needs to type "wirc" on any IRAF
(cl) console and the wirc package will be loaded, leaving all this script
available for usage
The basic scripts are done. If the user wants to build new ones, he can use this basic ones as "bricks" for building more complex ones.
For editing the parameters of any CL script, you need to type "epar taskname", and that will take you to a screen for editing all the parameter of the script.
Important NOTE: In order the scripts which communicates with the ArcVIEW system to work, the Plug-In PI_ScriptServer must be running. You can select it to start automatically every time the system starts, or you can start it manually
- observe: Script for taking images. This script will prompt
for the basename, the starting image number, the exposure time and the amount
of images to take. Depending on the parameters on the
enable file it can prompt you for telescope offset, telescope focus
and/or filter wheel position (so it can perform all this actions)
- teloffset: this script will move the telescope on the specified offset (will ask for RA and DEC values)
- telfocus: script for changing the telescope focus (will ask for focus value)
- filter: script for moving the filter wheel. It will ask you for a position. You can control the filters independently or both at the same time depending on the setting parameters The installed filters must be described o the filterpars file
- motorinit: initializes the filter wheels
More elaborated scripts:
- dithering: this script allows the user to take a sequence
of dither frames, loading a sequence of objects from file. This script will
call (internally) the "observe" script for taking the images and the "teloffset"
one for moving the telescope. The offsets must always be related to
the starting position. According to a parameter, the telescope can be moved
to the initial position at the end of the object sequence. Some example
dither files can be found on /home/wirc/irafpkgs/wirckpkg/*.dat
The Parameter files are files for setting up general functionality. This files are edited on the cl window itself, by just typing its name as a normal task. The files currently used are:
enable: this file says if the "observe
" script will, besides taking the image, move the telescope and/or change
the telescope focus and/or move the filter wheel
obspars: This file sets some parameters specific to the "observe" script (like auto numbering)
filterpars: here must be defined the positions and names of the filter wheels, so the "filter" script knows which position for each filter is requested when the user ask for a filter name. In the future this file will be automatically filled asking to the Filter Module the installed filters
telpars: set some parameters specific to all the telescope scripts (teloffset, telfocus)
How to build new Iraf scripts
For adding more Iraf scripts, the steps to perform are:
- Create the actual CL code: this can be done taking as examples some of
the alreday-done ones. You can call any already-defined script from inside
your new script. Look into the dither.cl script (this script is calling
"observe" and "teloffset") or "observe.cl" (this is calling "teloffset",
telfocus" and "filter") as examples.
- After you have your new code, you must edit the file called "wirc.cl", and add your script there, so when the wirc package is loaded it will leave your new script available for execution. What you need to add to the list is:
"task taskname = wirc$taskfilename", where taskname is the name that appears as your script "procedure" name, and taskfilename is the name of your file (normally "taskname.cl")
After that, you need to reload the wirc package by typing "bye" and then
"wirc", or "unlearn wirc", and then "wirc"
We must note that already exists a "custom WIRC package tool", mainly provided by Dave Thomson. The package is called WIRCtools and it is available for any user. This is the place intended for observers and users to contribute with public scripts
This Iraf script allows the user to burn a DVD-R, DVD-RW, CD-R or CD-RW with data. The wirc package must be loaded for the script to be available. The required parameters are:
wi> epar burn
PACKAGE = wirc TASK = burnDVD sdir = /home2/wirc/images) source dir (vlabel = ) volume label (defaults to current date) (capacit = 4489) disk capacity (MB) (1MB=1024x1024K) (isodir = /home2/wirc/dvdfiles) directory for temporary iso files (isofile = iso.raw) temporary iso file name (type = DVD-R) device type (deletei = yes) delete temporary iso file at the end? (reuse = no) reuse existing ISO file? (dummymo = no) try dummy mode first? (verify = yes) verify data written correctly to dvd? (devdvddir = /dev/dvd) device directory (mntdvddir = /mnt/dvd) mounted device directory (mode = ql)
sdir: source directory, which contents that data to be burned
vlabel: desired label for the volume. It will default to the current date
This two parameters will be asked every time you run the script. The remaining ones are "hiding", which means that the user must change its "manually" (they will not be prompted)
capacity: capacity of the media to be used, in MB.
As a reference, a standard CD-R and DC-RW has 650-700 MB, while a standard
DVD has 4489 MB (4.7 GB)
isodir: directory for storing the temporary ISO file that needs to be created for writing the media
isofile: name that the ISO file will have. If a file already exists, IT WILL BE OVERRIDDEN
type: type of device to use. Choices are DVD-R (recordable DVD, for writing once, of type -R), DVD-RAM, CD-R (recordable, for writing once), and CD-RW (re-writables CDs). Note that DVD+R or DVD-RW will not work
deleteiso: controls if you want to delete the ISO file once it has been written to the storage media or you want to leave it on disk
reuse: controls if you want to create a new ISO file from the source dir to burn the media, or if you already have an ISO file and you want to use it
dummymode: controls if you want a real burn or a dummy burn . Dummy burn are useful if you are not sure the media you have is compatible or if it is going to work. The dummy mode performs all the steps that the real burn will do, but the actual laser is turned off during the burning process
verify: if YES, runs an md5checksum on data in source directory and compares to md5checksum on data written to the dvd. Errors, if any, are then listed.
devdvddir: path to the dvd device (/dev/dvd on WIRC2 computer, /dev/dvdram on WIRC computer)
mntdvddir: path to the mounted dvd device (/mnt/dvd on WIRC2 computer, /mnt/dvdram on WIRC computer)
mode: internal use.
This script uses the mkisofs program for generating the ISO file, and the cdrecord-proDVD one for the actual burn. The script is very simple, and it is going to performs the following steps:
- verify that your writable media has enough space for storing your source
- verify that there is enough space available on for storing the temporary ISO file (on the specified filesystem)
- generate the ISO file if requested
- burn the media on the requested mode (dummy or real)