!!
!! The routine mutes data based on pairs t-x (or angle) described in 
!! an input file.
!!

  program DropTrace

  use sep

  implicit none
  
  integer                           :: i2
  real				    :: n1,n2,n3,n4,n5,
  real                              :: o1,o2,o3,o4,o5,d1,d2,d3,d4,d5
  real				    :: ang1,ang2,ang3,ang4,ang
  real,dimension(:,:),allocatable   :: cdp
!  integer, external :: sreed

  call sep_init()
  call sep_begin_prog()

!! get info from history file
  call from_history("n1",n1)
  call from_history("n2",n2)
  call from_history("n3",n3)
  call from_history("d1",d1)
  call from_history("d2",d2)
  call from_history("d3",d3)
  call from_history("o1",o1)
  call from_history("o2",o2)
  call from_history("o3",o3)
  call from_history("n4",n4)
  call from_history("n5",n5)
  call from_history("d4",d4)
  call from_history("d5",d5)
  call from_history("o4",o4)
  call from_history("o5",o5)

  !! write info out to history file
  call to_history("n1",n1)
  call to_history("n2",n2)
  call to_history("n3",n3)
  call to_history("d1",d1)
  call to_history("d2",d2)
  call to_history("d3",d3)
  call to_history("o1",o1)
  call to_history("o2",o2)
  call to_history("o3",o3)
  call to_history("n4",n4)
  call to_history("n5",n5)
  call to_history("d4",d4)
  call to_history("d5",d5)
  call to_history("o4",o4)
  call to_history("o5",o5)


!!  get mute parameters
  call from_param("ang1",ang1)
  call from_param("ang2",ang2)
  call from_param("ang3",ang3)
  call from_param("ang4",ang4)


!! allocate working space
  allocate(cdp(n1,n3))

  call sep_read(cdp,"in")
!  if(size(cdp)*4/=sreed("in",cdp,size(cdp)*4)) call seperr("trouble reading in data")
!!
!! 
!!
do i2=1,n3
	ang=o3+(i2-1)*d3
	if ((ang.ge.ang1).and.(ang.le.ang2)) then
		cdp(i1,i2)=0.0
	elseif ((ang.ge.ang3).and.(ang.le.ang4)) then
		cdp(i1,i2)=0.0
	end if
end do
 call sep_wrie(cdp,"out")

!! clean up
  deallocate(cdp)

  call sep_end_prog()
  end program DropTrace
