Package pylal :: Module spawaveform
[hide private]
[frames] | no frames]

Source Code for Module pylal.spawaveform

  1  # Copyright (C) 2010  Kipp Cannon,  Drew Keppel 
  2  # 
  3  # This program is free software; you can redistribute it and/or modify it 
  4  # under the terms of the GNU General Public License as published by the 
  5  # Free Software Foundation; either version 2 of the License, or (at your 
  6  # option) any later version. 
  7  # 
  8  # This program is distributed in the hope that it will be useful, but 
  9  # WITHOUT ANY WARRANTY; without even the implied warranty of 
 10  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 
 11  # Public License for more details. 
 12  # 
 13  # You should have received a copy of the GNU General Public License along 
 14  # with this program; if not, write to the Free Software Foundation, Inc., 
 15  # 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. 
 16   
 17   
 18  # 
 19  # ============================================================================= 
 20  # 
 21  #                                   Preamble 
 22  # 
 23  # ============================================================================= 
 24  # 
 25   
 26   
 27  """ 
 28  This module is a wrapper of the _spawaveform module, supplementing the C 
 29  code in that module with additional features that are more easily 
 30  implemented in Python.  It is recommended that you import this module 
 31  rather than importing _spawaveform directly. 
 32  """ 
 33   
 34   
 35  import math 
 36   
 37   
 38  import lal 
 39  from pylal import git_version 
 40  from pylal._spawaveform import * 
 41   
 42   
 43  __author__ = "Kipp Cannon <kipp.cannon@ligo.org>" 
 44  __version__ = "git id %s" % git_version.id 
 45  __date__ = git_version.date 
 46   
 47   
 48  # 
 49  # ============================================================================= 
 50  # 
 51  #                                    Empty 
 52  # 
 53  # ============================================================================= 
 54  # 
 55   
 56   
57 -def imrchirptime(m1, m2, fLower, chi, a_hat = 0.98, e_folds = 10):
58 """ 59 An approximate IMR chirptime in seconds. 60 61 FIXME this should be replaced by something better 62 63 1) compute the SPA chirptime up to ringdown frequency at 3.5 PN, verify that it is nonnegative 64 2) then add efolds worth of ringdown time 65 66 Ringdown decay time forumla in solar masses is: 67 68 tau = 2 * (m1+m2) * 5e-6 * (0.7 + 1.4187 * (1-a_hat)**-0.4990) / (1.5251 - 1.1568 * (1-a_hat)**0.1292) 69 70 from (7-9) of LIGO-P1300156. 71 72 @param m1 Mass 1 73 @param m2 Mass 2 74 @param fLower the starting frequency 75 @param chi the effective spin parameter from computechi() 76 @param e_folds The number of efolds to use in the ringdown signal duration, default 10 77 @param a_hat The dimensionless spin of the final black hole, default 0.98 78 """ 79 80 assert (a_hat < 0.9999999999999999) # demand spin less than 1 (or approximately the closest floating point representation of 1) 81 fFinal = imrffinal(m1, m2, chi, 'ringdown') 82 assert (fFinal > fLower) # demand that the low frequency comes before the ringdown frequency 83 tau = 2 * (m1+m2) * 5e-6 * (0.7 + 1.4187 * (1-a_hat)**-0.4990) / (1.5251 - 1.1568 * (1-a_hat)**0.1292) 84 inspiral_time = chirptime(m1, m2, 7, fLower, fFinal, chi) 85 if inspiral_time < 0: 86 raise ValueError("Inspiral time is negative: m1 = %e, m2 = %e, flow = %e, chi = %e" % (m1, m2, fLower, chi)) # demand positive inspiral times 87 return inspiral_time + e_folds * tau
88 89
90 -def eta(m1, m2):
91 """ 92 Compute the symmetric mass ratio, eta. 93 """ 94 return m1*m2/(m1+m2)**2.
95 96
97 -def chirpmass(m1, m2):
98 """ 99 Compute the chirp mass in seconds. 100 """ 101 return lal.MTSUN_SI * (m1+m2) * eta(m1, m2)**.6
102 103
104 -def ms2taus(m1, m2, f0 = 40.0):
105 """ 106 Solve for tau_0 and tau_3 from m1 and m2. 107 """ 108 tau0 = 5./256./(math.pi*f0)**(8./3.) * chirpmass(m1,m2)**(-5./3.) 109 tau3 = math.pi/8./eta(m1,m2)**.6/(math.pi*f0)**(5./3.) * chirpmass(m1,m2)**(-2./3.) 110 return tau0, tau3
111 112
113 -def taus2ms(tau0, tau3, f0 = 40.0):
114 """ 115 Solve for m1 and m2 from tau_0 and tau_3. 116 """ 117 Mc = (5./256./(math.pi*f0)**(8./3.) / tau0)**(3./5.) 118 eta = (math.pi/8./(math.pi*f0)**(5./3.) / tau3 / Mc**(2./3.))**(5./3.) 119 120 M = Mc / eta**(3./5.) 121 122 m1 = (1. + abs(1. - 4.*eta)**.5) * M / 2. 123 m2 = M - m1 124 125 return m1 / lal.MTSUN_SI, m2 / lal.MTSUN_SI
126