diff --git a/.readthedocs.yaml b/.readthedocs.yaml index ccbef0287..275cc0938 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -20,6 +20,7 @@ build: jobs: pre_build: - ford fortran_docs.md + - pip install pyshtools - DOC_BUILD=1 pip install . python: install: diff --git a/environment.yml b/environment.yml index 9c6b1d9b8..fe6c090c2 100644 --- a/environment.yml +++ b/environment.yml @@ -5,22 +5,22 @@ channels: - defaults dependencies: - - python>=3.9 - - numpy>=1.24.3 - - scipy>=1.10.1 - - xarray>=2022.11.0 - - distributed>=2022.1 - - dask>=2022.1 - - bottleneck>=1.3.5 - - h5netcdf>=1.0.2 - - netcdf4>=1.6.2 - - matplotlib>=3.7.1 - - astropy>=5.1 + - python==3.9 + - numpy>=1.26.4 + - scipy>=1.12.0 + - xarray>=2024.2.0 + - distributed>=2024.2.1 + - dask>=2024.2.1 + - bottleneck>=1.3.8 + - h5netcdf>=1.3.0 + - netcdf4>=1.6.5 + - matplotlib>=3.8.3 + - astropy>=6.0.0 - astroquery>=0.4.6 - - tqdm>=4.65.0 + - tqdm>=4.66.2 - x264>=1!157.20191217 - ffmpeg>=4.3.2 - - cython>=3.0.0 + - cython>=3.0.8 - pkg-config - meson-python>=0.14 - setuptools_scm>=8 diff --git a/pyproject.toml b/pyproject.toml index aca1f0c2d..3a7c2f721 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,7 +13,7 @@ maintainers = [ {name = 'David A. Minton', email='daminton@purdue.edu'}, ] readme = "README.md" -requires-python=">=3.8" +requires-python=">=3.9" license={file = "LICENSE"} classifiers=[ 'Development Status :: 3 - Alpha', @@ -24,20 +24,20 @@ classifiers=[ ] keywords=['astronomy','astrophysics', 'planetary', 'n-body', 'integrator', 'symplectic', 'wisdom-holman', 'symba'] dependencies = [ - 'numpy>=1.24.3', - 'scipy>=1.10.1', - 'xarray>=2023.1', - 'dask>=2023.5', - 'distributed>=2023.5', - 'bottleneck>=1.3.5', - 'h5netcdf>=1.1', - 'h5py>=3.9', - 'netcdf4>=1.6.2', - 'matplotlib>=3.7.1', - 'astropy>=5.2', + 'numpy>=1.26.4', + 'scipy>=1.12.0', + 'xarray>=2024.2.0', + 'dask>=2024.2.1', + 'distributed>=2024.2.1', + 'bottleneck>=1.3.8', + 'h5netcdf>=1.3.0', + 'h5py>=3.10.0', + 'netcdf4>=1.6.5', + 'matplotlib>=3.8.3', + 'astropy>=6.0.0', 'astroquery>=0.4.6', - 'tqdm>=4.65', - 'cython>=3.0.0', + 'tqdm>=4.66.2', + 'cython>=3.0.8', ] [project.optional-dependencies] @@ -48,8 +48,8 @@ Repository = 'https://github.itap.purdue.edu/MintonGroup/swiftest' [build-system] requires = [ - "scikit-build-core>=0.8", - "cython>=3.0", + "scikit-build-core>=0.8.2", + "cython>=3.0.8", ] build-backend = "scikit_build_core.build" @@ -133,7 +133,7 @@ PATH="${HDF5_ROOT}/bin:${PATH}" CMAKE_INSTALL_LIBDIR="lib" [tool.cibuildwheel.linux] -skip = "cp312-* pp* -manylinux_i686* *-musllinux*" +skip = "pp* -manylinux_i686* *-musllinux*" before-all = [ "yum install epel-release -y", "yum install doxygen libxml2-devel libcurl-devel fftw-static openblas-devel lapack-devel -y", diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index d41a21895..000000000 --- a/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -python>=3.8 -numpy>=1.24.3 -scipy>=1.10.1 -xarray>=2023.1 -dask>=2023.5 -distributed>=2023.5 -bottleneck>=1.3.5 -h5netcdf>=1.1 -h5py>=3.9 -netcdf4>=1.6.2 -matplotlib>=3.7.1 -astropy>=5.1 -astroquery>=0.4.6 -tqdm>=4.65.0 -cython>=3.0.0 \ No newline at end of file diff --git a/tests/test_swiftest.py b/tests/test_swiftest.py index 63f07829c..e5d8d0311 100755 --- a/tests/test_swiftest.py +++ b/tests/test_swiftest.py @@ -28,6 +28,7 @@ from numpy.random import default_rng from astroquery.jplhorizons import Horizons import datetime +import tempfile rng = default_rng(seed=123) @@ -35,6 +36,14 @@ param = {} class TestSwiftest(unittest.TestCase): + def setUp(self): + # Initialize a target and surface for testing + self.tmpdir=tempfile.TemporaryDirectory() + self.simdir = self.tmpdir.name + + def tearDown(self): + # Clean up temporary directory + self.tmpdir.cleanup() def test_gen_ic(self): """ @@ -42,10 +51,9 @@ def test_gen_ic(self): """ print("\ntest_gen_ic: Test whether we can generate simulation initial conditions test") # Files that are expected to be generated: - simdir = "simdata" - file_list = [simdir, os.path.join(simdir,"param.in"), os.path.join(simdir,"init_cond.nc")] + file_list = [self.simdir, os.path.join(self.simdir,"param.in"), os.path.join(self.simdir,"init_cond.nc")] - sim = swiftest.Simulation() + sim = swiftest.Simulation(simdir=self.simdir) sim.clean() # Add the modern planets and the Sun using the JPL Horizons Database. @@ -62,7 +70,7 @@ def test_read_ic(self): Tests that Swiftest is able to read a set of pre-existing initial conditions files and that they contain the correct data """ print("\ntest_read_ic: Test whether we can read back initial conditions files created by test_gen_ic") - sim = swiftest.Simulation() + sim = swiftest.Simulation(simdir=self.simdir) sim.clean() # Add the modern planets and the Sun using the JPL Horizons Database. @@ -81,7 +89,7 @@ def test_integrators(self): Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators """ print("\ntest_integrators: Tests that Swiftest is able to integrate a collection of massive bodies and test particles with all available integrators") - sim = swiftest.Simulation() + sim = swiftest.Simulation(simdir=self.simdir) # Add the modern planets and the Sun using the JPL Horizons Database. sim.add_solar_system_body(major_bodies) @@ -116,18 +124,18 @@ def test_conservation(self): print("\ntest_conservation: Tests that Swiftest conserves mass, energy, and momentum to within acceptable tolerances.") # Error limits - L_slope_limit = 1e-10 - E_slope_limit = 1e-8 + L_slope_limit = 1e-9 + E_slope_limit = 1e-7 GM_limit = 1e-14 - sim = swiftest.Simulation() + sim = swiftest.Simulation(simdir=self.simdir) sim.clean() sim.add_solar_system_body(major_bodies) dt = 0.01 - nout = 1000 - tstop = 1e4 + nout = 100 + tstop = 1e3 tstep_out = tstop / nout sim.run(tstart=0.0, tstop=tstop, dt=dt, tstep_out=tstep_out, dump_cadence=0, compute_conservation_values=True, integrator="symba") @@ -182,7 +190,7 @@ def test_gr(self): # Initialize the simulation object as a variable. Define the directory in which the output will be placed. tstep_out = 10.0 - sim = swiftest.Simulation(tstop=1000.0, dt=0.005, tstep_out=tstep_out, dump_cadence=0,general_relativity=True) + sim = swiftest.Simulation(simdir=self.simdir, tstop=1000.0, dt=0.005, tstep_out=tstep_out, dump_cadence=0,general_relativity=True) sim.add_solar_system_body(["Sun","Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"]) # Get the start and end date of the simulation so we can compare with the real solar system.