From 13540b83e012b5ddfeed0906fb96faa129bfb4d1 Mon Sep 17 00:00:00 2001 From: Torkel Date: Tue, 28 Jul 2020 15:11:03 +0100 Subject: [PATCH] Remove debugginb stuff. --- test/solve_SDEs.jl | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/test/solve_SDEs.jl b/test/solve_SDEs.jl index 6a41da26e8..a3068b222a 100644 --- a/test/solve_SDEs.jl +++ b/test/solve_SDEs.jl @@ -89,15 +89,11 @@ end push!(identical_networks, reaction_networks_constraint[9] => (real_f_3,real_g_3,zeros(7,6))) for (i,networks) in enumerate(identical_networks) - println(i) for factor in [1e-1, 1e0, 1e1], repeat in 1:3 - println(repeat, " ", factor) u0 = 100. .+ factor*rand(length(networks[1].states)) p = 0.01 .+ factor*rand(length(networks[1].ps)) (i==2) && (u0[1] += 1000.) (i==3) ? (p[2:2:6] .*= 1000.; u0 .+= 1000) : (p[1] += 500.) - println(u0) - println(p) prob1 = SDEProblem(networks[1],u0,(0.,100.),p) sol1 = solve(prob1,ImplicitEM(),saveat=0.01,maxiters=1e7) prob2 = SDEProblem(networks[2][1],networks[2][2],u0,(0.,100.),p,noise_rate_prototype=networks[2][3]) @@ -115,23 +111,23 @@ end ### Compares level of noise with noise scalling. ### # Tests with a single noise scaling parameter. -#noise_scaling_network = @reaction_network begin -# (k1,k2), X1 ↔ X2 -#end k1 k2 -#for repeat = 1:5 -# p = 1. .+ rand(2) -# u0 = 10000*(1. .+ rand(2)) -# sol001 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,0.01),noise_scaling=(@variables η1)[1]),ImplicitEM()) -# sol01 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,0.1),noise_scaling=(@variables η1)[1]),ImplicitEM()) -# sol1 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,1.),noise_scaling=(@variables η2)[1]),ImplicitEM()) -# sol10 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,10.),noise_scaling=(@variables η3)[1]),ImplicitEM()) -# @test 2*std(first.(sol001.u)[100:end]) < std(first.(sol01.u)[100:end]) -# @test 2*std(last.(sol001.u)[100:end]) < std(last.(sol01.u)[100:end]) -# @test 2*std(first.(sol01.u)[100:end]) < std(first.(sol1.u)[100:end]) -# @test 2*std(last.(sol01.u)[100:end]) < std(last.(sol1.u)[100:end]) -# @test 2*std(first.(sol1.u)[100:end]) < std(first.(sol10.u)[100:end]) -# @test 2*std(last.(sol1.u)[100:end]) < std(last.(sol10.u)[100:end]) -#end +noise_scaling_network = @reaction_network begin + (k1,k2), X1 ↔ X2 +end k1 k2 +for repeat = 1:5 + p = 1. .+ rand(2) + u0 = 10000*(1. .+ rand(2)) + sol001 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,0.01),noise_scaling=(@variables η1)[1]),ImplicitEM()) + sol01 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,0.1),noise_scaling=(@variables η1)[1]),ImplicitEM()) + sol1 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,1.),noise_scaling=(@variables η2)[1]),ImplicitEM()) + sol10 = solve(SDEProblem(noise_scaling_network,u0,(0.,1000.),vcat(p,10.),noise_scaling=(@variables η3)[1]),ImplicitEM()) + @test 2*std(first.(sol001.u)[100:end]) < std(first.(sol01.u)[100:end]) + @test 2*std(last.(sol001.u)[100:end]) < std(last.(sol01.u)[100:end]) + @test 2*std(first.(sol01.u)[100:end]) < std(first.(sol1.u)[100:end]) + @test 2*std(last.(sol01.u)[100:end]) < std(last.(sol1.u)[100:end]) + @test 2*std(first.(sol1.u)[100:end]) < std(first.(sol10.u)[100:end]) + @test 2*std(last.(sol1.u)[100:end]) < std(last.(sol10.u)[100:end]) +end ### Tries to create a large number of problem, ensuring there are no errors (cannot solve as solution likely to go into negatives). ###