JuliaDynamics / StateSpaceSets.jl

The `StateSpaceSet` interface for packages of JuliaDynamics
MIT License
2 stars 3 forks source link

Tests of state space sampler #16

Closed MartinMikkelsen closed 1 year ago

MartinMikkelsen commented 1 year ago

This PR includes a quick implementation of tests of the state space sampler. I've organized it in the following way: The tests are organized within a @testset block named statespace_sampler. Within this block are the test functions, for instance:

test_statespace_sampler_rectangular_box(): This function tests the statespace_sampler function with a rectangular box method. It defines a rectangular box region with minimum and maximum bounds, generates a sampler and an isinside function using statespace_sampler with the specified parameters, and then generates random points using the gen() function and checks if they are inside the box region using the isinside() function. This test is repeated 250 times using a for loop.

And similarly for test_statespace_sampler_multivariate_gaussian_box(), test_statespace_sampler_sphere_3D(), and test_statespace_sampler_sphere_4D().

I noticed the tests for sampler_multivariate_gaussian_box() failed with error: Got exception outside of a @test MethodError: no method matching mean(::StateSpaceSet{2, Int64}; dims=2).

For some reason, it passes when I delete dims=2 in center = mean(hcat(as,bs), dims=2)?