Skip to content

Instantly share code, notes, and snippets.

@mattions mattions/a.param
Created Jun 27, 2011

Embed
What would you like to do?
Easy way to get params from external file in the main script (and work with them)
# Parameters file for simulation.
{
"dt" : 0.025, # integration dt [ms]
"dict_ampa_s1" :
{"t_stim" : 0.130, # t_stim [s]
"numbers" : 4, # number
"delay" : 0.1, # delay [s]
"type" : "ampa" # , type
},
"dict_ampa_s2" :
{"t_stim" : 0.230, # t_stim [s]
"numbers" : 3, # number
"delay" : 0.1, # delay [s]
"type" : "ampa" # , type
},
'sec_to_rec' : ['all'],
"var_to_plot" : ['v','cai','cali','ica'],
}
import sys
from sumatra.external.NeuroTools import parameters
if __name__ == "__main__":
if len(sys.argv) != 2:
print("No parameter file supplied. Abort.")
usage = 'python %s parameters_file.param' %__file__
print usage
sys.exit()
parameter_file = sys.argv[1]
parameter_dict = parameters.ParameterSet(parameter_file)
parameter_dict # contains all the param.
parameter_dict['dt'] # value is 0.025 Python Float
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.