예제 #1
0
    def __init__(self):
        self.simulation = oc.simulation()
        self.simulation.data().setStartingPoint(0)
        self.simulation.data().setEndingPoint(3900)
        self.simulation.data().setPointInterval(1)
        self.constants = self.simulation.data().constants()
        self.constant_parameter_names = sorted(list(self.constants.keys()))

        for i in range(0, len(fit_parameters_exclude)):
            self.constant_parameter_names.remove(fit_parameters_exclude[i])

        self.model_constants = OrderedDict(
            {k: self.constants[k]
             for k in self.constant_parameter_names})

        # default the parameter bounds to something sensible, needs to be set directly
        bounds = []
        for c in self.constant_parameter_names:
            v = self.constants[c]
            bounds.append([bounds_dictionary[c][0], bounds_dictionary[c][1]])
        # define our sensitivity analysis problem
        self.problem = {
            'num_vars': len(self.constant_parameter_names),
            'names': self.constant_parameter_names,
            'bounds': bounds
        }
        self.samples = saltelli.sample(self.problem, num_samples)
        #print(self.samples)
        np.savetxt("self.samples.txt", self.samples)
예제 #2
0
 def __init__(self):
     self.simulation = oc.simulation()
     self.simulation.data().setStartingPoint(0)
     self.simulation.data().setEndingPoint(3600)
     self.simulation.data().setPointInterval(1)
     self.constants = self.simulation.data().constants()
     self.model_constants = OrderedDict({k: self.constants[k]
                                         for k in self.constants.keys()})
예제 #3
0
 def __init__(self):
     self.simulation = oc.simulation()
     self.simulation.data().setStartingPoint(0)
     self.simulation.data().setEndingPoint(3600)
     self.simulation.data().setPointInterval(1)
     self.constants = self.simulation.data().constants()
     self.simulation.resetParameters()
     self.simulation.clearResults()
     for k, v in dict.items():
         self.constants[k] = v
     self.model_constants = OrderedDict(
         {k: self.constants[k]
          for k in self.constants.keys()})
예제 #4
0
    def __init__(self):
        self.simulation = oc.simulation()
        self.simulation.data().setStartingPoint(0)
        self.simulation.data().setEndingPoint(3900)
        self.simulation.data().setPointInterval(1)
        self.constants = self.simulation.data().constants()
        self.model_constants = OrderedDict(
            {k: self.constants[k]
             for k in self.constants.keys()})

        #print(self.model_constants)

        # default the parameter bounds to something sensible, needs to be set directly
        bounds = []
        #print(self.constants)
        for c in self.constants:
            v = self.constants[c]
            print(c)
            #print(bounds_dictionary[c][1])
            print(v)
            bounds.append([bounds_dictionary[c][0], bounds_dictionary[c][1]])
        # Define sensitivity analysis problem
        self.problem = {
            'num_vars': len(self.constants),
            'names': self.constants.keys(),
            'bounds': bounds
        }
        self.problem = {
            'num_vars':
            12,
            'names': [
                'FCepsilonRI/k_f1', 'FCepsilonRI/k_f2', 'FCepsilonRI/k_f3',
                'FCepsilonRI/k_f4', 'FCepsilonRI/k_f5', 'FCepsilonRI/k_f6',
                'FCepsilonRI/k_f7', 'FCepsilonRI/k_r1', 'FCepsilonRI/k_r3',
                'FCepsilonRI/k_r5', 'FCepsilonRI/k_r7', 'FCepsilonRI/k_f8'
            ],
            'bounds': [[-5, 2], [-5, 2], [-5, 2], [-5, 2], [-5, 2], [-5, 2],
                       [-5, 2], [-10, -9], [-10, -9], [-10, -9], [-10, -9],
                       [-0.03, -0.027]]
        }

        # Generate Samples
        self.samples = saltelli.sample(
            self.problem, 50
        )  #Generate no of sample using N*(2D+2) where N is the supplied argument and D is no of constant
예제 #5
0
def figure(**kwds):
    return plt.figure(FigureClass=Figure, tight_layout=True, **kwds)


if __name__ == '__main__':

    import OpenCOR as oc
    '''
    s = oc.openSimulation('noble_1962.cellml')
    s.data().setEndingPoint(0.6)
    s.data().setPointInterval(0.005)
    s.reset()
    s.run()
'''
    s = oc.simulation()

    diagram = Diagram('noble_1962.svg', s, 0.04, 0.60, 's')

    diagram.add_channel('sodium_channel/i_Na', 'i_Na', (183.849, 49.756), 'V', 'red')
    diagram.add_channel('potassium_channel/i_K', 'i_K', (80.867, 49.756), 'V-', '#b666d2')
    diagram.add_channel('leakage_current/i_Leak', 'i_Leak', (133.551, 167.485), 'V', 'orange')

    svg = diagram.generate_svg(speed=0.5, period=25)

    browser = oc.browserWebView()
    browser.setContent(svg, "image/svg+xml")

    f = open('noble_1962_animated.svg', 'w')
    f.write(svg)
    f.close()
예제 #6
0
 def __init__(self):
     print("Hello World")
     self.simulation = oc.simulation()
     print(filename)
     print('oh year')