timplement better error handling depending on PyPlot status - Granular.jl - Julia package for granular dynamics simulation
(HTM) git clone git://src.adamsgaard.dk/Granular.jl
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 5a146a48bf313d33a61b3a324a9d2561df839bec
(DIR) parent a19598f72d623c1a082fb021860e7b4f7bbc58eb
(HTM) Author: Anders Damsgaard <andersd@riseup.net>
Date: Tue, 3 Oct 2017 16:51:04 -0400
implement better error handling depending on PyPlot status
Diffstat:
M src/icefloe.jl | 2 +-
M test/icefloe.jl | 22 +++++++++++++---------
2 files changed, 14 insertions(+), 10 deletions(-)
---
(DIR) diff --git a/src/icefloe.jl b/src/icefloe.jl
t@@ -699,7 +699,7 @@ function plotIceFloeSizeDistribution(simulation::Simulation;
log_y::Bool = true)
if !hasPyPlot
- warn("Function not available because PyPlot is not installed")
+ error("Function not available because PyPlot is not installed")
return
end
diameters = Float64[]
(DIR) diff --git a/test/icefloe.jl b/test/icefloe.jl
t@@ -29,12 +29,16 @@ SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., verbose=false)
SeaIce.addIceFloeCylindrical!(sim, [ 0., 0.], 10., 1., verbose=false)
SeaIce.compareIceFloes(sim.ice_floes[1], sim.ice_floes[2])
-SeaIce.plotIceFloeSizeDistribution(sim)
-rm("test-ice-floe-size-distribution.png")
-SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false)
-rm("test-ice-floe-size-distribution.png")
-SeaIce.plotIceFloeSizeDistribution(sim, log_y=false)
-rm("test-ice-floe-size-distribution.png")
-SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal")
-rm("test-ice-floe-size-distribution.png")
-@test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_type="asdf")
+if typeof(Pkg.installed("PyPlot")) == VersionNumber
+ SeaIce.plotIceFloeSizeDistribution(sim)
+ rm("test-ice-floe-size-distribution.png")
+ SeaIce.plotIceFloeSizeDistribution(sim, skip_fixed=false)
+ rm("test-ice-floe-size-distribution.png")
+ SeaIce.plotIceFloeSizeDistribution(sim, log_y=false)
+ rm("test-ice-floe-size-distribution.png")
+ SeaIce.plotIceFloeSizeDistribution(sim, size_type="areal")
+ rm("test-ice-floe-size-distribution.png")
+ @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim, size_type="asdf")
+else
+ @test_throws ErrorException SeaIce.plotIceFloeSizeDistribution(sim)
+end