Skip to content

Commit

Permalink
fixed up for colab
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekatz04 committed Jan 6, 2025
1 parent e158257 commit 7cfeb64
Show file tree
Hide file tree
Showing 90 changed files with 651 additions and 289 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our code of conduc

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/mikekatz04/BBHx/tags).

Current Version: 1.1.2
Current Version: 1.1.11

## Authors

Expand Down
Empty file added bbhx/cutils/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added bbhx/cutils/include/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added bbhx/cutils/src/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions bbhx/likelihood.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

try:
import cupy as cp
from bbhx.pyLikelihood import hdyn_wrap as hdyn_wrap_gpu
from bbhx.pyLikelihood import direct_like_wrap as direct_like_wrap_gpu
from bbhx.pyLikelihood import prep_hdyn as prep_hdyn_gpu
from .cutils.pyLikelihood import hdyn_wrap as hdyn_wrap_gpu
from .cutils.pyLikelihood import direct_like_wrap as direct_like_wrap_gpu
from .cutils.pyLikelihood import prep_hdyn as prep_hdyn_gpu

except (ImportError, ModuleNotFoundError) as e:
print("No CuPy")
import numpy as cp

from bbhx.pyLikelihood_cpu import prep_hdyn as prep_hdyn_cpu
from bbhx.pyLikelihood_cpu import hdyn_wrap as hdyn_wrap_cpu
from bbhx.pyLikelihood_cpu import direct_like_wrap as direct_like_wrap_cpu
from .cutils.pyLikelihood_cpu import prep_hdyn as prep_hdyn_cpu
from .cutils.pyLikelihood_cpu import hdyn_wrap as hdyn_wrap_cpu
from .cutils.pyLikelihood_cpu import direct_like_wrap as direct_like_wrap_cpu

from bbhx.utils.constants import *
from .utils.constants import *

from lisatools.sensitivity import SensitivityMatrix, AET1SensitivityMatrix

Expand Down
6 changes: 3 additions & 3 deletions bbhx/response/fastfdresponse.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

try:
import cupy as cp
from bbhx.pyFDResponse import LISA_response_wrap as LISA_response_wrap_gpu
from .cutils.pyFDResponse import LISA_response_wrap as LISA_response_wrap_gpu

except (ImportError, ModuleNotFoundError) as e:
print("No CuPy or GPU response available.")

from bbhx.pyFDResponse_cpu import LISA_response_wrap as LISA_response_wrap_cpu
from bbhx.utils.constants import *
from ..cutils.pyFDResponse_cpu import LISA_response_wrap as LISA_response_wrap_cpu
from ..utils.constants import *

from lisatools.detector import EqualArmlengthOrbits, Orbits

Expand Down
48 changes: 48 additions & 0 deletions bbhx/utils/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@

# Collection of citations for modules in bbhx package

# Copyright (C) 2020 Michael L. Katz
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.


MSUN_SI = 1.98848e+30
YRSID_SI = 31558149.763545603
AU_SI = 149597870700.0
C_SI = 299792458.
G_SI = 6.674080e-11
GMSUN = 1.3271244210789466e+20
MTSUN_SI = 4.925491025873693e-06
MRSUN_SI = 1476.6250615036158
PC_SI = 3.0856775814913674e+16
PI = 3.141592653589793238462643383279502884
PI_2 = 1.570796326794896619231321691639751442
PI_3 = 1.047197551196597746154214461093167628
PI_4 = 0.785398163397448309615660845819875721
SQRTPI = 1.772453850905516027298167483341145183
SQRTTWOPI = 2.506628274631000502415765284811045253
INVSQRTPI = 0.564189583547756286948079451560772585
INVSQRTTWOPI = 0.398942280401432677939946059934381868
GAMMA = 0.577215664901532860606512090082402431
SQRT2 = 1.414213562373095048801688724209698079
SQRT3 = 1.732050807568877293527446341505872367
SQRT6 = 2.449489742783178098197284074705891392
INVSQRT2 = 0.707106781186547524400844362104849039
INVSQRT3 = 0.577350269189625764509148780501957455
INVSQRT6 = 0.408248290463863016366214012450981898
F0 = 3.168753578687779e-08
Omega0 = 1.9909865927683788e-07
L_SI = 2.5e9
eorbit = 0.004824185218078991
ConstOmega = 1.99098659277e-7
6 changes: 3 additions & 3 deletions bbhx/utils/interpolate.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

try:
import cupy as cp
from bbhx.pyInterpolate import interpolate_wrap as interpolate_wrap_gpu
from ..cutils.pyInterpolate import interpolate_wrap as interpolate_wrap_gpu


except (ImportError, ModuleNotFoundError) as e:
print("No CuPy or GPU interpolation available.")

from bbhx.pyInterpolate_cpu import interpolate_wrap as interpolate_wrap_cpu
from ..cutils.pyInterpolate_cpu import interpolate_wrap as interpolate_wrap_cpu

from bbhx.utils.constants import *
from ..utils.constants import *


def searchsorted2d_vec(a, b, xp=None, **kwargs):
Expand Down
8 changes: 4 additions & 4 deletions bbhx/waveformbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
# import gpu stuff
try:
import cupy as cp
from bbhx.pyWaveformBuild import direct_sum_wrap as direct_sum_wrap_gpu
from bbhx.pyWaveformBuild import InterpTDI_wrap as InterpTDI_wrap_gpu
from .cutils.pyWaveformBuild import direct_sum_wrap as direct_sum_wrap_gpu
from .cutils.pyWaveformBuild import InterpTDI_wrap as InterpTDI_wrap_gpu

