Skip to content

Commit

Permalink
Keep rngMode in RNGSettings.hoc
Browse files Browse the repository at this point in the history
  • Loading branch information
atemerev authored and WeinaJi committed Apr 25, 2024
1 parent aeb7bf2 commit 2e7f35d
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions neurodamus/data/hoc/RNGSettings.hoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
{load_file("fileUtils.hoc")}

rngMode = 1 // corresponds to RANDOM123 defined below
ionchannelSeed = 0
synapseSeed = 0
stimulusSeed = 0
Expand All @@ -15,11 +16,14 @@ globalSeed = 0

begintemplate RNGSettings

public init, interpret, getIonChannelSeed, getSynapseSeed, getStimulusSeed, getMinisSeed, getGlobalSeed
public init, interpret, getRNGMode, getIonChannelSeed, getSynapseSeed, getStimulusSeed, getMinisSeed, getGlobalSeed
public RANDOM123

external ionchannelSeed, synapseSeed, stimulusSeed, minisSeed, globalSeed, terminate
external rngMode, ionchannelSeed, synapseSeed, stimulusSeed, minisSeed, globalSeed, terminate

proc init() {
// consts for random number handling
RANDOM123 = 1
}

/**
Expand All @@ -31,6 +35,7 @@ proc init() {
proc interpret() { local coreNeuronUsed localobj runInfo, pc, rng
strdef rngModeField
runInfo = $o1
rngMode = RANDOM123
coreNeuronUsed = $2
if (numarg() < 2) {
coreNeuronUsed = 0
Expand All @@ -41,6 +46,15 @@ proc interpret() { local coreNeuronUsed localobj runInfo, pc, rng
print "As of Oct 2020 Neurodamus uses Random123 as default"
}

if( runInfo.exists( "RNGMode" ) ) {
rngModeField = runInfo.get( "RNGMode" ).s
if( strcmp( rngModeField, "Random123" ) == 0 ) {
rngMode = RANDOM123
} else {
terminate( "Invalid RNGMode (only Random123 is currently supported) ", rngModeField )
}
}

if( runInfo.exists("BaseSeed") ) {
globalSeed = runInfo.valueOf( "BaseSeed" )

Expand All @@ -63,6 +77,10 @@ proc interpret() { local coreNeuronUsed localobj runInfo, pc, rng
}
}

func getRNGMode() {
return rngMode
}

func getIonChannelSeed() {
return ionchannelSeed
}
Expand Down

0 comments on commit 2e7f35d

Please sign in to comment.