Source code for gwtoolbox.tools_space
from astropy import units as u
import numpy as np
from .sources_mHz import *
from .detectors_space import *
from .functions_space import *
from .cosmology import Cosmology
from .constants import *
from .parameters import *
def set_cosmology(cosmoID=None, H0=None, Om0=None):
cosmos_class = Cosmology()
cosmos = cosmos_class.set_cosmo(cosmoID,H0,Om0)
return cosmos
[docs]class Tools:
"""
This is a class with tools to manipulate GW detectors and sources in space.
Args:
detID (int): detector id
popID (int): population id
cosmos (class): cosmological model
det_setup (Optional[list of floats]): parameters to modify the detector noise
Attributes:
detector (class): detector setup class
ant_pat (array of dtype float): detector shape
noise (array of dtype float): detector noise
"""
def __init__(self, detID, popID, cosmos, det_setup=None):
"""
Parameters:
detID (int): detector id
popID (int): population id
cosmos (class): cosmological model
det_setup (Optional[list of dtype floats]): parameters to modify the detector noise
"""
self.cosmos = cosmos
self.detID = detID
self.popID = popID
if self.detID in [-3,3]:
self.detector = LisaLike(self.detID)
self.ant_pat = self.detector.ante_pattern
self.noise = self.detector.noise_curve(det_setup)
if self.popID == 3:
self.population_class = SMBHB(self.cosmos)
elif self.popID == 4:
self.population_class = EMRI(self.cosmos)
elif self.popID == 2:
self.population_class = Insp(self.cosmos)
[docs] def total_number(self, time_obs=TIME_OBS_EARTH, rho_cri=RHO_CRIT_EARTH):
"""
Return the expected number of detections.
Parameters:
time_obs (float): Observation time, in unit of minute
rho_cri (float): The SNR threshold of detection
Returns:
(float): expected number of detections
"""
return None
[docs] def list_params(self, time_obs=TIME_OBS_EARTH, rho_cri=RHO_CRIT_EARTH, list_all=False):
"""
Return an array of final parameters.
Parameters:
time_obs (float): Observation time, in unit of minute
rho_cri (float): The SNR threshold of detection
list_all (Optional[boolean]): to decide how large sample
Returns:
(array of dtype float): samples
"""
if list_all == False:
self.number = SAMPLE_SIZE
else:
n = self.total_number(time_obs,rho_cri)
self.number = int(n)
return None
[docs] def list_param_errors(self):
"""
Return array of final parameter errors.
It can be used only when list_params was used before.
Returns:
(array of dtype float): errors m1,m2,chi
"""
return None