def main(): """ Main *boilerplate* function to start simulation """ # Now let's make use of logging logger = logging.getLogger() # Create folders for data and plots folder = os.path.join(os.getcwd(), 'experiments', 'ca_patterns_pypet') if not os.path.isdir(folder): os.makedirs(folder) filename = os.path.join(folder, 'all_patterns.hdf5') # Create an environment env = Environment(trajectory='cellular_automata', multiproc=True, ncores=4, wrap_mode='QUEUE', filename=filename, overwrite_file=True) # extract the trajectory traj = env.traj traj.par.ncells = Parameter('ncells', 400, 'Number of cells') traj.par.steps = Parameter('steps', 250, 'Number of timesteps') traj.par.rule_number = Parameter('rule_number', 30, 'The ca rule') traj.par.initial_name = Parameter('initial_name', 'random', 'The type of initial state') traj.par.seed = Parameter('seed', 100042, 'RNG Seed') # Explore exp_dict = { 'rule_number': [10, 30, 90, 110, 184], 'initial_name': ['single', 'random'], } # # You can uncomment the ``exp_dict`` below to see that changing the # # exploration scheme is now really easy: # exp_dict = {'rule_number' : [10, 30, 90, 110, 184], # 'ncells' : [100, 200, 300], # 'seed': [333444555, 123456]} exp_dict = cartesian_product(exp_dict) traj.f_explore(exp_dict) # Run the simulation logger.info('Starting Simulation') env.run(wrap_automaton) # Load all data traj.f_load(load_data=2) logger.info('Printing data') for idx, run_name in enumerate(traj.f_iter_runs()): # Plot all patterns filename = os.path.join(folder, make_filename(traj)) plot_pattern(traj.crun.pattern, traj.rule_number, filename) progressbar(idx, len(traj), logger=logger) # Finally disable logging and close all log-files env.disable_logging()
def test_max_depth_loading_and_storing(self): filename = make_temp_dir('newassignment.hdf5') traj = Trajectory(filename=filename, overwrite_file=True) traj.par.d1 = Parameter('d1.d2.d3.d4.d5', 55) traj.f_store(max_depth=4) traj = load_trajectory(index=-1, filename=filename) traj.f_load(load_data=2) self.assertTrue('d3' in traj) self.assertFalse('d4' in traj) traj = load_trajectory(index=-1, filename=filename, max_depth=3) self.assertTrue('d2' in traj) self.assertFalse('d3' in traj) traj.par.f_remove(recursive=True) traj.dpar.d1 = Parameter('d1.d2.d3.d4.d5', 123) traj.dpar.f_store_child('d1', recursive=True, max_depth=3) traj.dpar.f_remove_child('d1', recursive=True) self.assertTrue('d1' not in traj) traj.dpar.f_load_child('d1', recursive=True) self.assertTrue('d3' in traj) self.assertTrue('d4' not in traj) traj.dpar.f_remove_child('d1', recursive=True) self.assertTrue('d1' not in traj) traj.dpar.f_load_child('d1', recursive=True, max_depth=2) self.assertTrue('d2' in traj) self.assertTrue('d3' not in traj) traj.dpar.l1 = Parameter('l1.l2.l3.l4.l5', 123) traj.dpar.f_store(recursive=True, max_depth=0) self.assertFalse(traj.dpar.l1._stored) traj.dpar.f_store(recursive=True, max_depth=4) traj.dpar.f_remove() self.assertTrue('l1' not in traj) traj.dpar.f_load(recursive=True) self.assertTrue('l4' in traj) self.assertTrue('l5' not in traj) traj.dpar.f_remove() self.assertTrue('l1' not in traj) traj.dpar.f_load(recursive=True, max_depth=3) self.assertTrue('l3' in traj) self.assertTrue('l4' not in traj)
def test_loading_explored_parameters(self): filename = make_temp_dir('load_explored.hdf5') traj = Trajectory(filename=filename, overwrite_file=True, add_time=False) traj.par.x = Parameter('x', 42, comment='answer') traj.f_explore({'x':[1,2,3,4]}) traj.f_store() name = traj.v_name traj = Trajectory(filename=filename, add_time=False) traj.f_load() x = traj.f_get('x') self.assertIs(x, traj._explored_parameters['parameters.x'])
def test_no_run_information_loading(self): filename = make_temp_dir('testnoruninfo.hdf5') traj = Trajectory(name='TestDelete', filename=filename, add_time=True) length = 100000 traj.par.x = Parameter('', 42) traj.f_explore({'x': range(length)}) traj.f_store() traj = load_trajectory(index=-1, filename=filename, with_run_information=False) self.assertEqual(len(traj), length) self.assertEqual(len(traj._run_information), 1)
def test_full_store(self): filename = make_temp_dir('full_store.hdf5') with Environment(filename=filename, log_config=get_log_config()) as env: traj = env.v_trajectory traj.par.x = Parameter('x', 3, 'jj') traj.f_explore({'x': [1,2,3]}) env.f_run(add_one_particular_item, True) traj = load_trajectory(index=-1, filename=filename) self.assertTrue('hi' in traj)
def add_parameters(traj, params, use_balanced_sc=False): traj.f_add_parameter_group('simulation', comment='simulation parameters') traj.simulation.dt = Parameter( 'dt', params['dt'], comment= 'Size of simulation timestep [ms], choose so that integration is stable!' ) traj.simulation.duration = Parameter('duration', params['duration'], comment='total simulation time [ms]') traj.f_add_parameter_group('globalNetwork', comment='global network parameters') traj.globalNetwork.I = Parameter('I', params['I']) traj.globalNetwork.K = Parameter('K', params['K']) traj.globalNetwork.sigma = Parameter('sigma', params['sigma']) traj.globalNetwork.c = Parameter('c', params['c']) traj.globalNetwork.ou_mean = Parameter('ou_mean', params['ou_mean']) traj.globalNetwork.ou_sigma = Parameter('ou_sigma', params['ou_sigma']) traj.globalNetwork.ou_tau = Parameter('ou_tau', params['ou_tau']) if use_balanced_sc: traj.globalNetwork.SC = Parameter('SC', params['SC_lr']) else: traj.globalNetwork.SC = Parameter('SC', params['SC']) traj.globalNetwork.DM = Parameter('DM', params['DM']) traj.globalNetwork.N = Parameter('N', params['N']) traj.globalNetwork.dif = Parameter('dif', params['dif']) traj.f_add_parameter_group('localModel', comment='local model parameters') traj.localModel.alpha = Parameter('alpha', params['alpha']) traj.localModel.beta = Parameter('beta', params['beta']) traj.localModel.gamma = Parameter('gamma', params['gamma']) traj.localModel.delta = Parameter('delta', params['delta']) traj.localModel.epsilon = Parameter('epsilon', params['epsilon']) traj.localModel.tau = Parameter('tau', params['tau']) traj.localModel.init = Parameter('init', params['init']) traj.localModel.randominitstd = Parameter( 'randominitstd', params['randominitstd'], comment='add gaussian noise with std on initial values') traj.f_add_parameter_group('evaluation', comment='threshold/analysis parameter for eval') traj.evaluation.u_thres = Parameter( 'u_thres', params['u_thres'], comment='threshold for HS/LS when no oscillation') traj.evaluation.rms_thres = Parameter( 'rms_thres', params['rms_thres'], comment='threshold for the significance of a freq amplitude') traj.evaluation.gausfilter = Parameter( 'gausfilter', params['gausfilter'], comment='if >0: filter us before analysing')
traj.f_add_result('runs.$.z', z, comment='Result of our simulation!') # Create an environment that handles running filename = os.path.join('hdf5', 'example_14.hdf5') env = Environment(trajectory='Multiplication', filename=filename, file_title='Example_14_Links', overwrite_file=True, comment='How to use links') # The environment has created a trajectory container for us traj = env.trajectory # Add both parameters traj.par.x = Parameter('x', 1, 'I am the first dimension!') traj.par.y = Parameter('y', 1, 'I am the second dimension!') # Explore just two points traj.f_explore({'x': [3, 4]}) # So far everything was as in the first example. However now we add links: traj.f_add_link('mylink1', traj.f_get('x')) # Note the `f_get` here to ensure to get the parameter instance, not the value 1 # This allows us now to access x differently: print('x=' + str(traj.mylink1)) # We can try to avoid fast access as well, and recover the original parameter print(str(traj.f_get('mylink1'))) # And also colon notation is allowed that creates new groups on the fly traj.f_add_link('parameters.mynewgroup.mylink2', traj.f_get('y'))
def add_params(self, traj): traj.par.p1 = Parameter('', 42, 'Hey') traj.f_apar('g1.p2', 145, comment='Test')
def add_parameters(traj, params): """ Adds parameters to existing Trajectory 'traj' using dict params The added parameters are the one from the interareal network with the aLN cascade model for the local dynamic. WARNING: pypet 3.0 doesn't support lazy loading anymore, this function will not work! """ ### simulation parameters traj.f_add_parameter_group( 'simulation', comment='Group containing simulation parameters') traj.simulation.model = Parameter('model', params['model'], comment='Which model to run (aln/brian)') traj.simulation.dt = Parameter('dt', params['dt'], comment='I am a useful comment!' ) # params['dt'], 'integration time step' traj.simulation.duration = Parameter('duration', params['duration'], comment='total simulation time [ms]') traj.simulation.warn = Parameter( 'warn', params['warn'], comment='warns if out of precalc limits in \ interpolation, 0 for faster computation' ) traj.simulation.dosc_version = Parameter('dosc_version', params['dosc_version'], comment='use dosc_version (1/0)') traj.simulation.fast_interp = Parameter( 'fast_interp', params['fast_interp'], comment='Interpolate the value from the look-up table \ instead of taking the closest value' ) traj.simulation.distr_delay = Parameter( 'distr_delay', params['distr_delay'], comment='use distributed delay instead of fixed (1/0)') traj.simulation.filter_sigma = Parameter( 'filter_sigma', params['filter_sigma'], comment='full filter used for sigmae/sigmai(1),\ else use dirac filter(0)' ) traj.simulation.seed = Parameter('seed', params['seed'], comment='Random Seed for Noise and ICs') # global coupling parameters traj.f_add_parameter_group('globalNetwork', comment='Group containing \ global network coupling parameters') traj.globalNetwork.N = Parameter( 'N', params['N'], 'Number of nodes in SC (or for brian: number of neurons in one pop)') traj.globalNetwork.density = Parameter('density', params['density'],\ comment='density of SC: cutoff weakest links, from 1 to 0') traj.globalNetwork.global_delay = Parameter('global_delay', params['global_delay'],\ comment='use global interareal delays, 1 or 0') #traj.globalNetwork.CmatFileName = Parameter('CmatFileName', params['CmatFileName'],\ #comment='File name for the connectivity matrix') #traj.globalNetwork.DmatFileName = Parameter('DmatFileName', params['DmatFileName'],\ #comment='File name for the delay matrix') traj.globalNetwork.Cmat = Parameter('Cmat', params['Cmat'], comment='relative coupling strengths, \ Cmat[i,j]: connection from jth to ith (values between 0 and 1)' ) traj.globalNetwork.lengthMat = Parameter('lengthMat', params['lengthMat'], comment='fiber length matrix') traj.globalNetwork.signalV = Parameter( 'signalV', params['signalV'], comment='[m/s] Signal velocity for the interareal connections') traj.globalNetwork.c_gl = Parameter('c_gl', params['c_gl'], comment='global coupling strength \ between areas(unitless)') traj.globalNetwork.Ke_gl = Parameter( 'Ke_gl', params['Ke_gl'], comment='number of incoming E connect-\ ions from each area') # local network (area) parameters traj.f_add_parameter_group('localNetwork', comment='Group containing \ local network (area) parameters') traj.localNetwork.load_point = Parameter( 'load_point', params['load_point'], comment='Specifies which parameter point to load (from Cakan 2019)') # external input parameters: traj.localNetwork.tau_ou = Parameter('tau_ou', params['tau_ou'], comment='[ms]') traj.localNetwork.sigma_ou = Parameter('sigma_ou', params['sigma_ou'], comment='[mV/ms/sqrt(ms)]') traj.localNetwork.mue_ext_mean = Parameter('mue_ext_mean', params['mue_ext_mean'], comment='[mV/ms] (OU process)') traj.localNetwork.mui_ext_mean = Parameter('mui_ext_mean', params['mui_ext_mean'], comment='[mV/ms] (OU process)') traj.localNetwork.sigmae_ext = Parameter('sigmae_ext', params['sigmae_ext'], comment='[mV/sqrt(ms)]') traj.localNetwork.sigmai_ext = Parameter('sigmai_ext', params['sigmai_ext'], comment='[mV/sqrt(ms)]') traj.localNetwork.ext_exc_rate = Parameter( 'ext_exc_rate', params['ext_exc_rate'], comment='external excitatory rate input [kHz]') traj.localNetwork.ext_inh_rate = Parameter( 'ext_inh_rate', params['ext_inh_rate'], comment='external inhibitory rate input [kHz]') traj.localNetwork.ext_inh_current = Parameter( 'ext_inh_current', params['ext_inh_current'], comment='external inhibitory field input [mV/ms?]') traj.localNetwork.ext_exc_current = Parameter( 'ext_exc_current', params['ext_exc_current'], comment='external excitatory field input [mV/ms?]') # sinusodial input paramters traj.localNetwork.A_sin = Parameter('A_sin', params['A_sin']) traj.localNetwork.f_sin = Parameter('f_sin', params['f_sin']) traj.localNetwork.ph_sin = Parameter('ph_sin', params['ph_sin']) # recurrent coupling parameters traj.localNetwork.Ke = Parameter('Ke', params['Ke'], comment='"EE = IE" assumed') traj.localNetwork.Ki = Parameter('Ki', params['Ki'], comment='"EI = II" assumed') traj.localNetwork.de = Parameter('de', params['de'], comment='[ms] local constant delay, \ "EE = IE"') traj.localNetwork.di = Parameter('di', params['di'], comment='[ms] local constant delay, \ "EI = II"') traj.localNetwork.tau_se = Parameter('tau_se', params['tau_se'], comment='[ms], "EE = IE"') traj.localNetwork.tau_si = Parameter('tau_si', params['tau_si'], comment='[ms], "EI = II"') traj.localNetwork.cee = Parameter('cee', params['cee'], comment='(unitless)') traj.localNetwork.cei = Parameter('cei', params['cei'], comment='(unitless)') traj.localNetwork.cii = Parameter('cii', params['cii'], comment='(unitless)') traj.localNetwork.cie = Parameter('cie', params['cie'], comment='(unitless)') traj.localNetwork.Jee_max = Parameter('Jee_max', params['Jee_max'], comment='[mV/ms]') traj.localNetwork.Jie_max = Parameter('Jie_max', params['Jie_max'], comment='[mV/ms]') traj.localNetwork.Jei_max = Parameter('Jei_max', params['Jei_max'], comment='[mV/ms]') traj.localNetwork.Jii_max = Parameter('Jii_max', params['Jii_max'], comment='[mV/ms]') traj.localNetwork.tau_di = Parameter( 'tau_di', params['tau_di'], comment= '[ms] Distributed delay time constant, local inhibitory connection') traj.localNetwork.tau_de = Parameter( 'tau_de', params['tau_de'], comment= '[ms] Distributed delay time constant, local excitatory connection') # neuron model parameters traj.f_add_parameter_group('neuron', comment='Group containing \ neuron model parameters') traj.neuron.a = Parameter('a', params['a'], comment='nS') traj.neuron.b = Parameter('b', params['b'], comment='pA') traj.neuron.EA = Parameter('EA', params['EA'], comment='mV') traj.neuron.tauA = Parameter('tauA', params['tauA'], comment='ms') # if params below are changed, preprocessing required traj.neuron.C = Parameter('C', params['C'], comment='pF') traj.neuron.gL = Parameter('gL', params['gL'], comment='nS') traj.neuron.EL = Parameter('EL', params['EL'], comment='mV') traj.neuron.DeltaT = Parameter('DeltaT', params['DeltaT'], comment='mV') traj.neuron.VT = Parameter('VT', params['VT'], comment='mV') traj.neuron.Vr = Parameter('Vr', params['Vr'], comment='mV') traj.neuron.Vs = Parameter('Vs', params['Vs'], comment='mV') traj.neuron.Tref = Parameter('Tref', params['Tref'], comment='ms') ## initial parameters IC, randomly generated in 'loadDefaultParams' traj.f_add_parameter_group('IC', comment='Group containing initial params') traj.IC.mufe_init = Parameter( 'mufe_init', params['mufe_init'], comment='[mV/ms], dosc_version: complex variable') traj.IC.IA_init = Parameter('IA_init', params['IA_init'], comment='[pA]') traj.IC.mufi_init = Parameter( 'mufi_init', params['mufi_init'], comment='[mV/ms], dosc_version: complex variable') traj.IC.seem_init = Parameter('seem_init', params['seem_init'], comment='COMMENT') traj.IC.seim_init = Parameter('seim_init', params['seim_init'], comment='COMMENT') traj.IC.seev_init = Parameter('seev_init', params['seev_init'], comment='COMMENT') traj.IC.seiv_init = Parameter('seiv_init', params['seiv_init'], comment='COMMENT') traj.IC.siim_init = Parameter('siim_init', params['siim_init'], comment='COMMENT') traj.IC.siem_init = Parameter('siem_init', params['siem_init'], comment='COMMENT') traj.IC.siiv_init = Parameter('siiv_init', params['siiv_init'], comment='COMMENT') traj.IC.siev_init = Parameter('siev_init', params['siev_init'], comment='COMMENT') traj.IC.rates_exc_init = Parameter('rates_exc_init', params['rates_exc_init'], comment='COMMENT') traj.IC.rates_inh_init = Parameter('rates_inh_init', params['rates_inh_init'], comment='COMMENT') # Look up tables used to integrate the local network dynamics traj.f_add_parameter_group( 'LT', comment='Look-up tables containing the parameter of the aLN model') #traj.LT.Z_dosc = Parameter('Z_dosc', params['Z_dosc'], comment='Look up table - dosc version') #traj.LT.Ze_dosc = Parameter('Ze_dosc', params['Ze_dosc'], comment='Look up table - dosc version') #traj.LT.Zi_dosc = Parameter('Zi_dosc', params['Zi_dosc'], comment='Look up table - dosc version') traj.LT.precalc_r = Parameter('precalc_r', params['precalc_r'], comment='Look up table') traj.LT.precalc_V = Parameter('precalc_V', params['precalc_V'], comment='Look up table') traj.LT.precalc_tau_mu = Parameter('precalc_tau_mu', params['precalc_tau_mu'], comment='Look up table') traj.LT.precalc_tau_sigma = Parameter('precalc_tau_sigma', params['precalc_tau_sigma'], comment='Look up table') #traj.LT.Zi = Parameter('Zi', params['Zi'], comment='Look up table') traj.LT.Irange = Parameter( 'Irange', params['Irange'], comment='Range of the mean input for the look up tables') traj.LT.sigmarange = Parameter( 'sigmarange', params['sigmarange'], comment='Range of the input variance for the look up tables') traj.LT.dI = Parameter( 'dI', params['dI'], comment='Step size of the mean input for the look up tables') traj.LT.ds = Parameter( 'ds', params['ds'], comment='Step size of the input variance for the look up tables')
__author__ = 'Robert Meyer' from pypet import Trajectory, Result, Parameter traj = Trajectory() # There are more ways to add data, # 1st the standard way: traj.f_add_parameter('x', 1, comment='I am the first dimension!') # 2nd by providing a new parameter/result instance, be aware that the data is added where # you specify it. There are no such things as shortcuts for parameter creation: traj.parameters.y = Parameter('y', 1, comment='I am the second dimension!') # 3rd as before, but if our new leaf has NO name it will be renamed accordingly: traj.parameters.t = Parameter('', 1, comment='Third dimension') # See: print('t=' + str(traj.t)) # This also works for adding groups on the fly and with the well known *dot* notation: traj.parameters.subgroup = Parameter('subgroup.subsubgroup.w', 2) # See print('w=' + str(traj.par.subgroup.subsubgroup.w)) # Finally, there's one more thing. Using this notation we can also add links. # Simply use the `=` assignment with objects that already exist in your trajectory: traj.mylink = traj.f_get('x') # now `mylink` links to parameter `x`, also fast access works: print('Linking to x gives: ' + str(traj.mylink))
def test_new_assignment_method(self): filename = make_temp_dir('newassignment.hdf5') traj = Trajectory(filename=filename, add_time=True) comment = 'A number' traj.par.x = Parameter('', 44, comment) self.assertTrue(traj.f_get('x').v_comment == comment) traj.x = 45 self.assertTrue(traj.par.f_get('x').f_get() == 45) self.assertTrue(isinstance(traj.f_get('x'), Parameter)) with self.assertRaises(AttributeError): traj.f = Parameter('lll', 444, 'lll') traj.f = Parameter('', 444, 'lll') self.assertTrue(traj.f_get('f').v_name == 'f') conf = traj.conf with self.assertRaises(AttributeError): conf = traj.conf.jjjj traj.f_set_properties(fast_access=True) traj.crun = Result('', k=43, m='JJJ') self.assertTrue(traj.run_A['k'] == 43) with self.assertRaises(AttributeError): traj.f_set_properties(j=7) with self.assertRaises(AttributeError): traj.f_set_properties(depth=7) traj.hui = Result('hui', ('444', 'kkkk',), 'l') self.assertTrue(traj.f_get('hui')[1] == 'l') traj.f_get('hui').f_set(('445', 'kkkk',)) self.assertTrue(traj.f_get('hui')[1] == 'l') self.assertTrue(traj.hui[0] == ('445', 'kkkk',)) traj.f_add_link('klkikju', traj.par) # for shizzle traj.meee = Result('meee.h', 43, hui = 3213, comment='du') self.assertTrue(traj.meee.h.h == 43) with self.assertRaises(TypeError): traj.par.jj = NNGroupNode('jj', comment='mi') with self.assertRaises(TypeError): traj.res.jj = NNGroupNode('jj', comment='mi') with self.assertRaises(TypeError): traj.conf.jj = NNGroupNode('jj', comment='mi') with self.assertRaises(TypeError): traj.dpar.jj = NNGroupNode('jj', comment='mi') with self.assertRaises(TypeError): traj.par.jj = ResultGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.dpar.jj = ResultGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.conf.jj = ResultGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.jj = ResultGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.par.jj = ConfigGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.dpar.jj = ConfigGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.res.jj = ConfigGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.jj = ConfigGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.par.jj = DerivedParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.conf.jj = DerivedParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.res.jj = DerivedParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.jj = DerivedParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.dpar.jj = ParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.res.jj = ParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.conf.jj = ParameterGroup('jj', comment='mi') with self.assertRaises(TypeError): traj.jj = ParameterGroup('jj', comment='mi') traj.par.jj = ParameterGroup('jj', comment='mi') traj.res.jj = ResultGroup('jj', comment='mi') traj.jj = NNGroupNode('jj') cg = ConfigGroup('a.g') traj.conf.a = cg self.assertTrue(traj.f_get('conf.a.g', shortcuts=False) is cg) dg = DerivedParameterGroup('ttt') traj.dpar.ttt = dg self.assertTrue(traj.f_get('dpar.ttt', shortcuts=False) is dg) traj.mylink = traj.par self.assertTrue(traj.mylink is traj.par) traj.vvv = NNGroupNode('', comment='kkk') self.assertTrue(traj.vvv.v_full_name == 'vvv') self.assertTrue(traj.par.jj.v_name == 'jj') traj.ff = MyParamGroup('ff') traj.par.g = MyParamGroup('') pg = traj.f_add_parameter_group(comment='gg', full_name='me') self.assertTrue(traj.par.me is pg) traj.f_store() traj = load_trajectory(index=-1, filename=filename, dynamic_imports=MyParamGroup) self.assertTrue(isinstance(traj.ff, MyParamGroup)) self.assertTrue(isinstance(traj.par.g, MyParamGroup)) traj.par.hiho = Parameter('hiho', 42, comment='you') traj.par.g1 = Parameter('g1.g2.g3.g4.g5', 43) self.assertTrue(traj.hiho == 42) self.assertTrue(isinstance(traj.par.g1, ParameterGroup )) self.assertTrue(isinstance(traj.par.g3, ParameterGroup )) self.assertTrue(traj.g3.g5 == 43)