Skip to content

Commit 243e811

Browse files
minor change
1 parent faeddcc commit 243e811

5 files changed

Lines changed: 28 additions & 9 deletions

File tree

bindings/python/src/stochastic/sampling/direct/double_sampler.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ namespace geode
6060
.def_static( "create_distribution",
6161
&DoubleSampler::create_distribution, pybind11::arg( "desc" ),
6262
"Create a distribution from a description" )
63+
.def_static( "create_rad_angle_distribution_from_degree",
64+
&DoubleSampler::create_rad_angle_distribution_from_degree,
65+
pybind11::arg( "desc" ),
66+
"Create a angle distribution in radian from a description "
67+
"provided in degree" )
6368
.def_static( "sample", &DoubleSampler::sample,
6469
pybind11::arg( "engine" ), pybind11::arg( "dist" ),
6570
"Sample a value from a distribution using a RandomEngine" );

bindings/python/src/stochastic/sampling/distributions.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ namespace geode
8787
&TruncatedGaussian::distribution_type_static )
8888
.def( "distribution_type", &TruncatedGaussian::distribution_type )
8989
.def( "string", &TruncatedGaussian::string );
90+
91+
// VonMises
92+
pybind11::class_< VonMises >( module, "VonMises" )
93+
.def( pybind11::init<>() )
94+
.def_readwrite( "mean", &VonMises::mean )
95+
.def_readwrite( "concentration", &VonMises::concentration )
96+
.def( "is_valid", &VonMises::is_valid )
97+
.def_static( "distribution_type_static",
98+
&VonMises::distribution_type_static )
99+
.def( "distribution_type", &VonMises::distribution_type )
100+
.def( "string", &VonMises::string );
90101
}
91102

92103
} // namespace geode

bindings/python/src/stochastic/sampling/random_engine.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ namespace geode
6464
&RandomEngine::sample_truncated_gaussian,
6565
pybind11::arg( "law" ),
6666
"Sample a value from a truncated Gaussian" )
67+
.def( "sample_von_mises", &RandomEngine::sample_von_mises,
68+
pybind11::arg( "law" ),
69+
"Sample a value from a Von Mises-Fisher" )
6770

6871
// Other distributions
6972
.def( "sample_log", &RandomEngine::sample_log,

bindings/python/tests/stochastic/test-py-mh-fractures.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def test_fracture_simulator():
5757
setA.azimuth.max_value = 10.0
5858

5959
# positioning
60-
setA.p20 = 0.1
60+
setA.p20 = 0.06
6161
setA.minimal_spacing = 1.0
6262

6363
runner = stochastic.FractureSimulationRunner(box)
@@ -97,10 +97,10 @@ def test_two_fracture_sets_simulator():
9797
setA.length.distribution_type = stochastic.DistributionType("UniformClosed")
9898
setA.length.min_value = 1.0
9999
setA.length.max_value = 10.0
100-
setA.azimuth.distribution_type = stochastic.DistributionType("UniformClosed")
101-
setA.azimuth.min_value = 1.0
102-
setA.azimuth.max_value = 10.0
103-
setA.p20 = 0.1
100+
setA.azimuth.distribution_type = stochastic.DistributionType("VonMises")
101+
setA.azimuth.mean = 45
102+
setA.azimuth.standard_deviation = 10.0
103+
setA.p20 = 0.05
104104
setA.minimal_spacing = 1.0
105105

106106
# --- Object set B
@@ -112,7 +112,7 @@ def test_two_fracture_sets_simulator():
112112
setB.azimuth.distribution_type =stochastic.DistributionType("UniformClosed")
113113
setB.azimuth.min_value = 90.0
114114
setB.azimuth.max_value = 100.0
115-
setB.p20 = 0.1
115+
setB.p20 = 0.03
116116
setB.minimal_spacing = 2.0
117117

118118
runner = stochastic.FractureSimulationRunner(box)

tests/stochastic/sampling/mcmc/test-mh-fractures.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace
5454
setA.azimuth.max_value = 10.;
5555

5656
// positionning
57-
setA.p20 = 0.1;
57+
setA.p20 = 0.05;
5858
setA.minimal_spacing = 1.;
5959

6060
geode::FractureSimulationRunner runner( box );
@@ -108,7 +108,7 @@ namespace
108108
setA.azimuth.max_value = 10.;
109109

110110
// positionning
111-
setA.p20 = 0.1;
111+
setA.p20 = 0.05;
112112
setA.minimal_spacing = 1.;
113113

114114
// --- Object set
@@ -128,7 +128,7 @@ namespace
128128
setB.azimuth.standard_deviation = 15.;
129129

130130
// positionning
131-
setB.p20 = 0.1;
131+
setB.p20 = 0.05;
132132
setB.minimal_spacing = 2.;
133133

134134
geode::FractureSimulationRunner runner( box );

0 commit comments

Comments
 (0)