Once you are inside the program you will need to get at some data. How you do this depends on the sort of data it is. For data direct from the JCMT, which is stored in GSD (Global Section Datafile) format, you can use the -GSD- commands.
| SET-GSD-FILENAME | Select JCMT backend (e.g. as in OBS_xxxx_nnnn.dat) |
| INDEX-GSD-FILES | Quick summary of GSD files in range of scan numbers |
| READ-GSD-DATA | Push and get a single spectrum from a GSD file |
| READ-GSD-MAP | Read all spectra from a GSD file to a map |
GSD filenames have the form <prefix>_<nnnn>.DAT, where the
prefix is currently ``OBS_<be>" (<be> is one of
`UKT14', `AOSC', `RXA', `RXC' etc.), and nnnn is the scan number.
SET-GSD-FILENAME allows you to change the prefix from the default.
Since GSD files may contain any number of observations of different points, you may be asked which one you require. In order to get a better idea in advance of what each GSD file holds you can get a quick summary by using INDEX-GSD-FILES. This is most useful if you first change the list file to the printer (using SET-LIST-FILE) so that you have a hardcopy record.
You may also read data directly from GSD files into a SPECX map - see the section on creating maps for more details.
If you are not accessing JCMT data, then you will first have to translate your data to SPECX files (which are somewhat simpler than GSD files for the novice programmer). The details of how to do this are dealt with in Appendix F.
| OPEN-FILE | Open a data file (new or pre-existing) |
| CLOSE-FILE | Close a currently opened data file |
| SET-FILE-ACCESS | Define access to data file (read, write or R/W) |
| INDEX-FILE | List the data file contents to current output file |
| LIST-OPEN-FILES | List the names of currently open data files to terminal |
| DELETE-SPECTRUM | Delete a spectrum from a file |
| RECOVER-FILE | Un-delete spectra not yet COMPRESSED out |
| COMPRESS-FILE | Remove deleted spectra |
| READ-SPECTRUM | Push and read a spectrum from a SPECX file |
| WRITE-SPECTRUM | Write current spectrum to a SPECX file |
| REWRITE-SPECTRUM | Overwrite SPECX filed spectrum with current spectrum |
SPECX has its own special format of (non-map) data file, which is described in appendix F.1. Within SPECX up to eight such data files may be open at once (use OPEN-FILE both to create a new data file, and to gain access to an existing one). Open files may have any of READ (R), WRITE (W) or READ/WRITE (RW) access. When SPECX needs to read from or write to a file, it first looks for open files with the required access. If it finds none an error message results; otherwise it asks you which one was meant and goes ahead with the operation. Note that it always asks you this, but if only one file is open with the required access then the default will be set to this one.
Existing files are opened with READ access only, and new files are created open with WRITE access only. The access may be changed with SET-FILE-ACCESS. Files which are not required at this time may be released using CLOSE-FILE. LIST-OPEN-FILES tells you which files are currently in use (and what access they have), while INDEX-FILE gives a detailed listing of the contents of any one open file.
This system, although it may appear cumbersome, is actually very flexible. Usually, there will be at most one file open with each of R and W access, and this will then appear as the default, but equally, for example, it is possible to have all eight files open for READ and to read from them in turn, writing back to any file which has WRITE access.
To check which file is intended for a read or write operation, SPECX uses a single routine, which therefore always supplies the same prompt:
File number?
This question may be answered with either of
<CR>. If there is no default, <CR> is interpreted as
a request for a list of currently open files, with their `file numbers' and
access codes. After displaying the list the original prompt is repeated.
Assuming that you have done this however (or that you have READ data from GSD files and then WRITTEN it to a SPECX file for later access), then it can be retrieved by using the READ-SPECTRUM command, and can be written back to another file or the same one using WRITE-SPECTRUM. (Data can also be written to an ASCII file for plotting by MONGO or whatever using WRITE-ASCII-SPECTRUM -- see next section for further details).
REWRITE-SPECTRUM allows you to put a scan back in the same position in a SPECX file that it came from (WRITE-SPECTRUM always adds a new one at the end). However it won't work if you have extended the spectrum beyond the room occupied by the original scan.
Note that you can write data which originated in GSD files to SPECX datafiles if you want to - once the spectra are inside the SPECX stack they all look alike, and the program cannot distinguish. However no facility has been provided for writing back to GSD files - here is a programming job for a volunteer!
In order to remove known bad or suspect data from a file (thereby removing the temptation to use it!) the DELETE-SPECTRUM command has been provided. This functions by giving the particular spectrum a negative sequence number. It is therefore not displayed by INDEX-FILE, nor can it be read from the file. However, it can be retrieved, by the simple expedient of making the sequence number positive again. RECOVER-FILE does this for all deleted spectra in the file. It follows that DELETE-SPECTRUM does not free any space, and if you are really sure that you want to get rid of the spectra then you can COMPRESS the file, which removes the deleted spectra irretrievably (honestly, then they are gone).