Skip to content

Commit

Permalink
Adding cupy as dependency. Copied MBLS from astropy into repo. Upda…
Browse files Browse the repository at this point in the history
…ted comparison notebook.
  • Loading branch information
drewoldag committed Jul 9, 2024
1 parent 7824e7a commit 50126bc
Show file tree
Hide file tree
Showing 10 changed files with 1,145 additions and 254 deletions.
254 changes: 0 additions & 254 deletions docs/notebooks/example-cuda-python.ipynb

This file was deleted.

39 changes: 39 additions & 0 deletions docs/notebooks/mbls-comparison.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,45 @@
"print(f\"Frequency with peak power: {frequency[np.argmax(power)]}\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Reproduce the results above using the Mapals implementation of Multiband Lomb Scargle"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from mapals.lombscargle_multiband import LombScargleMultiband as MapalsLombScargleMultiband"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"model = MapalsLombScargleMultiband(t, y, bands, dy, nterms_base=1, nterms_band=1)\n",
"frequency, power = model.autopower(method=\"flexible\")\n",
"freq_maxpower = frequency[np.argmax(power)]\n",
"t_phase = np.linspace(0, 1 / freq_maxpower, 100)\n",
"y_fit = model.model(t_phase, freq_maxpower)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(frequency, power)\n",
"print(f\"Frequency with peak power: {frequency[np.argmax(power)]}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ requires-python = ">=3.9"
dependencies = [
"cuda-python",
"numpy",
"cupy-cuda12x", # assuming CUDA toolkit>=12.0
]

[project.urls]
Expand Down
3 changes: 3 additions & 0 deletions src/mapals/lombscargle_multiband/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

from .core import LombScargleMultiband
Loading

0 comments on commit 50126bc

Please sign in to comment.