def calc2(MS, R0=None, R1=None): if R0 == None: R0 = numpy.arange(0.05, 1.0, 0.05) if R1 == None: R1 = numpy.arange(0.05, 1.1, 0.05) LLmax = float('-inf') Mfit = copy.deepcopy(MS.M) print('Turning debugging OFF') fitglobals.debugoff() f = open('data.txt', 'w') f.write('# A0 A1 LL\n') for A0 in R0: for A1 in R1: # Mfit.P.A = numpy.matrix([[A0, 0], [0,A1]]) MS.setParams(A0, A1, Mfit) LL = fitEKF.ekf(MS.Data, Mfit) if LL > LLmax: A0max = A0 A1max = A1 LLmax = LL f.write('%s %s %s\n' % (A0, A1, LL)) print A0, A1, LL f.write('\n') print "" f.close() print 'Max Like =', LLmax, '@ (A0,A1) =', [A0max, A1max] simParams = MS.getParams() LLsim = MS.loglike(simParams[0], simParams[1]) print 'Sim Like =', LLsim, '@ (A0, A1) =', simParams[0], simParams[1]
def __init__(self): fitglobals.debugoff() P = noise.NoiseParams() P.tstop = 20 P.dt = 0.1 A0 = 0.5 A1 = 0.1 P.A = numpy.matrix([[A0, 0], [0, A1]]) # P.B, next line define noise injected to each component, uncorrelated P.B = numpy.matrix([[0.5, 0], [0, 0.4]]) P.InitialCov = numpy.matrix([[1, 0], [0, 1]]) elist = numpy.arange(0.1, 20, 0.1).tolist() elist2 = numpy.arange(0.05, 20.0, 0.05).tolist() O1 = models.ObserveState0(P, 5) O2 = models.ObserveStateSum(P, 6) # O1.Times.set([2,4,6,8,10,12,14,16,18,20]) # O2.Times.set([3,6,9,12,15,18]) O1.Times.set(elist) O2.Times.set(elist) O1.sigma = 0.001 O2.sigma = 0.0001 Obs = models.ObservationModel(P, 5, [O1, O2]) Sys = models.DecayModel(P, 0, 2) # Sys.Injection.set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]) Sys.Injection.set(elist2) Initial = numpy.matrix([[1.0], [2.0]]) self.M = models.Model(Sys, Obs, P, Initial) self.sim(False)
from neuron import h import fitglobals fitglobals.debugoff() h.load_file('mulfit.hoc') h.load_file('eonerunmlf.hoc') import nrnbfilt h.load_file('ch3_11p.ses') h('objref nb') h.nb = h.List("PythonObject").o(0)