except (ImportError, ModuleNotFoundError) as e:
print("No CuPy")

from bbhx.pyWaveformBuild_cpu import direct_sum_wrap as direct_sum_wrap_cpu
from bbhx.pyWaveformBuild_cpu import InterpTDI_wrap as InterpTDI_wrap_cpu
from .cutils.pyWaveformBuild_cpu import direct_sum_wrap as direct_sum_wrap_cpu
from .cutils.pyWaveformBuild_cpu import InterpTDI_wrap as InterpTDI_wrap_cpu

from .waveforms.phenomhm import PhenomHMAmpPhase
from .response.fastfdresponse import LISATDIResponse
Expand Down
20 changes: 13 additions & 7 deletions bbhx/waveforms/phenomhm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,27 @@

# import GPU stuff
try:
from bbhx.pyPhenomHM import waveform_amp_phase_wrap as waveform_amp_phase_wrap_gpu
from bbhx.pyPhenomHM import (
from ..cutils.pyPhenomHM import (
waveform_amp_phase_wrap as waveform_amp_phase_wrap_gpu,
)
from ..cutils.pyPhenomHM import (
get_phenomhm_ringdown_frequencies as get_phenomhm_ringdown_frequencies_gpu,
)
from bbhx.pyPhenomHM import (
from ..cutils.pyPhenomHM import (
get_phenomd_ringdown_frequencies as get_phenomd_ringdown_frequencies_gpu,
)
import cupy as cp

except (ImportError, ModuleNotFoundError) as e:
print("No CuPy or GPU PhenomHM module.")

from bbhx.pyPhenomHM_cpu import waveform_amp_phase_wrap as waveform_amp_phase_wrap_cpu
from bbhx.pyPhenomHM_cpu import (
from ..cutils.pyPhenomHM_cpu import (
waveform_amp_phase_wrap as waveform_amp_phase_wrap_cpu,
)
from ..cutils.pyPhenomHM_cpu import (
get_phenomhm_ringdown_frequencies as get_phenomhm_ringdown_frequencies_cpu,
)
from bbhx.pyPhenomHM_cpu import (
from ..cutils.pyPhenomHM_cpu import (
get_phenomd_ringdown_frequencies as get_phenomd_ringdown_frequencies_cpu,
)

Expand Down Expand Up @@ -597,7 +601,9 @@ def __call__(self, *args, Tobs=None, direct=False, **kwargs):
Tobs = self.xp.full((self.num_bin_all, self.num_modes), Tobs)
elif isinstance(Tobs, np.ndarray) and Tobs.ndim == 1:
assert Tobs.shape[0] == self.num_bin_all
Tobs = self.xp.repeat(self.xp.asarray(Tobs)[:, None], self.num_modes, axis=-1)
Tobs = self.xp.repeat(
self.xp.asarray(Tobs)[:, None], self.num_modes, axis=-1
)
elif isinstance(Tobs, np.ndarray) and Tobs.ndim == 2:
Tobs = self.xp.asarray(Tobs)
assert Tobs.shape == (self.num_bin_all, self.num_modes)
Expand Down
Binary file modified docs/doctrees/README.doctree
Binary file not shown.
Binary file modified docs/doctrees/bbhx_tutorial.doctree
Binary file not shown.
Binary file modified docs/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/constants.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/like.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/main.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/response.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/utils.doctree
Binary file not shown.
Binary file modified docs/doctrees/user/waveforms.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c6fda011b514044edda33d31641da3c8
config: afb4170e7d4e7311d87580c02c5853eb
tags: 645f666f9bcd5a90fca523b33c5a78b7
24 changes: 11 additions & 13 deletions docs/html/README.html
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@


<!DOCTYPE html>
<html class="writer-html5" lang="en" data-content_root="./">
<head>
<meta charset="utf-8" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>GPU-Accelerated Black Hole Binary Waveforms (bbhx) &mdash; bbhx documentation</title>
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=80d5e7a1" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=19f00094" />
<link rel="stylesheet" type="text/css" href="_static/css/theme.css?v=e59714d7" />


<!--[if lt IE 9]>
<script src="_static/js/html5shiv.min.js"></script>
<![endif]-->

<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script src="_static/jquery.js?v=5d32c60e"></script>
<script src="_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c"></script>
<script src="_static/documentation_options.js?v=5929fcd5"></script>
<script src="_static/doctools.js?v=9a2dae69"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script crossorigin="anonymous" integrity="sha256-Ae2Vz/4ePdIu6ZyI/5ZGsYnb+m0JlOmKPjt6XZ9JJkA=" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.4/require.min.js"></script>
<script src="_static/js/theme.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
Expand Down Expand Up @@ -288,7 +286,7 @@ <h3>Versioning<a class="headerlink" href="#versioning" title="Link to this headi
<p>We use <a class="reference external" href="http://semver.org/">SemVer</a> for versioning. For the versions
available, see the <a class="reference external" href="https://github.com/mikekatz04/BBHx/tags">tags on this
repository</a>.</p>
<p>Current Version: 1.1.2</p>
<p>Current Version: 1.1.11</p>
</section>
<section id="authors">
<h3>Authors<a class="headerlink" href="#authors" title="Link to this heading"></a></h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_sources/README.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ We use `SemVer <http://semver.org/>`__ for versioning. For the versions
available, see the `tags on this
repository <https://github.com/mikekatz04/BBHx/tags>`__.

Current Version: 1.1.2
Current Version: 1.1.11

Authors
-------
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_static/basic.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* Sphinx stylesheet -- basic theme.
*
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/
Expand Down
2 changes: 1 addition & 1 deletion docs/html/_static/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7cfeb64

Please sign in to comment.