! @ image_lines
!
!   Image the lines detected and identified by @ preview_lines, using
!   the /RANGE option to select the appropriate channel range
!   for each of them
!
!   Name is generated from the current UV table and line names
!
if .not.exist(preview%nfound) then
  SAY "Use UV_PREVIEW before, with a catalog (see CATALOG)"
  return
else if preview%ndetect.eq.0 then
  SAY "No identified lines detected by UV_PREVIEW"
  return
endif
!
clean\uv_baseline /channel preview%channels
!
define char*12 linename
let linename 'uv%line'
!
for i 1 to preview%ndetect
  clean\specify frequency 'preview%detected%freq[i]'
  let uv%line 'preview%detected%lines[i]'
  clean\uv_map /RANGE 'preview%detected%ranges[1,i]' 'preview%detected%ranges[2,i]' CHANNEL
  clean\clean
  clean\view clean
  clean\write clean 'preview%detected%species[i]'-'linename'
next
!
let uv%line 'linename'
