utils.lisa package
Submodules
utils.lisa.LISACommonFunctions module
Copyright (C) 2017 Stas Babak, Antoine Petiteau for the LDC team
This file is part of LISA Data Challenge.
LISA Data Challenge is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Foobar is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.
- utils.lisa.LISACommonFunctions.AziPolAngleL2PsiIncl(bet, lam, theL, phiL)
Convert Polar and Azimuthal angles of zS (typically orbital angular momentum L) to polarisation and inclination (see doc) @param bet is the ecliptic latitude of the source in sky [rad] @param lam is the ecliptic longitude of the source in sky [rad] @param theL is the polar angle of zS [rad] @param phiL is the azimuthal angle of zS [rad] @return polarisation and inclination
- utils.lisa.LISACommonFunctions.FormatNpArray(x)
Make sure the result is list format even if it is a single value @param input variable or list @return list
- utils.lisa.LISACommonFunctions.FourierTransformData(x, dt, wis=None)
Fourier transform data @param x is the input data @param dt is the step in the reference array @return x transform of the data
- utils.lisa.LISACommonFunctions.GetStrCodeGitCmd(filepath, options, args)
Get script history and running informations: @param filepath is file path : os.path.realpath(__file__) @param options is the dictionary of options : vars(options) @param args is the list of arguments : args @return string with informations: script, git hash, git branch, commandline
- utils.lisa.LISACommonFunctions.LoadFileNpStruct(FileName)
Load txt file of data and return a structured numpy array @param filename with one column per record and title of the record on the first line “#rec1 rec1 …” @return structured numpy array
- utils.lisa.LISACommonFunctions.Window(tm)
Apply window … @param tm is the time array @return the window array
- utils.lisa.LISACommonFunctions.makefromtemplate(output, template, keyChar, **kwargs)
Create an output file identical to the template file with the string between the key character KeyChar and corresponding to a keyword in kwargs replaced by the argument of the keyword @param output is the output file @param template is the template file @param keyChar is the key character surrounding keywords @param kwargs are keywords and corresponding arguments
- utils.lisa.LISACommonFunctions.run(command, disp=False, NoExit=False)
Run system command @param command is a string to run as a system command @param disp is true to display the command @param is true to continue if the command failed
utils.lisa.constant module
- class utils.lisa.constant.Constant
Bases:
object- AU_SI = 149597870700.0
- C_SI = 299792458.0
- EPS = 1e-08
- F0 = 3.168753578687779e-08
- GAMMA = 0.5772156649015329
- GMSUN = 1.3271244210789466e+20
- G_SI = 6.67408e-11
- H0 = 67.1
- H0_SI = 2.1745629032171688e-18
- INVSQRT2 = 0.7071067811865476
- INVSQRT3 = 0.5773502691896257
- INVSQRT6 = 0.408248290463863
- INVSQRTPI = 0.5641895835477563
- INVSQRTTWOPI = 0.3989422804014327
- MRSUN_SI = 1476.6250615036158
- MSUN_SI = 1.98848e+30
- MTSUN_SI = 4.925491025873693e-06
- Omega0 = 1.9909865927683788e-07
- Omegalam = 0.6825
- Omegam = 0.3175
- PC_SI = 3.085677581491367e+16
- PI = 3.141592653589793
- PI_2 = 1.5707963267948966
- PI_3 = 1.0471975511965979
- PI_4 = 0.7853981633974483
- SQRT2 = 1.4142135623730951
- SQRT3 = 1.7320508075688772
- SQRT6 = 2.449489742783178
- SQRTPI = 1.772453850905516
- SQRTTWOPI = 2.5066282746310007
- YRSID_SI = 31558149.763545603
utils.lisa.cosmology module
- class utils.lisa.cosmology.Cosmology
Bases:
object- static DL(zup, w)
Compute the luminosity distance at redshift zup for a given w
- Parameters:
zup (float) – Redshift
w (float) – Dark energy equation of state parameter
- Returns:
Luminosity distance float: Proper distance
- Return type:
float
- Usage:
DL(3,w=0)[0]
- static H(zp, w)
Compute the Hubble parameter at redshift zp for a given w
- Parameters:
zp (float) – Redshift
w (float) – Dark energy equation of state parameter
- Returns:
Hubble parameter
- Return type:
float
- static findz(zm, dlum, ww)
Finding z for given DL, w
- Parameters:
zm (float) – Redshift
dlum (float) – Luminosity distance
ww (float) – Dark energy equation of state parameter
- Returns:
Luminosity distance
- Return type:
float
- static zofDl(DL, w, tolerance)
computes z(DL, w), Assumes DL in Mpc
- Parameters:
DL (float) – Luminosity distance
w (float) – Dark energy equation of state parameter
tolerance (float) – Tolerance
- Returns:
Redshift
- Return type:
float
utils.lisa.link_utils module
- utils.lisa.link_utils.arrayindex(a, x)
Return the array indices for
xina.>>> a = [1, 3, 5, 7] >>> indices = arrayindex([3, 7, 1], a) [1, 3, 0]
- Parameters:
x (array-like) – elements to search for
a (array-like) – array in which elements are searched for
- Returns:
List of array indices
- Return type:
ndarray- Raises:
ValueError – if not all elements of
xcannot be found ina.
- utils.lisa.link_utils.atleast_2d(a)
View inputs as arrays with at least two dimensions.
Contrary to numpy’s function, we here add the missing dimension on the last axis if needed.
>>> np.atleast_2d(3.0) array([[3.]]) >>> x = np.arange(3.0) >>> np.atleast_2d(x) array([[0., 1., 2.]]) >>> np.atleast_2d(x).base is x True >>> np.atleast_2d(1, [1, 2], [[1, 2]]) [array([[1]]), array([[1, 2]]), array([[1, 2]])]
- Parameters:
a (array-like) – input array
- Returns:
An array with
ndim >= 2.Copies are avoided where possible, and views with two or more dimensions are returned.
- Return type:
ndarray
- utils.lisa.link_utils.dot(a, b)
Dot product on the last axis.
- Parameters:
a (array-like) – input array
b (array-like) – input array
- utils.lisa.link_utils.emitter(link)
Return emitter spacecraft index from link index.
>>> emitter(12) array(2) >>> emitter([12, 31, 21]) array([2, 1, 1]) >>> emitter(np.array([23, 12])) array([3, 2])
- Parameters:
link (int) – link index
- Returns:
Emitter spacecraft index.
- Return type:
int
- utils.lisa.link_utils.norm(a)
Norm on the last axis.
- Parameters:
a (array-like) – input array
- utils.lisa.link_utils.receiver(link)
Return receiver spacecraft index from a link index.
>>> receiver(12) array(1) >>> receiver([12, 31, 21]) array([1, 3, 2]) >>> receiver(np.array([23, 12])) array([2, 1])
- Parameters:
link (int) – link index
- Returns:
Emitter spacecraft index.
- Return type:
int