def get_kappa(paramRDD, i0, j0, num_reg_used0, dates, paths, orbits, blocks): N = len(num_reg_used0) kappa = np.zeros(N) for d in xrange(N): key = fN.get_date_key(dates[d], paths[d], orbits[d], blocks[d]) tau = paramRDD.filter(lambda x: x[0][:4] == key).map(lambda x: x[1].tau).collect() kappa[d] = get_kappa_block(np.array(tau), i0[d], j0[d], num_reg_used0[d]) return kappa
def get_sigmasq(paramRDD, dates, paths, orbits, blocks): N = len(dates) sigmasq = np.zeros((NCHANNEL, N)) for d in xrange(N): key = fN.get_date_key(dates[d], paths[d], orbits[d], blocks[d]) residRDD = paramRDD.filter(lambda x: x[0][:4] == key).map(lambda x: x[1].resid) sigmasq[:, d] = get_sigmasq_block(residRDD) return sigmasq