def todictionary(self, time_series=False):
# convert the ETM adjustment into a dirtionary
# optionally, output the whole time series as well
# start with the parameters
etm = dict()
etm['Linear'] = {'tref': self.Linear.tref, 'params': self.Linear.values.tolist()}
etm['Jumps'] = [{'type':jump.type, 'year': jump.year, 'a': jump.a.tolist(), 'b': jump.b.tolist(), 'T': jump.T} for jump in self.Jumps.table]
etm['Periodic'] = {'frequencies': self.Periodic.frequencies, 'sin': self.Periodic.sin.tolist(), 'cos': self.Periodic.cos.tolist()}
if time_series:
ts = dict()
ts['t'] = self.ppp_soln.t.tolist()
ts['x'] = self.ppp_soln.x.tolist()
ts['y'] = self.ppp_soln.y.tolist()
ts['z'] = self.ppp_soln.z.tolist()
etm['time_series'] = ts
return etm
评论列表
文章目录