tt=[] for p in psr: tt.append(np.min(p.toas)) # find reference time tref = np.min(tt) # now scale pulsar time for p in psr: p.toas -= tref # create list of reference residuals res = [p.res for p in psr] # get list of R matrices R = [PALutils.createRmatrix(p.dmatrix, p.err) for p in psr] L = [] for ct, p in enumerate(psr): Amp = p.Amp gam = p.gam efac = p.efac equad = p.equad try: cequad = p.cequad except AttributeError: cequad = 0 avetoas, U = PALutils.exploderMatrix(p.toas) Tspan = p.toas.max()-p.toas.min()
# define the pulsargroup pulsargroup = pfile['Data']['Pulsars'] # fill in pulsar class psr = [PALpulsarInit.pulsar(pulsargroup[key],addNoise=True, addGmatrix=True) \ for key in pulsargroup] # number of pulsars npsr = len(psr) # create list of reference residuals res = [p.res for p in psr] # get list of R matrices R = [PALutils.createRmatrix(p.dmatrix, p.err) for p in psr] # pre-compute noise covariance matrices ct = 0 D = [] Dmatrix = [] print 'Computing diagonalized auto-covariance matrices' for key in pulsargroup: # get noise values from file TODO: change this to read directly from pulsar class Amp = pulsargroup[key]['Amp'].value gam = pulsargroup[key]['gam'].value efac = pulsargroup[key]['efac'].value equad = pulsargroup[key]['equad'].value try:
# TODO: is this a very round about way to do this? index = [] for ct,p in enumerate(pp): if p.name == psr[ct].name: index.append(ct) else: for ii in range(npsr): if pp[ii].name == psr[ct].name: index.append(ii) pp = [pp[ii] for ii in index] M = [PALutils.createQSDdesignmatrix(p.toas) for p in psr] RQ = [PALutils.createRmatrix(M[ct], p.err) for ct, p in enumerate(psr)] # construct noise matrix for new noise realizations print 'Constructing noise cholesky decompositions' L = [] for ct, p in enumerate(psr): Amp = p.Amp gam = p.gam efac = p.efac equad = p.equad cequad = p.cequad avetoas, U = PALutils.exploderMatrix(p.toas) Tspan = p.toas.max()-p.toas.min() F, f = PALutils.createfourierdesignmatrix(p.toas, 10, freq=True, Tspan=Tspan)
# TODO: is this a very round about way to do this? index = [] for ct, p in enumerate(pp): if p.name == psr[ct].name: index.append(ct) else: for ii in range(npsr): if pp[ii].name == psr[ct].name: index.append(ii) pp = [pp[ii] for ii in index] M = [PALutils.createQSDdesignmatrix(p.toas) for p in psr] RQ = [PALutils.createRmatrix(M[ct], p.err) for ct, p in enumerate(psr)] # construct noise matrix for new noise realizations print 'Constructing noise cholesky decompositions' L = [] for ct, p in enumerate(psr): Amp = p.Amp gam = p.gam efac = p.efac equad = p.equad cequad = p.cequad avetoas, U = PALutils.exploderMatrix(p.toas) Tspan = p.toas.max() - p.toas.min() F, f = PALutils.createfourierdesignmatrix(p.toas,