Examples of Using the nsave Feature in GBTIDL
The nsave feature allows a user to store data into a keep file and attach an identifier number (the nsave value) to that entry. Data can then be stored, overwritten, and retrieved according to the nsave value. The utility essentially gives the user access to an unlimited number of storage slots on disk, somewhat like the 16 data containers kept in memory.
This page gives some examples of how the nsave feature can be used.
The following GBTIDL procedures are relevant to the nsave features. Click the link to go to the reference manual entry.
| Command | Purpose |
| nsave | Store a spectrum to disk with the given nsave value |
| nget | Retrieve a spectrum with a given nsave value |
| fileout | set the output file; note this can be used for both keep and nsave |
| sprotect_off | enable overwrite permission |
| sprotect_on | disable overwrite permission |
The following sequence shows how to store and retrieve a spectrum using the nsave feature:
fileout,'mynsave.fits' ; open a file for writing
getrec, 10 ; get some data
nsave, 101 ; store it to the keep file
scale, 5 ; perform some operations
nsave, 102 ; store it with a different nsave value
nget, 101 ; retrieve the spectrum at nsave=101
The next example shows a more sophisticated nsave example. Here each nsave entry stores a calibrated integration from a scan. The example demonstrates how the nsave values can be overwritten and each nsave entry has an attached meaning to the data, for example nsave=1002 is the data associated with scan=100, int=2. As the calibration of this integratin is refined, the spectra are simply stored back into that nsave slot.
fileout,'mynsave.fits' ; open a file for writing
for i=0,5 do begin $ ; store each integration
getnod, 100, int=i & $
nsave, 1000+i & $
endfor
nget, 1002 ; retrieve one of the entries
bias, 0.1 ; do some work on it
nsave, 1002 ; and reinsert it into the file
for i=0,5 do begin $ ; Now execute a loop to average all
nget, 1000+i & $ ; the data including the processed
accum & $ ; integration. This loop could be
endfor ; made into a separate procedure.
ave
-- JimBraatz - 06 Jun 2005
Revision r1.5 - 10 May 2006 - 15:12 GMT - JimBraatz Parents: IDLDocumentation
|
Content copyright © 1999-2007 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
|
| |