Skip to content
Snippets Groups Projects
Commit 7a025619 authored by Yifan Wang's avatar Yifan Wang
Browse files

adding plots for parity violation waveform

parent 11cdb81a
Branches
No related tags found
No related merge requests found
from pycbc.waveform import get_fd_waveform
#import numpy as np
#import pycbc.conversions
import lal
import pycbc.waveform
def IMRPhenomParity(parity_Amu, **kwds):
if 'approximant' in kwds:
kwds.pop("approximant")
hp, hc = get_fd_waveform(approximant="IMRPhenomXPHM", **kwds)
temp = 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
pycbc.waveform.add_custom_waveform('IMRPhenomParity', IMRPhenomParity, 'frequency', force=True)
\ No newline at end of file
%% Cell type:code id:0bf66287 tags:
``` python
import birefringence_waveform
```
%% Cell type:code id:e021c49d tags:
``` python
from pycbc.waveform import get_fd_waveform
```
%% Cell type:code id:7a58382b tags:
``` python
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
################################################################################
#
# PLOTTING OPTIONS
#
################################################################################
# PLOTTING OPTIONS
fig_width_pt = 3*246.0 # Get this from LaTeX using \showthe\columnwidth
inches_per_pt = 1.0/72.27 # Convert pt to inch
golden_mean = (np.sqrt(5)-1.0)/2.0 # Aesthetic ratio
fig_width = fig_width_pt*inches_per_pt # width in inches
fig_height = fig_width*golden_mean # height in inches
fig_size = [fig_width,fig_height]
params = { 'axes.labelsize': 24,
'font.family': 'serif',
'font.serif': 'Computer Modern Raman',
'font.size': 24,
'legend.fontsize': 20,
'xtick.labelsize': 24,
'ytick.labelsize': 24,
'axes.grid' : True,
'text.usetex': True,
'savefig.dpi' : 100,
'lines.markersize' : 14,
'figure.figsize': fig_size}
mpl.rcParams.update(params)
```
%% Cell type:code id:79926da0 tags:
``` python
hp,hc = get_fd_waveform(approximant='IMRPhenomParity',parity_Amu=0,mass1=30,mass2=30,f_lower=20,delta_f=1/32)
hpIMR,_ = get_fd_waveform(approximant='IMRPhenomXPHM',mass1=30,mass2=30,f_lower=20,delta_f=1/32)
```
%% Cell type:code id:c2b5578d tags:
``` python
plt.plot(hp.sample_frequencies,hp,label='my waveform hp')
plt.plot(hc.sample_frequencies,hc,label='my waveform hc')
plt.plot(hpIMR.sample_frequencies,hpIMR,label='PyCBC',ls='--')
plt.legend()
plt.xlim(20,100)
```
%% Output
/Users/yifanwang/lscsoft/py37/lib/python3.7/site-packages/numpy/core/_asarray.py:102: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)
/Users/yifanwang/lscsoft/py37/lib/python3.7/site-packages/numpy/core/_asarray.py:102: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)
/Users/yifanwang/lscsoft/py37/lib/python3.7/site-packages/numpy/core/_asarray.py:102: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)
(20.0, 100.0)
%% Cell type:code id:838b8a6e tags:
``` python
hp_no,hc_no = get_fd_waveform(approximant='IMRPhenomParity',parity_Amu=0,mass1=30,mass2=30,f_lower=20,delta_f=1/32)
hp,hc = get_fd_waveform(approximant='IMRPhenomParity',parity_Amu=10,mass1=30,mass2=30,f_lower=20,delta_f=1/32)
```
%% Cell type:code id:599bf95e tags:
``` python
plt.plot(hp_no.sample_frequencies,hp_no,label='GR waveform')
plt.plot(hp.sample_frequencies,hp,label='Pairty violation $A_\mu$ = 10 $GeV^{-1}$')
plt.legend()
plt.xlim(20,100)
```
%% Output
/Users/yifanwang/lscsoft/py37/lib/python3.7/site-packages/numpy/core/_asarray.py:102: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)
/Users/yifanwang/lscsoft/py37/lib/python3.7/site-packages/numpy/core/_asarray.py:102: ComplexWarning: Casting complex values to real discards the imaginary part
return array(a, dtype, copy=False, order=order)
(20.0, 100.0)
%% Cell type:code id:a84850db tags:
``` python
```
import birefringence_waveform
from pycbc.waveform import fd_approximants
# List of fd approximants that are currently available
print(fd_approximants())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment