Ejemplo n.º 1
0
def test_experiment(
    initial_biomass=1000,
    total_time=2000,
):
    agent_id = '1'
    parameters = {
        'agent_id': agent_id,
        'inclusion_process': {
            'damage_rate': 1e-4,  # rapid damage
        },
        'growth_rate': {
            'growth_rate': 0.001  # fast growth
        },
    }

    # make the agent
    agent_composer = InclusionBodyGrowth(parameters)
    agent_composite = agent_composer.generate()

    # make the environment
    composer = Lattice(LATTICE_CONFIG)
    composite = composer.generate()

    # merge in the agent
    composite.merge(composite=agent_composite, path=('agents', agent_id))

    # get initial state
    initial_state = composite.initial_state()
    initial_state['agents'][agent_id]['molecules'] = {
        'biomass': initial_biomass
    }

    # make the experiment
    inclusion_experiment = Experiment({
        'processes': composite['processes'],
        'topology': composite['topology'],
        'initial_state': initial_state
    })

    # run the experiment
    inclusion_experiment.update(total_time)

    # get the data
    data = inclusion_experiment.emitter.get_data()

    return data
Ejemplo n.º 2
0
def test_inclusion_body(
    total_time=1000,
    initial_biomass=1000,
):
    agent_id = '0'
    parameters = {
        'agent_id': agent_id,
        'inclusion_process': {
            'damage_rate': 1e-4,  # rapid damage
        },
        'growth_rate': {
            'growth_rate': 0.001  # fast growth
        },
    }
    composer = InclusionBodyGrowth(parameters)
    composite = composer.generate(path=('agents', agent_id))

    initial_state = composite.initial_state()
    initial_state['agents'][agent_id]['molecules'] = {
        'biomass': initial_biomass
    }

    # make the experiment
    inclusion_experiment = Experiment({
        'processes': composite['processes'],
        'topology': composite['topology'],
        'initial_state': initial_state
    })

    # run the experiment
    inclusion_experiment.update(total_time)

    # get the data
    data = inclusion_experiment.emitter.get_data()

    return data