Skip to content

Commit

Permalink
Added examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
transientlunatic committed Jan 7, 2025
1 parent 8d6b9dd commit 09a8c80
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/1-seobnrv3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import minke
import astropy.units as u

from minke.models.cbc import IMRPhenomPv1
from minke.detector import AdvancedLIGOHanford

model = IMRPhenomPv1()

parameters = {"mass_ratio": 0.7, "total_mass": 100*u.solMass, "luminosity_distance": 10*u.megaparsec}

data = model.time_domain(parameters)

data = model.time_domain(mass_ratio=0.7, total_mass=100*u.solMass)

f = data['plus'].plot()
f.savefig("docs/images/cbc/waveform-imrphenompv1.png")

detector = AdvancedLIGOHanford()

projected = data.project(detector,
ra=1, dec=0.5,
iota=0.4,
phi_0=0,
psi=0
)

f = projected.plot()
f.savefig("projected_waveform.png")
8 changes: 8 additions & 0 deletions examples/2-noise.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from minke.noise import AdvancedLIGO

noise = AdvancedLIGO()

data = noise.time_series(duration=4, sample_rate=16384)

f = data.plot()
f.savefig("noise.png")
30 changes: 30 additions & 0 deletions examples/3-injection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from minke.noise import AdvancedLIGO
import astropy.units as u

from minke.models.cbc import IMRPhenomPv2
from minke.detector import AdvancedLIGOHanford

noise = AdvancedLIGO()

noise_ts = noise.time_series(duration=4, sample_rate=16384, epoch=998)

model = IMRPhenomPv2()

parameters = {"mass_ratio": 0.7, "total_mass": 100*u.solMass, "luminosity_distance": 100*u.megaparsec, "gpstime": 1000}

data = model.time_domain(parameters, times=noise_ts.times)
f = data['plus'].plot()
f.savefig("waveform.png")

detector = AdvancedLIGOHanford()

projected = data.project(detector,
ra=1, dec=0.5,
iota=0.4,
phi_0=0,
psi=0
)
injection = (noise_ts + projected)
f = injection.plot()
f.savefig("projected_injection.png")
injection.write("test_injection.gwf", format="gwf")
24 changes: 24 additions & 0 deletions examples/4-make-injection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from minke.injection import make_injection_zero_noise
from minke.noise import AdvancedLIGO
from minke.models.cbc import IMRPhenomPv2
from minke.detector import AdvancedLIGOHanford

import astropy.units as u


detectors = {"AdvancedLIGOHanford": "AdvancedLIGO"}

parameters = {"mass_ratio": 0.7,
"total_mass": 100*u.solMass,
"luminosity_distance": 100*u.megaparsec,
"ra": 1,
"dec": 0.5,
"iota": 0.4,
"phi_0": 0,
"psi": 0,
"gpstime": 1000}

injection = make_injection_zero_noise(detectors=detectors, injection_parameters=parameters, duration=4, sample_rate=16384, epoch=998)['H1']

f = injection.plot()
f.savefig("injection_function_zero.png")
32 changes: 32 additions & 0 deletions examples/5-sinegaussian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import minke
import astropy.units as u

from minke.models.bursts import SineGaussian
from minke.detector import AdvancedLIGOHanford

model = SineGaussian()

parameters = {"centre_frequency": 20,
"phase": 0,
"eccentricity": 0,
"q": 1.,
"sample_rate": 4096 * u.Hertz,
"gsptime": 998,
"hrss": 1e-22,
"duration": 2*u.second}

data = model.time_domain(parameters)
f = data['plus'].plot()
f.savefig("sinegaussian.png")

detector = AdvancedLIGOHanford()

projected = data.project(detector,
ra=1, dec=0.5,
iota=0.4,
phi_0=0,
psi=0
)

f = projected.plot()
f.savefig("projected_sinegaussian.png")

0 comments on commit 09a8c80

Please sign in to comment.