GWFIT 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
gwfit-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2026] [Samanwaya Mukherjee]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
gwfit-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: GWFIT
3
+ Version: 0.1.0
4
+ Summary: Gravitational Waveform Integration Tools
5
+ Author: Samanwaya Mukherjee
6
+ License: MIT License
7
+
8
+ Copyright (c) [2026] [Samanwaya Mukherjee]
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy
32
+ Requires-Dist: scipy
33
+ Requires-Dist: sxs
34
+ Provides-Extra: legacy
35
+ Requires-Dist: h5py; extra == "legacy"
36
+ Requires-Dist: pycbc; extra == "legacy"
37
+ Dynamic: license-file
38
+
39
+ # GWFIT
40
+
41
+ **Gravitational Waveform Integration Tools**
42
+
43
+ GWFIT is a Python package for gravitational-wave modelling and analysis, with utilities for waveform generation, inspiral modelling, numerical-relativity data analysis, horizon fluxes, and neutron-star calculations.
44
+
45
+ ## Features
46
+
47
+ * Gravitational-waveform and inspiral modelling
48
+ * Numerical-relativity data handling
49
+ * Horizon flux and tidal-heating calculations
50
+ * Neutron-star utilities
51
+ * Physical constants and useful relations
52
+
53
+ ## Installation
54
+
55
+ Clone the repository:
56
+
57
+ ```bash
58
+ git clone https://gitlab.com/samanwaya-mukherjee/gwfit.git
59
+ cd gwfit
60
+ ```
61
+
62
+ Install GWFIT in editable mode:
63
+
64
+ ```bash
65
+ python -m pip install -e .
66
+ ```
67
+
68
+ For development, the editable installation is recommended so that changes to the source code are immediately available.
69
+
70
+ ### Legacy functionality
71
+
72
+ Some older implementations are included under `gwfit.legacy`. Their additional dependencies can be installed with:
73
+
74
+ ```bash
75
+ python -m pip install -e ".[legacy]"
76
+ ```
77
+
78
+ ## Basic usage
79
+
80
+ After installation, GWFIT can be imported as:
81
+
82
+ ```python
83
+ import gwfit
84
+ ```
85
+
86
+ The main components are organized into subpackages:
87
+
88
+ ```python
89
+ from gwfit import physics
90
+ from gwfit import waveforms
91
+ from gwfit import nr
92
+ from gwfit import neutron_star
93
+ ```
94
+
95
+ For example, specific modules can be imported with:
96
+
97
+ ```python
98
+ from gwfit.waveforms import inspiral_model
99
+ from gwfit.nr import nr_data_utils
100
+ from gwfit.physics import constants
101
+ ```
102
+
103
+ ## Project structure
104
+
105
+ ```text
106
+ gwfit/
107
+ ├── LICENSE
108
+ ├── pyproject.toml
109
+ ├── README.md
110
+ └── src/
111
+ └── gwfit/
112
+ ├── __init__.py
113
+ ├── legacy/
114
+ ├── neutron_star/
115
+ ├── nr/
116
+ ├── physics/
117
+ └── waveforms/
118
+ ```
119
+
120
+ ## Dependencies
121
+
122
+ The core package currently depends on:
123
+
124
+ * NumPy
125
+ * SciPy
126
+ * SXS
127
+
128
+ Additional dependencies for legacy functionality are:
129
+
130
+ * h5py
131
+ * PyCBC
132
+
133
+ ## Development
134
+
135
+ GWFIT is under active development. Contributions, suggestions, and bug reports are welcome.
136
+
137
+ ## License
138
+
139
+ GWFIT is distributed under the [MIT License](LICENSE).
140
+
141
+ ## Author
142
+
143
+ **Samanwaya Mukherjee**
gwfit-0.1.0/README.md ADDED
@@ -0,0 +1,105 @@
1
+ # GWFIT
2
+
3
+ **Gravitational Waveform Integration Tools**
4
+
5
+ GWFIT is a Python package for gravitational-wave modelling and analysis, with utilities for waveform generation, inspiral modelling, numerical-relativity data analysis, horizon fluxes, and neutron-star calculations.
6
+
7
+ ## Features
8
+
9
+ * Gravitational-waveform and inspiral modelling
10
+ * Numerical-relativity data handling
11
+ * Horizon flux and tidal-heating calculations
12
+ * Neutron-star utilities
13
+ * Physical constants and useful relations
14
+
15
+ ## Installation
16
+
17
+ Clone the repository:
18
+
19
+ ```bash
20
+ git clone https://gitlab.com/samanwaya-mukherjee/gwfit.git
21
+ cd gwfit
22
+ ```
23
+
24
+ Install GWFIT in editable mode:
25
+
26
+ ```bash
27
+ python -m pip install -e .
28
+ ```
29
+
30
+ For development, the editable installation is recommended so that changes to the source code are immediately available.
31
+
32
+ ### Legacy functionality
33
+
34
+ Some older implementations are included under `gwfit.legacy`. Their additional dependencies can be installed with:
35
+
36
+ ```bash
37
+ python -m pip install -e ".[legacy]"
38
+ ```
39
+
40
+ ## Basic usage
41
+
42
+ After installation, GWFIT can be imported as:
43
+
44
+ ```python
45
+ import gwfit
46
+ ```
47
+
48
+ The main components are organized into subpackages:
49
+
50
+ ```python
51
+ from gwfit import physics
52
+ from gwfit import waveforms
53
+ from gwfit import nr
54
+ from gwfit import neutron_star
55
+ ```
56
+
57
+ For example, specific modules can be imported with:
58
+
59
+ ```python
60
+ from gwfit.waveforms import inspiral_model
61
+ from gwfit.nr import nr_data_utils
62
+ from gwfit.physics import constants
63
+ ```
64
+
65
+ ## Project structure
66
+
67
+ ```text
68
+ gwfit/
69
+ ├── LICENSE
70
+ ├── pyproject.toml
71
+ ├── README.md
72
+ └── src/
73
+ └── gwfit/
74
+ ├── __init__.py
75
+ ├── legacy/
76
+ ├── neutron_star/
77
+ ├── nr/
78
+ ├── physics/
79
+ └── waveforms/
80
+ ```
81
+
82
+ ## Dependencies
83
+
84
+ The core package currently depends on:
85
+
86
+ * NumPy
87
+ * SciPy
88
+ * SXS
89
+
90
+ Additional dependencies for legacy functionality are:
91
+
92
+ * h5py
93
+ * PyCBC
94
+
95
+ ## Development
96
+
97
+ GWFIT is under active development. Contributions, suggestions, and bug reports are welcome.
98
+
99
+ ## License
100
+
101
+ GWFIT is distributed under the [MIT License](LICENSE).
102
+
103
+ ## Author
104
+
105
+ **Samanwaya Mukherjee**
@@ -0,0 +1,28 @@
1
+ [project]
2
+ name = "GWFIT"
3
+ version = "0.1.0"
4
+ description = "Gravitational Waveform Integration Tools"
5
+ readme = "README.md"
6
+ license = {file = "LICENSE"}
7
+ requires-python = ">=3.10"
8
+ authors = [
9
+ {name = "Samanwaya Mukherjee"}
10
+ ]
11
+ dependencies = [
12
+ "numpy",
13
+ "scipy",
14
+ "sxs",
15
+ ]
16
+
17
+ [project.optional-dependencies]
18
+ legacy = [
19
+ "h5py",
20
+ "pycbc",
21
+ ]
22
+
23
+ [build-system]
24
+ requires = ["setuptools>=68"]
25
+ build-backend = "setuptools.build_meta"
26
+
27
+ [tool.setuptools.packages.find]
28
+ where = ["src"]
gwfit-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: GWFIT
3
+ Version: 0.1.0
4
+ Summary: Gravitational Waveform Integration Tools
5
+ Author: Samanwaya Mukherjee
6
+ License: MIT License
7
+
8
+ Copyright (c) [2026] [Samanwaya Mukherjee]
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Requires-Python: >=3.10
29
+ Description-Content-Type: text/markdown
30
+ License-File: LICENSE
31
+ Requires-Dist: numpy
32
+ Requires-Dist: scipy
33
+ Requires-Dist: sxs
34
+ Provides-Extra: legacy
35
+ Requires-Dist: h5py; extra == "legacy"
36
+ Requires-Dist: pycbc; extra == "legacy"
37
+ Dynamic: license-file
38
+
39
+ # GWFIT
40
+
41
+ **Gravitational Waveform Integration Tools**
42
+
43
+ GWFIT is a Python package for gravitational-wave modelling and analysis, with utilities for waveform generation, inspiral modelling, numerical-relativity data analysis, horizon fluxes, and neutron-star calculations.
44
+
45
+ ## Features
46
+
47
+ * Gravitational-waveform and inspiral modelling
48
+ * Numerical-relativity data handling
49
+ * Horizon flux and tidal-heating calculations
50
+ * Neutron-star utilities
51
+ * Physical constants and useful relations
52
+
53
+ ## Installation
54
+
55
+ Clone the repository:
56
+
57
+ ```bash
58
+ git clone https://gitlab.com/samanwaya-mukherjee/gwfit.git
59
+ cd gwfit
60
+ ```
61
+
62
+ Install GWFIT in editable mode:
63
+
64
+ ```bash
65
+ python -m pip install -e .
66
+ ```
67
+
68
+ For development, the editable installation is recommended so that changes to the source code are immediately available.
69
+
70
+ ### Legacy functionality
71
+
72
+ Some older implementations are included under `gwfit.legacy`. Their additional dependencies can be installed with:
73
+
74
+ ```bash
75
+ python -m pip install -e ".[legacy]"
76
+ ```
77
+
78
+ ## Basic usage
79
+
80
+ After installation, GWFIT can be imported as:
81
+
82
+ ```python
83
+ import gwfit
84
+ ```
85
+
86
+ The main components are organized into subpackages:
87
+
88
+ ```python
89
+ from gwfit import physics
90
+ from gwfit import waveforms
91
+ from gwfit import nr
92
+ from gwfit import neutron_star
93
+ ```
94
+
95
+ For example, specific modules can be imported with:
96
+
97
+ ```python
98
+ from gwfit.waveforms import inspiral_model
99
+ from gwfit.nr import nr_data_utils
100
+ from gwfit.physics import constants
101
+ ```
102
+
103
+ ## Project structure
104
+
105
+ ```text
106
+ gwfit/
107
+ ├── LICENSE
108
+ ├── pyproject.toml
109
+ ├── README.md
110
+ └── src/
111
+ └── gwfit/
112
+ ├── __init__.py
113
+ ├── legacy/
114
+ ├── neutron_star/
115
+ ├── nr/
116
+ ├── physics/
117
+ └── waveforms/
118
+ ```
119
+
120
+ ## Dependencies
121
+
122
+ The core package currently depends on:
123
+
124
+ * NumPy
125
+ * SciPy
126
+ * SXS
127
+
128
+ Additional dependencies for legacy functionality are:
129
+
130
+ * h5py
131
+ * PyCBC
132
+
133
+ ## Development
134
+
135
+ GWFIT is under active development. Contributions, suggestions, and bug reports are welcome.
136
+
137
+ ## License
138
+
139
+ GWFIT is distributed under the [MIT License](LICENSE).
140
+
141
+ ## Author
142
+
143
+ **Samanwaya Mukherjee**
@@ -0,0 +1,24 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/GWFIT.egg-info/PKG-INFO
5
+ src/GWFIT.egg-info/SOURCES.txt
6
+ src/GWFIT.egg-info/dependency_links.txt
7
+ src/GWFIT.egg-info/requires.txt
8
+ src/GWFIT.egg-info/top_level.txt
9
+ src/gwfit/__init__.py
10
+ src/gwfit/legacy/__init__.py
11
+ src/gwfit/legacy/inspiral_th_model_legacy.py
12
+ src/gwfit/legacy/nr_data_utils_legacy.py
13
+ src/gwfit/legacy/nr_heat_legacy.py
14
+ src/gwfit/neutron_star/__init__.py
15
+ src/gwfit/neutron_star/neutron_star_functions.py
16
+ src/gwfit/nr/__init__.py
17
+ src/gwfit/nr/nr_data_utils.py
18
+ src/gwfit/nr/nr_heat.py
19
+ src/gwfit/physics/__init__.py
20
+ src/gwfit/physics/constants.py
21
+ src/gwfit/physics/useful_relations.py
22
+ src/gwfit/waveforms/__init__.py
23
+ src/gwfit/waveforms/inspiral_model.py
24
+ src/gwfit/waveforms/waveform_functions.py
@@ -0,0 +1,7 @@
1
+ numpy
2
+ scipy
3
+ sxs
4
+
5
+ [legacy]
6
+ h5py
7
+ pycbc
@@ -0,0 +1 @@
1
+ gwfit
@@ -0,0 +1,3 @@
1
+ """GWFIT: Gravitational Waveform Integration Tools."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1 @@
1
+ """Legacy GWFIT implementations."""
@@ -0,0 +1,182 @@
1
+ import numpy as np
2
+ from ..physics.constants import MTsun, time_fac, strain_fac
3
+ from ..waveforms import waveform_functions as wfn
4
+ from pycbc import types, waveform, fft
5
+ from ..waveforms import inspiral_model as insp
6
+
7
+ def inspiral_TH(f_ini=10.,f_final=None, delta_t=None, m1=10, m2=10, chi1=0, chi2=0, H1=1, H2=1, DL=200, tc=0, phic=0, iota=0, amp_phase_only=False, amp_phase_hp_hc=False,approximant='SEOBNRv2',TH1=False,TH2=False,amp_corr=False):
8
+
9
+ # convert to sec
10
+ Ms = m1+m2
11
+ M = Ms * time_fac
12
+ DLt = DL * time_fac/strain_fac
13
+ # f_isco_KBH = wfn.f_isco_Msolar_KBH(m1,m2,chi1,chi2)
14
+
15
+ # if f_final is None: f_final = 0.03/M #f_isco_KBH
16
+ if delta_t is None: raise Exception('Specify delta_t')
17
+
18
+ hps, hcs = waveform.get_td_waveform(approximant=approximant,
19
+ mass1=m1, mass2=m2, spin1z=chi1, spin2z=chi2, distance = DL,
20
+ delta_t=delta_t, f_lower = f_ini-2, f_final = f_final)
21
+
22
+ f0 = waveform.utils.frequency_from_polarizations(hps,hcs)
23
+
24
+ ## Find the TD tapering needed
25
+ index = np.where(f0>f_ini)[0][0]
26
+ tini = hps.sample_times[0]
27
+ tfin = hps.sample_times[index]
28
+
29
+
30
+
31
+ ## Apply tapering to TD data
32
+ hps = waveform.utils.td_taper(hps,tini,tfin)
33
+ hcs = waveform.utils.td_taper(hcs,tini,tfin)
34
+ # if f_final is not None:
35
+ # index2 = np.where(f0>(f_final-2))[0][0]
36
+ # index3 = np.where(f0>f_final)[0][0]
37
+ # tini2 = hps.sample_times[index2]
38
+ # tfin2 = hps.sample_times[index3]
39
+ # hps = waveform.utils.td_taper(hps,tini2,tfin2,side='right')
40
+ # hcs = waveform.utils.td_taper(hcs,tini2,tfin2,side='right')
41
+
42
+ ## Take FFT
43
+ hpstilde = hps.to_frequencyseries()
44
+ hcstilde = hcs.to_frequencyseries()
45
+
46
+ f = hpstilde.sample_frequencies
47
+ index0 = np.where(f>f_ini-2)[0][0]
48
+
49
+ finsp = f[index0:]
50
+ patch = np.zeros(index0)
51
+
52
+ ## Extract amplitude & phase
53
+ amps = waveform.utils.amplitude_from_frequencyseries(hpstilde)
54
+ amps=np.asarray(amps)
55
+ phases = waveform.utils.phase_from_frequencyseries(hpstilde)
56
+ phases=np.asarray(phases)
57
+
58
+ ## Compute TH corrections
59
+ if TH1==1: psi_TH = insp.psiTH(finsp,m1,m2,chi1,chi2,H1,H2)
60
+ if TH2==1: psi_TH = insp.psiTH_new(finsp,m1,m2,chi1,chi2)
61
+ if TH1==0 and TH2==0: psi_TH = np.zeros_like(finsp)
62
+ amp_TH = insp.ampTH(finsp,m1,m2,chi1,chi2,DL,H1,H2)
63
+
64
+ psi_TH = np.concatenate((patch,psi_TH))
65
+ amp_TH = np.concatenate((patch,amp_TH))
66
+
67
+ psi_TH = types.FrequencySeries(psi_TH,delta_f=hpstilde.delta_f)
68
+ amp_TH = types.FrequencySeries(amp_TH,delta_f=hpstilde.delta_f)
69
+
70
+ ## Tapering starts from f_ini-2 to f_ini; ends from f_peak to 1.2f_peak
71
+ psi_TH = waveform.utils.fd_taper(psi_TH,f_ini-2,f_ini)
72
+ amp_TH = waveform.utils.fd_taper(amp_TH,f_ini-2,f_ini)
73
+
74
+ fpeak = wfn.f_peak(m1,m2,chi1,chi2)
75
+ amp_TH = waveform.utils.fd_taper(amp_TH,fpeak,1.2*fpeak,side='right')
76
+
77
+ if amp_corr==True:
78
+ hptilde = 0.5*(1+np.cos(iota)**2) * (amps+amp_TH) * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
79
+ hctilde = -1j*np.cos(iota) * (amps+amp_TH) * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
80
+ else:
81
+ hptilde = 0.5*(1+np.cos(iota)**2) * amps * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
82
+ hctilde = -1j*np.cos(iota) * amps * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
83
+
84
+ hptilde = types.FrequencySeries(hptilde,delta_f=hpstilde.delta_f)
85
+ hctilde = types.FrequencySeries(hctilde,delta_f=hpstilde.delta_f)
86
+
87
+ hp = hptilde.to_timeseries(delta_t=delta_t)
88
+ hc = hctilde.to_timeseries(delta_t=delta_t)
89
+
90
+ hp.start_time = 0
91
+ hc.start_time = 0
92
+
93
+ return hp, hc
94
+
95
+
96
+ def inspiral_TH_fd(f_ini=10.,f_final=None, delta_t=None, m1=10, m2=10, chi1=0, chi2=0, H1=1, H2=1, DL=200, tc=0, phic=0, iota=0, amp_phase_only=False, amp_phase_hp_hc=False,approximant='SEOBNRv2',TH1=True,TH2=False,amp_corr=True):
97
+
98
+ # convert to sec
99
+ Ms = m1+m2
100
+ M = Ms * time_fac
101
+ DLt = DL * time_fac/strain_fac
102
+ # f_isco_KBH = wfn.f_isco_Msolar_KBH(m1,m2,chi1,chi2)
103
+
104
+ # if f_final is None: f_final = 0.03/M #f_isco_KBH
105
+ if delta_t is None: raise Exception('Specify delta_t')
106
+
107
+ hps, hcs = waveform.get_td_waveform(approximant=approximant,
108
+ mass1=m1, mass2=m2, spin1z=chi1, spin2z=chi2, distance = DL,
109
+ delta_t=delta_t, f_lower = f_ini-2, f_final = f_final)
110
+
111
+ f0 = waveform.utils.frequency_from_polarizations(hps,hcs)
112
+
113
+ ## Find the TD tapering needed
114
+ index = np.where(f0>f_ini)[0][0]
115
+ tini = hps.sample_times[0]
116
+ tfin = hps.sample_times[index]
117
+
118
+
119
+
120
+ ## Apply tapering to TD data
121
+ hps = waveform.utils.td_taper(hps,tini,tfin)
122
+ hcs = waveform.utils.td_taper(hcs,tini,tfin)
123
+ if f_final is not None:
124
+ index2 = np.where(f0>(f_final-2))[0][0]
125
+ index3 = np.where(f0>f_final)[0][0]
126
+ tini2 = hps.sample_times[index2]
127
+ tfin2 = hps.sample_times[index3]
128
+ hps = waveform.utils.td_taper(hps,tini2,tfin2,side='right')
129
+ hcs = waveform.utils.td_taper(hcs,tini2,tfin2,side='right')
130
+
131
+ ## Take FFT
132
+ hpstilde = hps.to_frequencyseries()
133
+ hcstilde = hcs.to_frequencyseries()
134
+
135
+ f = hpstilde.sample_frequencies
136
+ index0 = np.where(f>f_ini-2)[0][0]
137
+
138
+ finsp = f[index0:]
139
+ patch = np.zeros(index0)
140
+
141
+ ## Extract amplitude & phase
142
+ amps = waveform.utils.amplitude_from_frequencyseries(hpstilde)
143
+ amps=np.asarray(amps)
144
+ phases = waveform.utils.phase_from_frequencyseries(hpstilde)
145
+ phases=np.asarray(phases)
146
+
147
+ ## Compute TH corrections
148
+ if TH1==True: psi_TH = insp.psiTH(finsp,m1,m2,chi1,chi2,H1,H2)
149
+ if TH2==True: psi_TH = insp.psiTH_new(finsp,m1,m2,chi1,chi2,H1,H2)
150
+ else: psi_TH = np.zeros_like(finsp)
151
+ amp_TH = insp.ampTH(finsp,m1,m2,chi1,chi2,DL,H1,H2)
152
+
153
+ psi_TH = np.concatenate((patch,psi_TH))
154
+ amp_TH = np.concatenate((patch,amp_TH))
155
+
156
+ psi_TH = types.FrequencySeries(psi_TH,delta_f=hpstilde.delta_f)
157
+ amp_TH = types.FrequencySeries(amp_TH,delta_f=hpstilde.delta_f)
158
+
159
+ ## Tapering starts from f_ini-2 to f_ini; ends from f_peak to 1.2f_peak
160
+ psi_TH = waveform.utils.fd_taper(psi_TH,f_ini-2,f_ini)
161
+ amp_TH = waveform.utils.fd_taper(amp_TH,f_ini-2,f_ini)
162
+
163
+ fpeak = wfn.f_peak(m1,m2,chi1,chi2)
164
+ amp_TH = waveform.utils.fd_taper(amp_TH,fpeak,1.2*fpeak,side='right')
165
+
166
+ ## Add TH corrections
167
+ if TH1 or TH2 is True:
168
+ if amp_corr==True:
169
+ hptilde = 0.5*(1+np.cos(iota)**2) * (amps+amp_TH) * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
170
+ hctilde = -1j*np.cos(iota) * (amps+amp_TH) * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
171
+ else:
172
+ hptilde = 0.5*(1+np.cos(iota)**2) * amps * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
173
+ hctilde = -1j*np.cos(iota) * amps * np.exp(1j*(phases + psi_TH + 2.*np.pi*f*tc + phic))
174
+ else:
175
+ hptilde = 0.5*(1+np.cos(iota)**2)*hpstilde
176
+ hctilde = -1j*np.cos(iota)*hpstilde
177
+
178
+ hptilde = types.FrequencySeries(hptilde,delta_f=hpstilde.delta_f)
179
+ hctilde = types.FrequencySeries(hctilde,delta_f=hpstilde.delta_f)
180
+
181
+
182
+ return hptilde, hctilde