def make_phi(params): mu1,sh1,sc1,mu2,sh2,sc2 = params region = lambda x: (2 if x>mu2 else 1) if x>=mu1 else 0 f= [lambda x: scispec.gdtrc((1.0/sc1),sh1,abs(x-mu1)), lambda x: 1, lambda x: scispec.gdtrc((1.0/sc2),sh2,abs(x-mu2))] return lambda x: f[region(x)](x)
def death_prob_of_assoc_target(dt): #return the probability of death over the next time step, #where dt is the duration of one time step alpha_death = 2.0 beta_death = 1.0 theta_death = 1.0 / beta_death return 1 - gdtrc(theta_death, alpha_death, dt)
def gdtrc_(p, x): return gdtrc(1.0, p, x)
def _set_params(self): mu1,sh1,sc1,mu2,sh2,sc2 = self.params self.region = lambda x: (2 if x>mu2 else 1) if x>=mu1 else 0 self.f= [lambda x: scispec.gdtrc((1.0/sc1),sh1,abs(x-mu1)), lambda x: 1, lambda x: scispec.gdtrc((1.0/sc2),sh2,abs(x-mu2))]