示例#1
0
 def test_make_settings_fail_3(self):
     #Mismatched parameter length
     __settings__ = {
         'system_type': ['pyTestModel, Dummy'],
         'settings_name': '__default__',
         'units': {
             'syn_mRNA': 'M/min',
             'deg_mRNA': '1/min',
             'syn_Pep': '1/min',
             'deg_Pep': '1/min',
             'Ind': 'M'
         },
         'parameters': {
             'syn_mRNA': np.array([0.02, 1]),
             'deg_mRNA': np.array([0.15]),
             'syn_Pep': np.array([0.02]),
             'deg_Pep': np.array([0.012]),
             'Ind': np.array([1.0])
         },
         'init': {
             1: [0, 0]
         },
         'parameter_bounds': {
             'deg_mRNA': [0.001, 0.03],
             'deg_Pep': [0.01, 0.5],
         },
         'solver_args': {
             'rtol': 1.49012e-8,
             'atol': 1.49012e-8,
             'tcrit': [],
             'h0': 0.0,
             'hmax': 0.0,
             'hmin': 0.0,
             'mxstep': 0
         },
     }
     settings = sh.make_settings(**__settings__)
示例#2
0
    new_settings = config_data[best_model_num]
    new_settings['settings_name'] = 'Example_3_pLac'
    new_settings['parameters'] = cf.get_params_for_model(
        models=sampler_args['models'],
        trace=accepted,
        model_num=best_model_num,
        row_index=best_row_index)
    '''
    We now call the constructor for the settings data structure. Once the new settings
    have been created, we can add it to the database if we wish.
    
    Note that information such as sa_args cannot be stored as settings and will
    be ignored.
    '''
    new_settings = sh.make_settings(
        **new_settings, user_core_model=user_core_models[best_system_type])

    inducer_conc_str = {key: str(inducer_conc[key]) for key in inducer_conc}

    plot_index = {
        1: ['OD', 'Fluor/OD'],
        2: ['OD', 'Fluor/OD', 'm'],
        3: ['OD', 'Fluor/OD', 'm', 'ind'],
        4: ['OD', 'Fluor/OD', 'm', 'indi']
    }
    titles = {
        1: {
            'OD': 'OD',
            'Fluor/OD': 'Pep'
        },
        2: {
示例#3
0
文件: main.py 项目: EngBioNUS/BMSS2
    #1. Add the best model to the database (if it is not already inside)
    if best_system_type in user_core_models:
        best_core_model = user_core_models[best_system_type]
        mh.add_to_database(best_core_model)

    #2. Create a settings data structure based on the best settings
    new_settings = config_data[best_model_num]
    new_settings['settings_name'] = 'Example_5_pTet'
    new_settings['parameters'] = cf.get_params_for_model(
        models=sampler_args['models'],
        trace=accepted,
        model_num=best_model_num,
        row_index=best_row_index)

    new_settings = sh.make_settings(**new_settings)

    #3. Add the settings to the database
    sh.add_to_database(new_settings)

    #4. View the settings database
    '''
    8. A Posteriori Identifiability Analysis
    '''
    '''
    BMSS's trace plotting functions are built for multi-trace operations. This
    allows you to easily check if your simulations converge to same region.
    '''

    seeder = seed(sampler_args['guess'], sampler_args['fixed_parameters'],
                  sampler_args['bounds'])
示例#4
0
    def test_make_settings(self):
        global settings_1
        global core_model_1

        core_model = core_model_1

        mh.add_to_database(core_model, dialog=False)

        __settings__ = {
            'system_type': ['pyTestModel', 'Dummy'],
            'settings_name': '__default__',
            'units': {
                'syn_mRNA': 'M/min',
                'deg_mRNA': '1/min',
                'syn_Pep': '1/min',
                'deg_Pep': '1/min',
                'Ki': 'M',
                'Ind': 'M'
            },
            'parameters': {
                'syn_mRNA': np.array([0.02]),
                'deg_mRNA': np.array([0.15]),
                'syn_Pep': np.array([0.02]),
                'deg_Pep': np.array([0.012]),
                'Ki': np.array([0.5]),
                'Ind': np.array([1.0])
            },
            'init': {
                1: [0, 0]
            },
            'parameter_bounds': {
                'deg_mRNA': [0.001, 0.03],
                'deg_Pep': [0.01, 0.5],
            },
            'solver_args': {
                'rtol': 1.49012e-8,
                'atol': 1.49012e-8,
                'tcrit': [],
                'h0': 0.0,
                'hmax': 0.0,
                'hmin': 0.0,
                'mxstep': 0
            },
        }

        settings = sh.make_settings(**__settings__)

        ###############################################################################
        #Testing Parameter Formats
        ###############################################################################
        __settings__['parameters'] = {
            key + '_1': __settings__['parameters'][key]
            for key in __settings__['parameters']
        }
        settings = sh.make_settings(**__settings__, user_core_model=core_model)

        __settings__['parameters'] = pd.Series(__settings__['parameters'],
                                               name=500)
        settings = sh.make_settings(**__settings__, user_core_model=core_model)

        ##############################################################################
        #Testing Initial Value Formats
        ##############################################################################
        __settings__['init'] = {
            'mRNA': [0],
            'Pep': [0],
        }
        settings = sh.make_settings(**__settings__,
                                    init_orient='states',
                                    user_core_model=core_model)

        __settings__['init'] = [[0, 0], [0, 0]]
        settings = sh.make_settings(**__settings__,
                                    init_orient='states',
                                    user_core_model=core_model)

        __settings__['init'] = pd.Series([0, 0], index=['mRNA', 'Pep'])
        settings = sh.make_settings(**__settings__,
                                    init_orient='states',
                                    user_core_model=core_model)

        __settings__['init'] = pd.DataFrame([[0, 0]],
                                            columns=['mRNA', 'Pep'],
                                            index=[1])
        settings = sh.make_settings(**__settings__,
                                    init_orient='states',
                                    user_core_model=core_model)

        #Assert here
        for key in __settings__:
            try:
                assert settings[key] is not None
            except ValueError as e:
                pass
            except Exception as e:
                raise e

        #Save for reuse
        settings_1 = settings