Skip to content

Instantly share code, notes, and snippets.

@llondon6
Created September 18, 2017 11:41
Show Gist options
  • Save llondon6/f64d25826c3d1ce9661afe7de397d27a to your computer and use it in GitHub Desktop.
Save llondon6/f64d25826c3d1ce9661afe7de397d27a to your computer and use it in GitHub Desktop.
Sample code for strain calculation
# Strain via ffi method
def calchlm(this,w22=None):
# Calculate strain according to the fixed frequency method of http://arxiv.org/pdf/1006.1632v3
#
from numpy import array,double
# If there is no w22 given, then use the internally defined value of wstart
if w22 is None:
# w22 = this.wstart
# NOTE: here we choose to use the ORBITAL FREQUENCY as a lower bound for the l=m=2 mode.
w22 = this.wstart_pn
# Reset
this.hlm = []
for y in this.ylm:
# Calculate the strain for each part of psi4. NOTE that there is currently NO special sign convention imposed beyond that used for psi4.
w0 = w22 * double(y.m)/2.0 # NOTE that wstart is defined in characterize_start_end() using the l=m=2 Psi4 multipole.
# Here, m=0 is a special case
if 0==y.m: w0 = w22
# Let the people know
if this.verbose:
alert( magenta('w%i%i = m*w22/2 = %f' % (y.l,y.m,w0) )+yellow(' (this is the lower frequency used for FFI method [arxiv:1006.1632v3])') )
# Create the core waveform information
t = y.t
h_plus = ffintegrate( y.t, y.plus, w0, 2 )
h_cross = ffintegrate( y.t, y.cross, w0, 2 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment