Skip to content

Commit

Permalink
Merge branch 'master' into double-ctest
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeplf authored Nov 13, 2024
2 parents c4e7144 + a9650ad commit 9ed998d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions include/bbp/sonata/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class SONATA_API SimulationConfig
* Parameters defining global simulation settings for spike reports
*/
struct Run {
enum class IntegrationMethod { invalid = -1, euler, nicholson, nicholson_ion };
enum class IntegrationMethod { invalid = -1, euler, crank_nicolson, crank_nicolson_ion };

static constexpr double DEFAULT_spikeThreshold = -30.0;
static constexpr IntegrationMethod DEFAULT_IntegrationMethod = IntegrationMethod::euler;
Expand All @@ -281,7 +281,7 @@ class SONATA_API SimulationConfig
/// The spike detection threshold. Default is -30mV
double spikeThreshold = DEFAULT_spikeThreshold;
/// Selects the NEURON/CoreNEURON integration method. This parameter sets the NEURON
/// global variable h.secondorder. Default 0 ('euler')
/// global variable h.secondorder, default is "euler".
IntegrationMethod integrationMethod = DEFAULT_IntegrationMethod;
/// A non-negative integer used for seeding noise stimuli and any other future stochastic
/// stimuli, default is 0.
Expand Down
4 changes: 2 additions & 2 deletions python/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,8 @@ PYBIND11_MODULE(_libsonata, m) {

py::enum_<SimulationConfig::Run::IntegrationMethod>(run, "IntegrationMethod")
.value("euler", SimulationConfig::Run::IntegrationMethod::euler)
.value("nicholson", SimulationConfig::Run::IntegrationMethod::nicholson)
.value("nicholson_ion", SimulationConfig::Run::IntegrationMethod::nicholson_ion);
.value("crank_nicolson", SimulationConfig::Run::IntegrationMethod::crank_nicolson)
.value("crank_nicolson_ion", SimulationConfig::Run::IntegrationMethod::crank_nicolson_ion);

py::class_<SimulationConfig::Output> output(simConf,
"Output",
Expand Down
10 changes: 5 additions & 5 deletions python/generated/docstrings.h
Original file line number Diff line number Diff line change
Expand Up @@ -1157,21 +1157,21 @@ static const char *__doc_bbp_sonata_SimulationConfig_Run = R"doc(Parameters defi

static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod = R"doc()doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_euler = R"doc()doc";
static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_crank_nicolson = R"doc()doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_invalid = R"doc()doc";
static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_crank_nicolson_ion = R"doc()doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_nicholson = R"doc()doc";
static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_euler = R"doc()doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_nicholson_ion = R"doc()doc";
static const char *__doc_bbp_sonata_SimulationConfig_Run_IntegrationMethod_invalid = R"doc()doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_dt = R"doc(Integration step duration in milliseconds)doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_electrodesFile = R"doc(Filename that contains the weights for the LFP calculation.)doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_integrationMethod =
R"doc(Selects the NEURON/CoreNEURON integration method. This parameter sets
the NEURON global variable h.secondorder. Default 0 ('euler'))doc";
the NEURON global variable h.secondorder, default is "euler".)doc";

static const char *__doc_bbp_sonata_SimulationConfig_Run_ionchannelSeed =
R"doc(A non-negative integer used for seeding stochastic ion channels,
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def test_basic(self):
self.assertEqual(self.config.run.random_seed, 201506)
self.assertEqual(self.config.run.spike_threshold, -35.5)
self.assertEqual(self.config.run.integration_method,
SimulationConfig.Run.IntegrationMethod.nicholson_ion)
SimulationConfig.Run.IntegrationMethod.crank_nicolson_ion)
self.assertEqual(self.config.run.stimulus_seed, 111)
self.assertEqual(self.config.run.ionchannel_seed, 222)
self.assertEqual(self.config.run.minis_seed, 333)
Expand Down
11 changes: 6 additions & 5 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@ NLOHMANN_JSON_SERIALIZE_ENUM(SimulationConfig::Conditions::SpikeLocation,
{SimulationConfig::Conditions::SpikeLocation::soma, "soma"},
{SimulationConfig::Conditions::SpikeLocation::AIS, "AIS"}})

NLOHMANN_JSON_SERIALIZE_ENUM(SimulationConfig::Run::IntegrationMethod,
{{SimulationConfig::Run::IntegrationMethod::invalid, nullptr},
{SimulationConfig::Run::IntegrationMethod::euler, 0},
{SimulationConfig::Run::IntegrationMethod::nicholson, 1},
{SimulationConfig::Run::IntegrationMethod::nicholson_ion, 2}})
NLOHMANN_JSON_SERIALIZE_ENUM(
SimulationConfig::Run::IntegrationMethod,
{{SimulationConfig::Run::IntegrationMethod::invalid, nullptr},
{SimulationConfig::Run::IntegrationMethod::euler, "euler"},
{SimulationConfig::Run::IntegrationMethod::crank_nicolson, "crank_nicolson"},
{SimulationConfig::Run::IntegrationMethod::crank_nicolson_ion, "crank_nicolson_ion"}})

NLOHMANN_JSON_SERIALIZE_ENUM(SimulationConfig::Output::SpikesSortOrder,
{{SimulationConfig::Output::SpikesSortOrder::invalid, nullptr},
Expand Down
2 changes: 1 addition & 1 deletion tests/data/config/simulation_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"ionchannel_seed": 222,
"minis_seed": 333,
"synapse_seed": 444,
"integration_method" : 2,
"integration_method" : "crank_nicolson_ion",
"forward_skip": 500,
"electrodes_file": "$ELECTRODES_DIR/electrode_weights.h5",
"spike_threshold": -35.5
Expand Down
3 changes: 2 additions & 1 deletion tests/test_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ TEST_CASE("SimulationConfig") {
CHECK(config.getRun().dt == 0.025);
CHECK(config.getRun().randomSeed == 201506);
CHECK(config.getRun().spikeThreshold == -35.5);
CHECK(config.getRun().integrationMethod == SimulationConfig::Run::IntegrationMethod::nicholson_ion);
CHECK(config.getRun().integrationMethod ==
SimulationConfig::Run::IntegrationMethod::crank_nicolson_ion);
CHECK(config.getRun().stimulusSeed == 111);
CHECK(config.getRun().ionchannelSeed == 222);
CHECK(config.getRun().minisSeed == 333);
Expand Down

0 comments on commit 9ed998d

Please sign in to comment.