def test_duplication_mapper(log_file_in_tmpdir):
    """A positive all-up test of duplication mappers.

    This is an acyclic workflow.
    """
    elements = [
        ComputeElement('dm', 'muscle.duplication_mapper'),
        ComputeElement('first', 'receiver'),
        ComputeElement('second', 'receiver')
    ]

    conduits = [Conduit('dm.out', 'first.in'), Conduit('dm.out2', 'second.in')]

    model = Model('test_model', elements, conduits)
    settings = Settings()

    configuration = Configuration(model, settings)

    implementations = {
        'muscle.duplication_mapper': duplication_mapper,
        'receiver': receiver
    }
    run_simulation(configuration, implementations)
Example #2
0
def test_all(log_file_in_tmpdir):
    """A positive all-up test of everything.
    """
    elements = [
        ComputeElement('macro', 'macro_impl'),
        ComputeElement('micro', 'micro_impl', [10])
    ]

    conduits = [
        Conduit('macro.out', 'micro.in'),
        Conduit('micro.out', 'macro.in')
    ]

    model = Model('test_model', elements, conduits)
    settings = Settings(
        OrderedDict([('test1', 13), ('test2', 13.3), ('test3', 'testing'),
                     ('test4', True), ('test5', [2.3, 5.6]),
                     ('test6', [[1.0, 2.0], [3.0, 1.0]])]))

    configuration = Configuration(model, settings)

    implementations = {'macro_impl': macro, 'micro_impl': micro}
    run_simulation(configuration, implementations)
Example #3
0
def test_settings_overlays(log_file_in_tmpdir):
    """A positive all-up test of settings overlays.
    """
    elements = [
            ComputeElement('qmc', 'qmc'),
            ComputeElement('macro', 'macro', [10]),
            ComputeElement('relay', 'explicit_relay'),
            ComputeElement('relay2', 'explicit_relay'),
            ComputeElement('micro', 'micro', [10])]

    conduits = [
                Conduit('qmc.settings_out', 'macro.muscle_settings_in'),
                Conduit('macro.out', 'relay.in'),
                Conduit('relay.out', 'micro.in'),
                Conduit('micro.out', 'relay2.in'),
                Conduit('relay2.out', 'macro.in')]

    model = Model('test_model', elements, conduits)

    settings = Settings(OrderedDict([
                ('test1', 13),
                ('test2', 13.3),
                ('test3', 'testing'),
                ('test4', True),
                ('test5', [2.3, 5.6]),
                ('test6', [[1.0, 2.0], [3.0, 1.0]])]))

    configuration = Configuration(model, settings)

    implementations = {
            'qmc': qmc,
            'macro': macro,
            'explicit_relay': explicit_relay,
            'micro': micro}

    run_simulation(configuration, implementations)
Example #4
0
feed = np.array(feed)
kill = np.array(kill)

# Compute elements for the macro and micro model: specify the name of the python file here
elements = [ComputeElement('macro', 'macro', [n_samples]),
            ComputeElement('micro', 'micro', [n_samples])]

# connect the submodels
conduits = [Conduit('macro.state_out', 'micro.state'),
            Conduit('micro.sgs', 'macro.state_in')]

# create model instance
model = Model('gray_scott_reduced', elements, conduits)

# common settings
settings_dict = {'micro.t_max': 0.1, 'micro.dt': 0.1, 'N_Q': 2, 'N_LF': 128}

# parameter value settings, differs per run
for i in range(n_samples):
    settings_dict['macro[%d].feed' % i] = feed[i]
    settings_dict['macro[%d].kill' % i] = kill[i]
settings = Settings(settings_dict)

configuration = Configuration(model, settings)

# actual subroutines to run, imported from macro.py and micro.py
implementations = {'macro': gray_scott_macro, 'micro': reduced_sgs}

# execute ensemble on a single node
run_simulation(configuration, implementations)