"@(#)solids1d 19.3 03/17/07 Copyright (c) 2003-2007 Varian, Inc. All Rights Reserved."
// solids1d apptype

$action = 'setup'
$do = ''
if ($# > 0) then
  $action = $1
  if ($# > 1) then
    $do = $2
  endif
endif

if ($action = 'setup') then

  $tn = ''
  exists('tn','parameter'):$e
  if ($e > 0.5) then 
     $tn = tn
  endif
  $dn = ''
  exists('dn','parameter'):$e
  if ($e > 0.5) then 
     $dn = dn
  endif
  $dn2 = ''
  exists('dn2','parameter'):$e
  if ($e > 0.5) then 
     $dn2 = dn2
  endif
  $dn3 = ''
  exists('dn3','parameter'):$e
  if ($e > 0.5) then 
     $dn3 = dn3
  endif

  if ($do = '') then
    $do = macro   
  endif
  exists($do,'parlib'):$e,$path
  if ($e) then
    rtp($path) 
  else
    write('error','parameters for %s do not exist',macro)
    return
  endif

  exists('tn','parameter'):$e
  if ($e > 0.5) then 
     tn = $tn
  endif  
  exists('dn','parameter'):$e
  if ($e > 0.5) then 
     dn = $dn
  endif
  exists('dn2','parameter'):$e
  if ($e > 0.5) then 
     dn2 = $dn2
  endif
  exists('dn3','parameter'):$e
  if ($e > 0.5) then 
     dn3 = $dn3
  endif
  
/*get parameters from probes file and setup for CP*/
 
  if (tn  <> '') then getsolidsprobedata('tn') endif
  if (dn  <> '') then getsolidsprobedata('dn') endif
  if (dn2 <> '') then getsolidsprobedata('dn2') endif
  if (dn3 <> '') then getsolidsprobedata('dn3') endif

  setref('setup')
   
/* run a user customization macro*/
  
  on('wrtp'):$e
  if ($e > 0.5) then
    exec(wrtp)
  endif
  setref('setup')
  sf=0 wf=np/sw/2
  sp=rfp-rfl wp=sw
  execseq('setup')  // Execute any sequence specific setup
  dps newdg dg

elseif ($action = 'process') then

  setref('setup')
  if (arraydim > 1) then
    procarray
  else
    format(tn,'lower'):$tn
    $procmacro=$tn+'p'
    exists($procmacro,'maclib'):$e
    if $e then
      exec($procmacro)
    else
      wft f ai         
      aph:$x           
      if $x<0.5 then
        aph0:$x
        if $x<0.5 then
          write('line3','Cannot phase spectrum')
        endif
      endif
      integrate        
      vsadj noislm     
      thadj            
    endif
  endif

  execseq('proc') // Execute any sequence specific processing

elseif ($action = 'plot') then

  if arraydim=1 then		
    plot1d			
  else
    plotarray						
  endif

  execseq('plot') // Custom  sequence-based plots if desired

endif

