Skip to content
Snippets Groups Projects
Commit 3c00b32a authored by Gregory Ashton's avatar Gregory Ashton
Browse files

Use fmod rather than np.mod: it is slightly faster

parent d9ad7717
No related branches found
No related tags found
1 merge request!597Resolve issues identified in !408
Pipeline #79352 passed
from __future__ import division
import os
import json
from math import fmod
import numpy as np
from scipy.interpolate import interp1d
......@@ -87,7 +88,7 @@ def time_delay_geocentric(detector1, detector2, ra, dec, time):
float: Time delay between the two detectors in the geocentric frame
"""
gmst = np.mod(lal.GreenwichMeanSiderealTime(time), 2 * np.pi)
gmst = fmod(lal.GreenwichMeanSiderealTime(time), 2 * np.pi)
theta, phi = ra_dec_to_theta_phi(ra, dec, gmst)
omega = np.array([np.sin(theta) * np.cos(phi), np.sin(theta) * np.sin(phi), np.cos(theta)])
delta_d = detector2 - detector1
......@@ -120,7 +121,7 @@ def get_polarization_tensor(ra, dec, time, psi, mode):
array_like: A 3x3 representation of the polarization_tensor for the specified mode.
"""
gmst = np.mod(lal.GreenwichMeanSiderealTime(time), 2 * np.pi)
gmst = fmod(lal.GreenwichMeanSiderealTime(time), 2 * np.pi)
theta, phi = ra_dec_to_theta_phi(ra, dec, gmst)
u = np.array([np.cos(phi) * np.cos(theta), np.cos(theta) * np.sin(phi), -np.sin(theta)])
v = np.array([-np.sin(phi), np.cos(phi), 0])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment