;+ ; Convert the given channels numbers to the x values appropriate for ; the currently displayed data container and x-axis settings. ; ; @param chans {in}{required}{type=array} The channel numbers to ; convert. ; ; @keyword type {in}{optional}{type=integer} The axis array type ; (0=channels, 1=frequency, 2=velocity). If not supplied, it will use ; the current x-axis type. ; ; @keyword dc {in}{optional}{type=data container} The data container ; to use. If not supplied, the most recently plotted (via show) data ; container is used. ; ; @returns The converted channel numbers in the x-axis units currently ; displayed. ; ; @version $Id: chantox.pro,v 1.7 2005/04/29 06:02:19 bgarwood Exp $ ;- function chantox, chans, type=type, dc=dc compile_opt idl2 common gbtplot_common,mystate,xarray if n_params() ne 1 then begin message,'Usage: chantox(chans[, type=type, dc=dc])',/info ; this returns an undefined value, which is probably a good thing return,chans endif if (not keyword_set(dc)) then begin dc=*mystate.dc_ptr if data_valid(*mystate.dc_ptr) le 0 then begin if !g.line then begin dc=!g.s[0] endif else begin dc=!g.c[0] endelse endif endif if data_valid(dc) le 0 then return, chans if (n_elements(type) eq 0) then type = mystate.xtype result = convertxvalues(dc, chans, 1.0d, 0, '','',0.0d, 0.0d, $ mystate.xscale, type, mystate.frame, mystate.veldef, mystate.xoffset, mystate.voffset) return, result end