GWtool
Gravitational-wave tool
 All Classes Files Functions Variables Pages
gw_match_wfs.f90
Go to the documentation of this file.
1 !> \file gw_match_wfs.f90 Match the two waveforms in specified files
2 
3 !
4 ! GWtool: Simple tools for working with gravitational waves
5 ! http://gwtool.sourceforge.net/
6 !
7 !
8 ! Copyright 2007-2013 AstroFloyd - astrofloyd.org
9 !
10 !
11 ! This file is part of GWtool.
12 !
13 ! GWtool is free software: you can redistribute it and/or modify
14 ! it under the terms of the GNU General Public License as published by
15 ! the Free Software Foundation, either version 3 of the License, or
16 ! (at your option) any later version.
17 !
18 ! GWtool is distributed in the hope that it will be useful,
19 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ! GNU General Public License for more details.
22 !
23 ! You should have received a copy of the GNU General Public License
24 ! along with GWtool. If not, see <http://www.gnu.org/licenses/>.
25 
26 
27 
28 !***********************************************************************************************************************************
29 !> \brief Match the two waveforms in specified files
30 !!
31 !! \note The files are assumed to contain time-domain waveforms, in two columns: time and strain
32 
33 program gw_match_wfs
34  use sufr_kinds, only: double
35  use sufr_system, only: syntax_quit
36  use sufr_constants, only: set_sufr_constants
37  use sufr_numerics, only: deq,dne
38 
39  implicit none
40  integer :: ln,lnr
41  real(double) :: dt,dh,rdh, hmax,hsum,hsum1,hsum2
42  character :: infile1*(99),infile2*(99)
43 
44  call set_sufr_constants()
45 
46  if(command_argument_count().eq.2) then
47  call get_command_argument(1, infile1)
48  call get_command_argument(2, infile2)
49  else
50  call syntax_quit('<WFfile1> <WFfile2>', 0)
51  end if
52 
53  call match_wfs_file(trim(infile1),trim(infile2), ln, dt,dh,hmax,hsum1,hsum2,rdh,lnr)
54 
55  hsum = hsum1 + hsum2
56 
57  write(*,*)
58  !write(*,'(A,I9)') ' Nl: ',ln
59  !write(*,'(5(A,ES12.5))') ' Tot dh: ',dh, ', avg.dh: ',dh/dble(ln), ', avg.rel.dh: ',rdh/dble(lnr)
60  !write(*,'(5(A,ES12.5))') ' Max h: ',hmax, ', avg.dh/hmax: ', dh/dble(ln) / hmax
61  write(*,'(5(A,ES12.5))') ' Avg h: ',hsum/dble(2*ln), ', avg.dh/avg.h: ', dh/hsum
62  !write(*,'(5(A,ES12.5))') ' Avg h1: ',hsum1/dble(ln), ', avg.dh/avg.h1: ', dh/(2*hsum1)
63  !write(*,'(2(A,ES12.5),A,F10.5)') ' Tot dt: ',dt, ', avg.dt: ',dt/dble(ln), ', avg.dt*1e6: ',dt/dble(ln)*1.d6
64  write(*,'(2(A,ES12.5),A,F10.5)') ' Avg.dt: ',dt/dble(ln)
65  if(deq(dt,0.d0) .and. deq(dh,0.d0)) write(*,'(/,A)') ' The two waveforms are identical'
66  if(dne(dt,0.d0)) write(*,'(/,A)') ' There is a time offset'
67  write(*,*)
68 
69 end program gw_match_wfs
70 !***********************************************************************************************************************************
71 
72 
73 
subroutine match_wfs_file(ipfile1, ipfile2, ln, dt, dh, hmax, hsum1, hsum2, rdh, lnr)
Match the time-domain waveforms in two specified files.
Definition: wf_routines.f90:43
program gw_match_wfs
Match the two waveforms in specified files.