From a3f79e3f26feb4d665cd49fa2d2bf0a7a711e641 Mon Sep 17 00:00:00 2001
From: Yifan Wang <yifan.wang@aei.mpg.de>
Date: Wed, 14 Jul 2021 19:53:37 +0200
Subject: [PATCH] add IMRPhenomPv2 parity violation waveform for injection
 purpose

---
 testwaveform/README      |  3 +++
 testwaveform/setup.py    | 34 ++++++++++++++++++++++++++++++++++
 testwaveform/waveform.py | 19 +++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 testwaveform/README
 create mode 100644 testwaveform/setup.py
 create mode 100644 testwaveform/waveform.py

diff --git a/testwaveform/README b/testwaveform/README
new file mode 100644
index 0000000..9f9c4b1
--- /dev/null
+++ b/testwaveform/README
@@ -0,0 +1,3 @@
+I'm testing the pycbc waveform plugin.
+- IMRPhenomParity with IMRPhenomPv2
+- coalescence phase marginalization, polarization marginalization, full Gaussian likelihood
\ No newline at end of file
diff --git a/testwaveform/setup.py b/testwaveform/setup.py
new file mode 100644
index 0000000..cab988d
--- /dev/null
+++ b/testwaveform/setup.py
@@ -0,0 +1,34 @@
+"""
+setup.py file for testing birefringence pycbc waveform plugin package
+"""
+
+from setuptools import Extension, setup, Command
+from setuptools import find_packages
+
+VERSION = '0.0.dev0'
+
+setup (
+    name = 'pycbc-birefringence',
+    version = VERSION,
+    description = 'An waveform plugin for PyCBC',
+    author = 'Yifan Wang',
+    author_email = 'yifan.wang@aei.mpg.de',
+    url = 'http://www.pycbc.org/',
+    #download_url = 'https://github.com/gwastro/revchirp/tarball/v%s' % VERSION,
+    keywords = ['pycbc', 'signal processing', 'gravitational waves'],
+    install_requires = ['pycbc'],
+    py_modules = ['dipole'],
+    entry_points = {"pycbc.waveform.fd":"IMRPhenomPv2Parity = waveform:gen",
+                    "pycbc.waveform.length":"IMRPhenomPv2Parity = pycbc.waveform._filter_time_lengths["IMRPhenomPv2"]"},
+    classifiers=[
+        'Programming Language :: Python',
+        'Programming Language :: Python :: 2.7',
+        'Programming Language :: Python :: 3.6',
+        'Intended Audience :: Science/Research',
+        'Natural Language :: English',
+        'Topic :: Scientific/Engineering',
+        'Topic :: Scientific/Engineering :: Astronomy',
+        'Topic :: Scientific/Engineering :: Physics',
+        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
+    ],
+)
diff --git a/testwaveform/waveform.py b/testwaveform/waveform.py
new file mode 100644
index 0000000..2a4f6c8
--- /dev/null
+++ b/testwaveform/waveform.py
@@ -0,0 +1,19 @@
+def gen(**kwds):
+    from pycbc.waveform import get_fd_waveform
+    import lal
+
+    if 'approximant' in kwds:
+        kwds.pop("approximant")
+    hp, hc = get_fd_waveform(approximant="IMRPhenomPv2", **kwds)
+
+    temp =  kwds['parity_Amu'] / 1e9 / lal.QE_SI * lal.H_SI * lal.PI * lal.PI / lal.H0_SI
+
+    hp_parity = hp + hc * temp * hp.sample_frequencies **2
+    hc_parity = hc - hp * temp * hp.sample_frequencies **2
+
+    return hp_parity, hc_parity
+
+def add_me(**kwds):
+    kwds['cpu_fd']['IMRPhenomPv2Parity'] = gen
+    kwds['filter_time_lengths']['IMRPhenomPv2Parity'] = kwds['filter_time_lengths']['IMRPhenomPv2']
+
-- 
GitLab