@@ -638,6 +638,59 @@ def tof_func(f):
638638 return (track_t , track_f )
639639
640640
641+ # Using code from Gonzalo Morras
642+ def _eccentric_newtonian_time (m1 , m2 , e0 , f_low ):
643+ '''
644+ function to compute Newtonian time to coalescence
645+ m1: Solar mass
646+ m2: Solar mass
647+ e0: eccentricity defined at f_low
648+ f_low: lower cut_off frequency
649+ '''
650+ M = m1 + m2
651+ e0_sq = e0 * e0
652+ one_minus_e0Sq = 1 - e0_sq
653+ one_minus_e0Sq_sqrt = numpy .sqrt (one_minus_e0Sq )
654+ velocity = frequency_to_velocity (f_low , M )
655+ weighted_velocity = velocity / one_minus_e0Sq_sqrt
656+ eta = conversions .eta_from_mass1_mass2 (mass1 , mass2 )
657+ M_sec = M * lal .MTSUN_SI
658+ t_N = 5 / (256 * one_minus_e0Sq_sqrt * eta ) * M_sec * (weighted_velocity ** - 8 ) \
659+ * F_tLO_series (e0_sq )
660+ return t_N
661+
662+ eccentric_newtonian_time = numpy .vectorize (_eccentric_newtonian_time )
663+
664+ def F_tLO_series (ec_sq , ec_sq_thr = 0.4 ):
665+ if numpy .asarray (ec_sq ).ndim == 0 :
666+ #if ec_sq small, use series expansion at 0, otherwise use series expansion at 1
667+ if ec_sq < ec_sq_thr : return F_tLO_series_at_0 (ec_sq )
668+ else : return F_tLO_series_at_1 (ec_sq )
669+
670+ else :
671+ #if ec_sq small, use series expansion at 0, otherwise use series expansion at 1
672+ F = numpy .zeros_like (ec_sq )
673+ i_low = ec_sq < ec_sq_thr
674+ i_high = numpy .logical_not (i_low )
675+ if sum (i_low )> 0 : F [i_low ] = F_tLO_series_at_0 (ec_sq [i_low ])
676+ if sum (i_high )> 0 : F [i_high ] = F_tLO_series_at_1 (ec_sq [i_high ])
677+ return F
678+
679+ #compute the series expansion of the tLO integral for x->0 (here x=e**2)
680+ # F = (24/19)*x**(-24/19)*((1 + (121/304)*x)**(-3480/2299))*sqrt(1-x)*integral((x**(5/19))*((1 + (121/304)*x)**(1181/2299))*((1 - x)**(-3/2)))
681+ def F_tLO_series_at_0 (x ):
682+ coefs = numpy .array ([1.000000000000000 , - 0.1511627906976744 , 0.2656836084021005 , 0.007463780007501875 , 0.08800790590714085 , 0.03153077124184580 , 0.04185392210761341 , 0.02761371124737777 , 0.02642686119635599 , 0.02145414169943131 , 0.01926563742403364 , 0.01677217450181226 , 0.01503898450331388 , 0.01347003088516929 , 0.01220348405026613 , 0.01110346195121149 , 0.01016749330223870 , 0.009352447459389354 , 0.008642114232972108 , 0.008016709107501086 , 0.007463457161231162 ,0.006970902964332086 , 0.006530253812462707 , 0.006134111124121483 , 0.005776451398258840 , 0.005452229768143720 , 0.005157232928828976 , 0.004887901117379935 , 0.004641215172072290 , 0.004414596725230578 ,0.004205833180162198 , 0.004013015784562471 , 0.003834490347048246 ,0.003668816871424952 , 0.003514736646109113 , 0.003371145103099870 , 0.003237069368178693 , 0.003111649567641214 , 0.002994123194217794 , 0.002883811964918853 , 0.002780110725151045 , 0.002682478039498533 ,0.002590428180410570 , 0.002503524280447905 , 0.002421372457429333 ,0.002343616756405161 , 0.002269934780185545 , 0.002200033902499887 , 0.002133647975961232 , 0.002070534461714599 , 0.002010471919657125 ])
683+ return numpy .polyval (numpy .flip (coefs ),x )
684+
685+ #compute the series expansion of the tLO integral for x->1 (here x=e**2)
686+ def F_tLO_series_at_1 (x ):
687+ #we are going to approximate the integral of ((1 - 1/u**2)**(5/19))*(1 - (121/425)/u**2)**(1181/2299) - 1 as -f0 + sum_{n=1}^{nmax} cn*u**-(2*n-1)
688+ cns = numpy .array ([0.40941176470588236 , 0.02286320645905421 , 0.008142925951557094 , 0.004155878512401501 , 0.0024847568765827364 , 0.001633290511588348 , 0.0011455395465032605 , 0.000842577094447224 , 0.0006427195446513564 , 0.0005045715814217113 , 0.00040544477831148924 , 0.0003321116545345162 , 0.0002764636962467965 , 0.00023331895675436905 , 0.0001992473575067662 , 0.00017190919726595898 , 0.00014966654751355843 , 0.000131346469484909 , 0.00011609207361015848 , 0.00010326617525262309 , 9.238740896587563e-05 , 8.308691874613337e-05 , 7.50784086790562e-05 , 6.813705814151314e-05 , 6.20844345948999e-05 , 5.677753690123865e-05 , 5.210072977646673e-05 , 4.7959732146031274e-05 , 4.427708468062032e-05 , 4.0988696117937945e-05 , 3.80411855904995e-05 , 3.538981870077757e-05 , 3.2996890965966614e-05 , 3.083045152872919e-05 , 2.886328796018351e-05 , 2.707211306399751e-05 , 2.543690918050699e-05 , 2.3940396192787112e-05 , 2.256759736012561e-05 , 2.1305483020854193e-05 , 2.014267666038337e-05 , 1.906921121897629e-05 , 1.8076326095558655e-05 , 1.7156297290322297e-05 , 1.6302294667351972e-05 , 1.550826151746742e-05 , 1.4768812541410176e-05 , 1.407914711455732e-05 ])
689+ #evaluate polynomial
690+ u = 1 - x
691+ return ((48 / 19 )* ((425 / 304 )** (1181 / 2299 )))* (1 - 1.4555165803216864 * numpy .sqrt (u ) + u * numpy .polyval (numpy .flip (cns ),u ))* (x ** (- 24 / 19 ))* ((1 + (121 / 304 )* x )** (- 3480 / 2299 ))
692+
693+
641694##############################This code was taken from Andy ###########
642695
643696
0 commit comments