Skip to content

Commit

Permalink
Reduce number of false positives in tests
Browse files Browse the repository at this point in the history
 - still not done, though.
 - changed name of test dir to tests
  • Loading branch information
sstaehler committed Oct 3, 2015
1 parent 46f88be commit 1f9abfd
Show file tree
Hide file tree
Showing 49 changed files with 41 additions and 29 deletions.
8 changes: 4 additions & 4 deletions TEMPLATES/Makefile.TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ clean:
cd src; rm -f *.o *.M *.mod *.d *.il core *.gcda *.gcno; cd ..
rm bin/mc_kernel

.PHONY: test
test: $(mc_kernel)
cd test; ./runtests.sh ../bin/mc_kernel
@tail -n 5 test/mckernel_tests.log
.PHONY: check
check: $(mc_kernel)
cd tests; ./runtests.sh ../bin/mc_kernel
@tail -n 5 tests/mckernel_tests.log

.PHONY: doc
doc:
Expand Down
6 changes: 3 additions & 3 deletions src/filtering.f90
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ subroutine add_stfs(this, stf_sem_fwd, sem_dt, amplitude_fwd, stf_source, stf_dt
! FT STF of Earthquake
call fft_stf%rfft(taperandzeropad(stf_src, fft_stf%get_ntimes(), ntaper = 5), stf_src_fd)

if (firstslave) then
if (firstslave.or.testing) then
18 format('stf_spectrum_', A, 2('_', F0.3))
19 format(5(E16.8))
write(fnam,18) trim(this%filterclass), this%frequencies(1:2)
Expand Down Expand Up @@ -338,7 +338,7 @@ subroutine add_stfs(this, stf_sem_fwd, sem_dt, amplitude_fwd, stf_source, stf_dt

call fft_stf%freeme()

if (firstslave) then
if (firstslave.or.testing) then
20 format('filterresponse_stf_', A, 2('_', F0.3))
write(fnam,20) trim(this%filterclass), this%frequencies(1:2)
open(10, file=trim(fnam), action='write')
Expand Down Expand Up @@ -389,7 +389,7 @@ subroutine add_stfs(this, stf_sem_fwd, sem_dt, amplitude_fwd, stf_source, stf_dt
end if

if (maxloc(abs(this%transferfunction),1) > 0.5*this%nfreq) then
if (firstslave) then
if (firstslave.or.testing) then
print *, 'ERROR: Filter ', trim(this%name), ' is not vanishing fast enough for '
print *, 'high frequencies.'
print *, 'Numerical noise from frequencies above mesh limit will be propagated'
Expand Down
1 change: 1 addition & 0 deletions src/test_readfields.f90
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ subroutine test_readfields_load_fw_points
! Read reference strain trace and point coordinates
open(newunit=lu_refstrain, file='./read_strain_point1.txt', action='read')
read(lu_refstrain, *) coordinates(:,1)
allocate(straintrace_ref(sem_data%ndumps))
do i=1, ntimes
read(lu_refstrain, *) straintrace_ref(i)
end do
Expand Down
23 changes: 16 additions & 7 deletions src/test_type_parameter.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,25 @@ subroutine test_parameter_reading
call parameters%read_filter(nomega=nomega, df=df)

! Do checks on filters
call assert_equal(parameters%nfilter, 2, '2 Filters in input file')
call assert_true(parameters%filter(1)%name=='Gabor_40', 'Filter 1, name: Gabor_40')
call assert_true(parameters%filter(2)%name=='Gabor_30', 'Filter 2, name: Gabor_30')
call assert_equal(parameters%nfilter, 4, '4 Filters in input file')
call assert_true(parameters%filter(1)%name=='BW_4_40s', 'Filter 1, name: BW_4_40s')
call assert_true(parameters%filter(2)%name=='Identical', 'Filter 2, name:Identical')
call assert_true(parameters%filter(3)%name=='Gabor_60', 'Filter 3, name: Gabor_60')
call assert_true(parameters%filter(4)%name=='Gabor_80', 'Filter 4, name: Gabor_80')

call assert_comparable(parameters%filter(1)%frequencies, [40.d0, 0.5d0, 0.d0, 0.d0], &
1d-10, 'Frequencies of filter 1 correct')
call assert_comparable(parameters%filter(2)%frequencies, [30.d0, 0.5d0, 0.d0, 0.d0], &
call assert_comparable(parameters%filter(2)%frequencies, [0.d0, 0.0d0, 0.d0, 0.d0], &
1d-10, 'Frequencies of filter 2 correct')
call assert_true(parameters%filter(1)%filterclass=='Gabor', 'Filter 1, type: Gabor')
call assert_true(parameters%filter(2)%filterclass=='Gabor', 'Filter 2, type: Gabor')

call assert_comparable(parameters%filter(3)%frequencies, [60.d0, 0.5d0, 0.d0, 0.d0], &
1d-10, 'Frequencies of filter 3 correct')
call assert_comparable(parameters%filter(4)%frequencies, [80.d0, 0.5d0, 0.d0, 0.d0], &
1d-10, 'Frequencies of filter 4 correct')

call assert_true(parameters%filter(1)%filterclass=='Butterw_LP_O4', 'Filter 1, type: Gabor')
call assert_true(parameters%filter(2)%filterclass=='ident', 'Filter 2, type: Gabor')
call assert_true(parameters%filter(3)%filterclass=='Gabor', 'Filter 1, type: Gabor')
call assert_true(parameters%filter(4)%filterclass=='Gabor', 'Filter 2, type: Gabor')


call parameters%read_kernel(sem_data, parameters%filter)
Expand Down
2 changes: 1 addition & 1 deletion src/type_parameter.f90
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ subroutine read_kernel(this, sem_data, filter)
call pbarrier

if (master) then
write(6,*)'Reading kernels from file ', trim(this%receiver_file)
write(lu_out,*)'Reading kernels from file ', trim(this%receiver_file)
open(newunit=lu_receiver, file=trim(this%receiver_file), status='old')
read(lu_receiver,*)
read(lu_receiver,*) this%component
Expand Down
3 changes: 0 additions & 3 deletions test/filters.dat

This file was deleted.

11 changes: 0 additions & 11 deletions test/receiver.dat

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/filters.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
4
BW_4_40s Butterw_LP_O4 40.0 0.5 0.0 0.0
Identical ident 0.0 0.0 0.0 0.0
Gabor_60 Gabor 60.0 0.5 0.0 0.0
Gabor_80 Gabor 80.0 0.5 0.0 0.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions tests/receiver.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
2 # Nr of receivers
Z # seismogram component
T001 00.0000 30.0000 3 # Name, lat, lon, nr of kernels
P_40s_lam Identical CC 675.0 735.0 lam # Kernel name, Filter name, time window begin and end, model parameter
P_40s_eta Identical CC 675.0 735.0 eta
P_40s_mu Identical CC 675.0 735.0 mu
T002 30.0000 00.0000 4
P_40s_rho Gabor_60 CC 200.0 260.0 rho
P_40s_vp Gabor_60 CC 200.0 260.0 vp
P_40s_vs Gabor_60 CC 200.0 260.0 vs
P_40s_eta Gabor_60 CC 200.0 260.0 eta
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 1f9abfd

Please sign in to comment.