Skip to content

Instantly share code, notes, and snippets.

View llondon6's full-sized avatar

Lionel London llondon6

View GitHub Profile
@llondon6
llondon6 / maketaper_example.py
Created November 1, 2017 12:40
Quick example for using maketaper in positive.maths
# The maketaper functoin takes in a time series (any function domain really), and a 2x1 iterable of indeces defining the start and end of the taper.
# For example:
# Make fake data
mock_times = arange(1,10)
mock_range_values = ones_like( dummy_times )
index_start = 1
index_end = 4
# Create a taper function
@llondon6
llondon6 / scsearch_databasedir_check.py
Created September 20, 2017 09:14
Print the location of nrutils' database directory
import nrutils
# Print the location of internal directories
nrutils.core.my_settings.show()
@llondon6
llondon6 / nrutils_example.py
Created September 19, 2017 09:54
Quick example of using nrutils to find a simulation and load+plot data
# Import useful things
from nrutils import scsearch, gwylm, alert
# Find some simulations
alert('Finding simulations',header=True)
A = scsearch(q=[3,5],nonspinning=True,verbose=True,institute='gt')
# Choose one, and print its properties
alert('Printing props for a single simulation',header=True)
a = A[0];
for k in a.__dict__: print '>> %s = %s'%(k,str(a.__dict__[k]))
# Load select multipoles from this simulation and get rid of junk
@llondon6
llondon6 / pnw0.py
Created September 18, 2017 11:49
Estimate lowest frequency in gravitational waveform using leading order PN
#
def pnw0(m1,m2,D=10.0):
# https://arxiv.org/pdf/1310.1528v4.pdf
# Equation 228
# 2nd Reference: arxiv:0710.0614v1
# NOTE: this outputs orbital frequency
from numpy import sqrt,zeros,pi,array,sum
#
G = 1.0
c = 1.0
@llondon6
llondon6 / calchlm.py
Created September 18, 2017 11:41
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: