# 1 "<stdin>"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "<stdin>"
program new_pick
  use sep
  use sep3d_struct_mod
  use pick_mod
  use non_lin_pick_mod
!use clip_mod
  implicit none
  type(sep3d) :: data_s
  real,pointer :: data(:,:,:),mp(:,:),wt(:,:),model(:),stack(:,:,:),var&
    &(:)
  write(0,*) "XX"
  if (.not. read_data(data_s,data,stack)) then
    call erexit("trouble reading data")
  end if
  write(0,*) "XX"
!if(.not. init_clip_params(data_s))
! call erexit("trouble reading max_params")
!
!if(.not. mute_clip(data))
! call erexit("trouble doing mute clip")
!
!if(.not. ray_clip(data))
! call erexit("trouble doing ray clip")
  if (.not. init_max_params(data_s,data,stack,mp,wt)) then
    call erexit("trouble reading max_params")
  end if
  if (.not. max_pick(mp,wt)) then
    call erexit("trouble doing max pick")
  end if
  if (.not. init_non_lin_pick(data_s,mp,wt)) then
    call erexit("trouble initing non-linear pick")
  end if
  if (.not. non_lin_pick(model)) then
    call erexit("trouble running non-linear pick")
  end if
  if (.not. calc_var(data,model,var,data_s)) then
    call seperr("trouble calculating variance")
  end if
  if (.not. write_files(mp,wt,model,data_s,var)) then
    call erexit("trouble writing files")
  end if
end program
