-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from VirtualPlanetaryLaboratory/PipInstall
Pip install
- Loading branch information
Showing
9 changed files
with
173 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import subprocess | ||
import numpy as np | ||
import os | ||
import multiprocessing as mp | ||
import warnings | ||
import pathlib | ||
import sys | ||
import shutil | ||
|
||
def test_checkpoint(): | ||
# Get current path | ||
path = pathlib.Path(__file__).parents[0].absolute() | ||
sys.path.insert(1, str(path.parents[0])) | ||
|
||
dir = (path / "MP_Checkpoint") | ||
checkpoint = (path / ".MP_Checkpoint") | ||
|
||
# Get the number of cores on the machine | ||
cores = mp.cpu_count() | ||
if cores == 1: | ||
warnings.warn("There is only 1 core on the machine",stacklevel=3) | ||
else: | ||
# Remove anything from previous tests | ||
if (dir).exists(): | ||
shutil.rmtree(dir) | ||
if (checkpoint).exists(): | ||
os.remove(checkpoint) | ||
|
||
# Run vspace | ||
subprocess.check_output(["vspace", "vspace.in"], cwd=path) | ||
|
||
# Run multi-planet | ||
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path) | ||
|
||
# Gets list of folders | ||
folders = sorted([f.path for f in os.scandir(dir) if f.is_dir()]) | ||
|
||
for i in range(len(folders)): | ||
os.chdir(folders[i]) | ||
assert os.path.isfile('earth.earth.forward') == True | ||
os.chdir('../') | ||
|
||
if __name__ == "__main__": | ||
test_checkpoint() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import subprocess | ||
import numpy as np | ||
import os | ||
import pathlib | ||
import multiprocessing as mp | ||
import warnings | ||
import sys | ||
import shutil | ||
|
||
def test_parallel(): | ||
# Get current path | ||
path = pathlib.Path(__file__).parents[0].absolute() | ||
sys.path.insert(1, str(path.parents[0])) | ||
|
||
dir = (path / "MP_Parallel") | ||
checkpoint = (path / ".MP_Parallel") | ||
|
||
# Get the number of cores on the machine | ||
cores = mp.cpu_count() | ||
if cores == 1: | ||
warnings.warn("There is only 1 core on the machine",stacklevel=3) | ||
else: | ||
# Remove anything from previous tests | ||
if (dir).exists(): | ||
shutil.rmtree(dir) | ||
if (checkpoint).exists(): | ||
os.remove(checkpoint) | ||
|
||
# Run vspace | ||
subprocess.check_output(["vspace", "vspace.in"], cwd=path) | ||
|
||
# Run multi-planet | ||
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path) | ||
|
||
folders = sorted([f.path for f in os.scandir(dir) if f.is_dir()]) | ||
|
||
for i in range(len(folders)): | ||
os.chdir(folders[i]) | ||
assert os.path.isfile('earth.earth.forward') == True | ||
os.chdir('../') | ||
|
||
if __name__ == "__main__": | ||
test_parallel() |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.