示例#1
0
        current = log['current']
        voltage = log['voltage']
        del (log)

        #
        # Load protocol
        #
        if protocol_name == 'sine-wave':
            protocol_file = os.path.join(root, 'steps.mmt')
            protocol = myokit.load_protocol(protocol_file)
            sw = 1
            #
            # Apply capacitance filter based on protocol
            #
            print('Applying capacitance filtering')
            time, voltage, current = forwardModel.capacitance(
                protocol, 0.1, time, voltage, current)

        elif protocol_name == 'original-sine':
            root = os.path.abspath('original-sine-data')
            protocol_file = os.path.join(root, 'steps.mmt')
            protocol = myokit.load_protocol(
                protocol_file)  # Same steps before sine wave
            print('Applying capacitance filtering')
            time, voltage, current = forwardModel.capacitance(
                protocol, 0.1, time, voltage, current)

        if protocol_name != 'sine-wave':
            sw = 0
            print('Defining the protocol from ', root)
            protocol_file = os.path.join(root, protocol_name + '.csv')
            log = myokit.DataLog.load_csv(protocol_file).npview()
示例#2
0
    model_metrics = np.zeros((30, 8))
for i in xrange(30):
    model_name = 'model-' + str(i + 1)
    root = os.path.abspath('models_myokit')
    myo_model = os.path.join(root, model_name + '.mmt')
    root = os.path.abspath('rate_dictionaries')
    rate_file = os.path.join(root, model_name + '-priors.p')
    rate_dict = cPickle.load(open(rate_file, 'rb'))
    sys.path.append(os.path.abspath('models_forward'))
    print("loading  model: " + str(i + 1))
    model_name = 'model-' + str(i + 1)
    temperature = forwardModel.temperature(cell)
    lower_conductance = forwardModel.conductance_limit(cell)
    print('Applying capacitance filtering')
    time, voltage, current = forwardModel.capacitance(protocol_sine, 0.1,
                                                      time_sine, voltage_sine,
                                                      current_sine)
    sigma_noise_sine = np.std(current_sine[:2000], ddof=1)
    sigma_noise_ap = np.std(current_ap[:2000], ddof=1)
    #
    # Create forward model
    #
    transform = 0
    model = forwardModel.ForwardModel(protocol_sine,
                                      temperature,
                                      myo_model,
                                      rate_dict,
                                      transform,
                                      sine_wave=True)
    model_ap = forwardModel.ForwardModel(protocol_ap,
                                         temperature,