;+ ; Get a previously saved data container with the matching ; nsave number, and put it in indicated index. ; ;

This is a shorthand for get, nsave=nsave or kget, nsave=nsave ; ;

Only spectral line data can currently be fetched using an nsave number. ; ;

nget fetchs data from the output file (keep file) unless infile is set. ; ; @param nsave {in}{required}{type=long} nsave number to be retrieved ; @keyword index {in}{optional}{type=long} index where the retrieved spectrum is stored (defaults to 0). ; @keyword infile {in}{optional}{type=boolean} if set, use line input file instead of the output file. ; @keyword ok {out}{optional}{type=boolean} status output ; ; @uses set_data_container ; ; @examples ;

;   getps,10  ; get some data
;   ; do stuff to it
;   nsave,50  ; its now in nsave=50
;   ; do more stuff to that data, oops, thats no good
;   ; back to previous state
;   nget,50
; 
; ; @version $Id: nget.pro,v 1.2 2005/05/30 04:03:43 bgarwood Exp $ ;- pro nget,nsave,index=index,infile=infile,ok=ok compile_opt idl2 ok = 0 if (n_elements(nsave) eq 0) then begin print,'Usage: nget, nsave[, index=index,ok=ok]' print,' input nsave must be supplied.' print,' index defaults to 0, primary data container.' print,' infile defaults to 0, if set, uses input file.' print,' ok is the return status, 1 is good 0 is bad.' return endif if (n_elements(index) eq 0) then index = 0 if !g.line then begin if (index lt 0 or index ge n_elements(!g.s)) then begin message,string(n_elements(!g.s),format='index is out of range: 0:%i3'),/info return endif endif else begin message,'continnuum data can not be kept yet',/info return endelse ; and get it count=0 if keyword_set(infile) then begin dc = !g.lineio->get_spectra(nsave=nsave,count) endif else begin dc = !g.lineoutio->get_spectra(nsave=nsave,count) endelse if count ne 1 then begin message, "Could not retrieve spectrum with nsave number: "+string(nsave), /info ok = 0 return endif else begin if (data_valid(dc) gt 0) then begin set_data_container, dc, index=index data_free, dc endif else begin message, 'Fetched data appears to be empty or invalid',/info ok = 0 return endelse endelse ok = 1 return end