Skip to content

Commit

Permalink
Merge pull request #5 from SNEWS2/JostMigenda/addDataSubmodule
Browse files Browse the repository at this point in the history
Add `EMEWS.data` submodule with PREM files
  • Loading branch information
jpkneller authored Jun 28, 2024
2 parents e567d3f + 05cb3eb commit 18128e1
Show file tree
Hide file tree
Showing 104 changed files with 18 additions and 6 deletions.
6 changes: 4 additions & 2 deletions EMEWS_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

if __name__ == "__main__":

from importlib.resources import files
import numpy as np
from astropy import units as u
from astropy.time import Time
Expand All @@ -23,6 +24,7 @@

# load the mdule that does the Earth-matter effect calculation
import EMEWS
import EMEWS.data

# class to accumulate input data for calcultion
ID = EMEWS.InputDataEMEWS()
Expand All @@ -33,8 +35,8 @@

ID.outputfilenamestem = "out/EMEWS:PREM"

ID.densityprofile = "PREM.rho.dat"
ID.electronfraction = "PREM.Ye.dat"
ID.densityprofile = str(files(EMEWS.data).joinpath("PREM.rho.dat"))
ID.electronfraction = str(files(EMEWS.data).joinpath("PREM.Ye.dat"))

ID.NE = 296
ID.Emin = 1
Expand Down
9 changes: 9 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,12 @@ dependencies = [

[project.urls]
"Homepage" = "https://github.com/SNEWS2/EMEWS"


[tool.setuptools]
# The sdist should include all files in the repo (notably *.cpp and *.h),
# which is done by setuptools_scm.
# For wheels, this “package data” (everything except for *.py and compiled),
# is mostly unnecessary, so we exclude it and only add PREM data files.
include-package-data = false
package-data = { "EMEWS.data" = ["*.dat"] }
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
elif os.name == 'nt': # Windows
LIBDIR = sysconfig.get_config_var('LIBDEST')

EMEWS = Extension('EMEWS',
EMEWS = Extension('EMEWS._ext',
define_macros = [('MAJOR_VERSION', '1'), ('MINOR_VERSION', '0')],
include_dirs = [LIBOMP_INCLUDE, PYBIND11_INCLUDE, './src/EMEWS', './src/EMEWS/mstl', './src/EMEWS/mstl/math2', './src/EMEWS/mstl/math2/algebra', './src/EMEWS/mstl/math2/analysis', './src/EMEWS/mstl/math2/spline', './src/EMEWS/mstl/physics'],
include_dirs = [LIBOMP_INCLUDE, PYBIND11_INCLUDE, './src/EMEWS/_ext', './src/EMEWS/_ext/mstl', './src/EMEWS/_ext/mstl/math2', './src/EMEWS/_ext/mstl/math2/algebra', './src/EMEWS/_ext/mstl/math2/analysis', './src/EMEWS/_ext/mstl/math2/spline', './src/EMEWS/_ext/mstl/physics'],
# libraries = ['stdc++', 'm', 'gomp', 'python3'],
library_dirs = [LIBDIR],
extra_compile_args = ['-std=c++17', '-fPIC', '-nostartfiles'],
# extra_link_args = ['-shared'],
sources = ['./src/EMEWS/EMEWS.cpp', './src/EMEWS/adiabatic_basis.cpp', './src/EMEWS/eigenvalues.cpp', './src/EMEWS/flavour_basis.cpp', './src/EMEWS/input_class.EMEWS.cpp', './src/EMEWS/jacobians.cpp', './src/EMEWS/mixing_angles.cpp', './src/EMEWS/output.EMEWS.cpp', './src/EMEWS/output_matrix.EMEWS.cpp', './src/EMEWS/parameters.cpp', './src/EMEWS/potentials.cpp', './src/EMEWS/RK.EMEWS.cpp', './src/EMEWS/update.EMEWS.cpp', './src/EMEWS/mstl/errors2.cpp', './src/EMEWS/mstl/messages.cpp', './src/EMEWS/mstl/miscellaneous functions.cpp', './src/EMEWS/mstl/stdarg2.cpp', './src/EMEWS/mstl/math2/algebra/column and row vectors.cpp', './src/EMEWS/mstl/math2/algebra/linear algebra.cpp', './src/EMEWS/mstl/math2/algebra/mmatrix.cpp', './src/EMEWS/mstl/math2/analysis/algorithm3.cpp', './src/EMEWS/mstl/math2/analysis/complex2.cpp', './src/EMEWS/mstl/math2/analysis/derivative.cpp', './src/EMEWS/mstl/math2/analysis/polynomial.cpp', './src/EMEWS/mstl/math2/analysis/roots.cpp', './src/EMEWS/mstl/math2/analysis/runge kutta.cpp', './src/EMEWS/mstl/math2/analysis/special functions.cpp', './src/EMEWS/mstl/math2/spline/discontinuous.cpp', './src/EMEWS/mstl/math2/spline/interpolation data.cpp', './src/EMEWS/mstl/physics/units and constants.cpp'])
sources = ['./src/EMEWS/_ext/EMEWS.cpp', './src/EMEWS/_ext/adiabatic_basis.cpp', './src/EMEWS/_ext/eigenvalues.cpp', './src/EMEWS/_ext/flavour_basis.cpp', './src/EMEWS/_ext/input_class.EMEWS.cpp', './src/EMEWS/_ext/jacobians.cpp', './src/EMEWS/_ext/mixing_angles.cpp', './src/EMEWS/_ext/output.EMEWS.cpp', './src/EMEWS/_ext/output_matrix.EMEWS.cpp', './src/EMEWS/_ext/parameters.cpp', './src/EMEWS/_ext/potentials.cpp', './src/EMEWS/_ext/RK.EMEWS.cpp', './src/EMEWS/_ext/update.EMEWS.cpp', './src/EMEWS/_ext/mstl/errors2.cpp', './src/EMEWS/_ext/mstl/messages.cpp', './src/EMEWS/_ext/mstl/miscellaneous functions.cpp', './src/EMEWS/_ext/mstl/stdarg2.cpp', './src/EMEWS/_ext/mstl/math2/algebra/column and row vectors.cpp', './src/EMEWS/_ext/mstl/math2/algebra/linear algebra.cpp', './src/EMEWS/_ext/mstl/math2/algebra/mmatrix.cpp', './src/EMEWS/_ext/mstl/math2/analysis/algorithm3.cpp', './src/EMEWS/_ext/mstl/math2/analysis/complex2.cpp', './src/EMEWS/_ext/mstl/math2/analysis/derivative.cpp', './src/EMEWS/_ext/mstl/math2/analysis/polynomial.cpp', './src/EMEWS/_ext/mstl/math2/analysis/roots.cpp', './src/EMEWS/_ext/mstl/math2/analysis/runge kutta.cpp', './src/EMEWS/_ext/mstl/math2/analysis/special functions.cpp', './src/EMEWS/_ext/mstl/math2/spline/discontinuous.cpp', './src/EMEWS/_ext/mstl/math2/spline/interpolation data.cpp', './src/EMEWS/_ext/mstl/physics/units and constants.cpp'])

setup(ext_modules=[EMEWS])
1 change: 1 addition & 0 deletions src/EMEWS/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from ._ext import InputDataEMEWS, Run
2 changes: 1 addition & 1 deletion src/EMEWS/EMEWS.cpp → src/EMEWS/_ext/EMEWS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interpolation::DISCONTINUOUS rho, Ye;

// **********************************************************************

PYBIND11_MODULE(EMEWS, m)
PYBIND11_MODULE(_ext, m)
{ class_<InputDataEMEWS>(m, "InputDataEMEWS")
.def(init<>())
.def_readwrite("altitude", &InputDataEMEWS::altitude)
Expand Down
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.
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.
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.
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.
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.
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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added src/EMEWS/data/__init__.py
Empty file.

0 comments on commit 18128e1

Please sign in to comment.