16 #include <unordered_map>
19 #include <bbp/sonata/edges.h>
20 #include <bbp/sonata/nodes.h>
21 #include <bbp/sonata/optional.hpp>
24 #include "optional.hpp"
25 #include "variant.hpp"
33 struct CommonPopulationProperties {
76 std::string spatialSegmentIndexDir;
104 std::string spatialSynapseIndexDir;
123 enum class ConfigStatus {
147 CircuitConfig(
const std::string& contents,
const std::string& basePath);
166 ConfigStatus getCircuitConfigStatus()
const;
171 const std::string& getNodeSetsPath()
const;
176 std::set<std::string> listNodePopulations()
const;
189 std::set<std::string> listEdgePopulations()
const;
222 const std::string& getExpandedJSON()
const;
226 std::string morphologiesDir;
227 std::unordered_map<std::string, std::string> alternateMorphologiesDir;
228 std::string biophysicalNeuronModelsDir;
241 std::string _expandedJSON;
244 ConfigStatus _status = ConfigStatus::complete;
247 std::string _nodeSetsFile;
250 std::unordered_map<std::string, NodePopulationProperties> _nodePopulationProperties;
253 std::unordered_map<std::string, EdgePopulationProperties> _edgePopulationProperties;
259 class SONATA_API SimulationConfig
266 enum class IntegrationMethod { invalid = -1, euler, nicholson, nicholson_ion };
268 static constexpr
double DEFAULT_spikeThreshold = -30.0;
269 static constexpr IntegrationMethod DEFAULT_IntegrationMethod = IntegrationMethod::euler;
270 static constexpr
int DEFAULT_stimulusSeed = 0;
271 static constexpr
int DEFAULT_ionchannelSeed = 0;
272 static constexpr
int DEFAULT_minisSeed = 0;
273 static constexpr
int DEFAULT_synapseSeed = 0;
282 double spikeThreshold = DEFAULT_spikeThreshold;
285 IntegrationMethod integrationMethod = DEFAULT_IntegrationMethod;
288 int stimulusSeed = DEFAULT_stimulusSeed;
290 int ionchannelSeed = DEFAULT_ionchannelSeed;
293 int minisSeed = DEFAULT_minisSeed;
295 int synapseSeed = DEFAULT_synapseSeed;
297 std::string electrodesFile;
303 enum class SpikesSortOrder { invalid = -1, none, by_id, by_time };
305 static constexpr
char DEFAULT_outputDir[] =
"output";
306 static constexpr
char DEFAULT_logFile[] =
"";
307 static constexpr
char DEFAULT_spikesFile[] =
"out.h5";
308 static constexpr SpikesSortOrder DEFAULT_sortOrder = SpikesSortOrder::by_time;
311 std::string outputDir = DEFAULT_outputDir;
313 std::string logFile = DEFAULT_logFile;
315 std::string spikesFile = DEFAULT_spikesFile;
317 SpikesSortOrder sortOrder = DEFAULT_sortOrder;
321 enum class ModificationType { invalid = -1, TTX, ConfigureAllSections };
326 ModificationType type;
337 std::string sectionConfigure;
346 enum class SpikeLocation { invalid = -1, soma, AIS };
347 static constexpr
double DEFAULT_celsius = 34.0;
348 static constexpr
double DEFAULT_vInit = -80.0;
349 static constexpr SpikeLocation DEFAULT_spikeLocation = SpikeLocation::soma;
350 static constexpr
bool DEFAULT_randomizeGabaRiseTime =
false;
353 double celsius = DEFAULT_celsius;
355 double vInit = DEFAULT_vInit;
357 SpikeLocation spikeLocation = DEFAULT_spikeLocation;
363 bool randomizeGabaRiseTime = DEFAULT_randomizeGabaRiseTime;
367 std::unordered_map<std::string, std::unordered_map<std::string, variantValueType>>
370 std::vector<Modification> modifications;
372 const std::vector<Modification>& getModifications() const noexcept;
378 enum class Sections { invalid = -1, soma, axon, dend, apic, all };
379 enum class Type { invalid = -1, compartment, lfp, summation, synapse };
380 enum class Scaling { invalid = -1, none, area };
381 enum class Compartments { invalid = -1, center, all };
394 Compartments compartments;
398 std::string variableName;
408 std::string fileName;
413 using ReportMap = std::unordered_map<std::string, Report>;
431 relative_ornstein_uhlenbeck
434 enum class InputType {
437 extracellular_stimulation,
455 struct InputLinear:
public InputBase {
461 bool representsPhysicalElectrode =
false;
466 double percentStart{};
470 bool representsPhysicalElectrode =
false;
481 bool representsPhysicalElectrode =
false;
492 bool representsPhysicalElectrode =
false;
497 double percentLess{};
499 bool representsPhysicalElectrode =
false;
504 bool representsPhysicalElectrode =
false;
509 std::string spikeFile;
516 double seriesResistance{};
528 bool representsPhysicalElectrode =
false;
550 bool representsPhysicalElectrode =
false;
566 double meanPercent{};
571 bool representsPhysicalElectrode =
false;
575 double relativeSkew{};
594 bool representsPhysicalElectrode =
false;
598 double relativeSkew{};
615 bool representsPhysicalElectrode =
false;
629 double meanPercent{};
634 bool representsPhysicalElectrode =
false;
652 using InputMap = std::unordered_map<std::string, Input>;
689 enum class SimulatorType { invalid = -1, NEURON, CORENEURON };
714 const std::string& getBasePath() const noexcept;
719 const std::
string& getJSON() const noexcept;
724 const std::
string& getNetwork() const noexcept;
729 const
Run& getRun() const noexcept;
734 const
Output& getOutput() const noexcept;
739 const
Conditions& getConditions() const noexcept;
744 std::set<std::
string> listReportNames() const;
752 const
Report& getReport(const std::
string& name) const;
757 std::set<std::
string> listInputNames() const;
764 const
Input& getInput(const std::
string& name) const;
782 const std::
string& getNodeSetsFile() const noexcept;
787 const nonstd::optional<std::
string>& getNodeSet() const noexcept;
792 const std::unordered_map<std::
string,
variantValueType>& getMetaData() const noexcept;
798 const std::unordered_map<std::
string,
variantValueType>& getBetaFeatures() const noexcept;
804 const std::
string& getExpandedJSON() const;
808 std::
string _expandedJSON;
810 std::
string _basePath;
821 std::
string _network;
827 SimulatorType _targetSimulator;
829 std::
string _nodeSetsFile;
831 nonstd::optional<std::
string> _nodeSet{nonstd::nullopt};
833 std::unordered_map<std::string, variantValueType> _metaData;
835 std::unordered_map<std::string, variantValueType> _betaFeatures;