def orf_old_way(): xvec, yvec = ETwaves.principal_polarisation_axes_0Psi(azis=azis, pols=pols) eplus, ecros = ETwaves.polarisation_tensor_bases(xvec, yvec) Fplus1, Fcros1 = ETdetector.response_function(ET.Dtensor(1), eplus, ecros) Fplus2, Fcros2 = ETdetector.response_function(ET.Dtensor(2), eplus, ecros) orf = ETdetector.orf_no_frequency(Fplus1, Fcros1, Fplus2, Fcros2) return orf
def timeit(): import ETwaves azis = np.linspace(0, 2*np.pi, 360, endpoint = False) pols = np.linspace(0, np.pi, 181) xvec, yvec = ETwaves.principal_polarisation_axes_0Psi(azis, pols) eplus, ecros = ETwaves.polarisation_tensor_bases(xvec, yvec) detensor = np.random.rand(3,3) print('Time function: min {0:.4f} s, average {1:.4f} s and max {2:.4f} s'.format(*ETutils.timedcalls(20., func, detensor, eplus, ecros)))
def test_known_values(self): ''' polarisation_tensor_basis should give known result ''' for xy, tensors in self.known_values: x, y = xy expected_eplus, expected_ecros = tensors eplus = ETwaves.polarisation_tensor_basis(x, y, pol = '+') ecros = ETwaves.polarisation_tensor_basis(x, y, pol = 'x') self.assertTrue(np.allclose(expected_eplus, eplus)) self.assertTrue(np.allclose(expected_ecros, ecros))
def overlap_reduction_function(det1 = 1, det2 = 2, pols = 0, azis = 0): ''' Returns overlap-reduction function between detectors det1 and det2, given polar and azimuthal angle(s). ''' xvec, yvec = ETwaves.principal_polarisation_axes_0Psi(azis, pols) eplus, ecros = ETwaves.polarisation_tensor_bases(xvec, yvec) D1, D2 = detector_tensor(det1), detector_tensor(det2) F1plus, F1cros = response_function(D1, eplus, ecros) F2plus, F2cros = response_function(D2, eplus, ecros) return orf_no_frequency(F1plus, F1cros, F2plus, F2cros)
def timeit(): azis = np.linspace(0, 2*np.pi, 360, endpoint = False) pols = np.linspace(0, np.pi, 181) xvec, yvec = ETwaves.principal_polarisation_axes_0Psi(azis, pols) print('Time function: min {0:.4f} s, average {1:.4f} s and max {2:.4f} s'.format(*ETutils.timedcalls(20., func, xvec, yvec)))