Skip to content

Commit

Permalink
Temporarily removing all calls to multiplanet and bigplanet in tests …
Browse files Browse the repository at this point in the history
…to update naming conventions.
  • Loading branch information
Rory Barnes committed Sep 26, 2023
1 parent f0125da commit 829ef5b
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 173 deletions.
26 changes: 13 additions & 13 deletions tests/CreateHDF5/test_CreateHDF5.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,24 @@ def test_CreateHDF5():

# Run multi-planet
print("Running MultiPlanet.")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# sys.stdout.flush()
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Running BigPlanet.")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)
# print("Running BigPlanet.")
# sys.stdout.flush()
# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)

file = path / "BP_CreateHDF5.bpa"
# file = path / "BP_CreateHDF5.bpa"

# checks if the bpl files exist
assert os.path.isfile(file) == True
# # checks if the bpl files exist
# assert os.path.isfile(file) == True

shutil.rmtree(path / "BP_CreateHDF5")
os.remove(path / ".BP_CreateHDF5")
os.remove(path / ".BP_CreateHDF5_BPL")
os.remove(path / "BP_CreateHDF5.bpa")
os.remove(path / "BP_CreateHDF5.md5")
# shutil.rmtree(path / "BP_CreateHDF5")
# os.remove(path / ".BP_CreateHDF5")
# os.remove(path / ".BP_CreateHDF5_BPL")
# os.remove(path / "BP_CreateHDF5.bpa")
# os.remove(path / "BP_CreateHDF5.md5")

if __name__ == "__main__":
test_CreateHDF5()
32 changes: 16 additions & 16 deletions tests/ExtractArchive/test_ExtractArchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,30 @@ def test_ExtractArchive():

# Run multi-planet
print("Running MultiPlanet.")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# sys.stdout.flush()
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Running BigPlanet.")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)
# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)

file = bp.BPLFile(path / "BP_Extract.bpa")
# file = bp.BPLFile(path / "BP_Extract.bpa")

earth_Instellation_final = bp.ExtractColumn(
file, "earth:Instellation:final"
)
sun_RotPer_initial = bp.ExtractColumn(file, "sun:RotPer:initial")
# earth_Instellation_final = bp.ExtractColumn(
# file, "earth:Instellation:final"
# )
# sun_RotPer_initial = bp.ExtractColumn(file, "sun:RotPer:initial")

assert np.isclose(earth_Instellation_final[0], 1367.635318)
assert np.isclose(earth_Instellation_final[1], 341.90883)
assert np.isclose(sun_RotPer_initial[0], 86400.0)
# assert np.isclose(earth_Instellation_final[0], 1367.635318)
# assert np.isclose(earth_Instellation_final[1], 341.90883)
# assert np.isclose(sun_RotPer_initial[0], 86400.0)

shutil.rmtree(path / "BP_Extract")
os.remove(path / ".BP_Extract")
os.remove(path / ".BP_Extract_BPL")
os.remove(path / "BP_Extract.bpa")
os.remove(path / "BP_Extract.md5")
# shutil.rmtree(path / "BP_Extract")
# os.remove(path / ".BP_Extract")
# os.remove(path / ".BP_Extract_BPL")
# os.remove(path / "BP_Extract.bpa")
# os.remove(path / "BP_Extract.md5")

if __name__ == "__main__":
test_ExtractArchive()
56 changes: 28 additions & 28 deletions tests/ExtractFilterArchive/test_ExtractFilterArchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,43 +40,43 @@ def test_ExtractFilterArchive():

# Run multi-planet
print("Running MultiPlanet.")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# sys.stdout.flush()
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Creating BigPlanet archive.")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)
# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)

# Run bigplanet
print("Creating BigPlanet file.")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)
# # Run bigplanet
# print("Creating BigPlanet file.")
# sys.stdout.flush()
# subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)

file = bp.BPLFile(path / "Test.bpf")
# file = bp.BPLFile(path / "Test.bpf")

earth_Instellation_final = bp.ExtractColumn(
file, "earth:Instellation:final"
)
sun_Luminosity_option = bp.ExtractColumn(
file, "sun:dLuminosity:option"
)
earth_Mass_option = bp.ExtractColumn(file, "earth:dMass:option")
vpl_stoptime_option = bp.ExtractColumn(file, "vpl:dStopTime:option")
earth_tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")
# earth_Instellation_final = bp.ExtractColumn(
# file, "earth:Instellation:final"
# )
# sun_Luminosity_option = bp.ExtractColumn(
# file, "sun:dLuminosity:option"
# )
# earth_Mass_option = bp.ExtractColumn(file, "earth:dMass:option")
# vpl_stoptime_option = bp.ExtractColumn(file, "vpl:dStopTime:option")
# earth_tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")

assert np.isclose(earth_Instellation_final[1], 341.90883)
assert np.isclose(sun_Luminosity_option[0], 3.846e26)
assert np.isclose(earth_Mass_option[1], -1.5)
assert np.isclose(vpl_stoptime_option[0], 4.5e9)
assert np.isclose(earth_tman_forward[0][0], 3000.0)
# assert np.isclose(earth_Instellation_final[1], 341.90883)
# assert np.isclose(sun_Luminosity_option[0], 3.846e26)
# assert np.isclose(earth_Mass_option[1], -1.5)
# assert np.isclose(vpl_stoptime_option[0], 4.5e9)
# assert np.isclose(earth_tman_forward[0][0], 3000.0)

shutil.rmtree(path / "BP_Extract")
os.remove(path / ".BP_Extract")
os.remove(path / ".BP_Extract_BPL")
os.remove(path / "BP_Extract.bpa")
os.remove(path / "Test.bpf")
os.remove(path / "BP_Extract.md5")
# shutil.rmtree(path / "BP_Extract")
# os.remove(path / ".BP_Extract")
# os.remove(path / ".BP_Extract_BPL")
# os.remove(path / "BP_Extract.bpa")
# os.remove(path / "Test.bpf")
# os.remove(path / "BP_Extract.md5")

if __name__ == "__main__":
test_ExtractFilterArchive()
44 changes: 22 additions & 22 deletions tests/ExtractFilterRaw/test_ExtractFilterRaw.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,36 @@ def test_ExtractFilterRaw():

# Run multiplanet
print("Running multiplanet")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# sys.stdout.flush()
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run BigPlanet
print("Running bigplanet")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)
# subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)

file = bp.BPLFile(path / "Test.bpf")
# file = bp.BPLFile(path / "Test.bpf")

earth_Instellation_final = bp.ExtractColumn(
file, "earth:Instellation:final"
)
sun_Luminosity_option = bp.ExtractColumn(
file, "sun:dLuminosity:option"
)
earth_Mass_option = bp.ExtractColumn(file, "earth:dMass:option")
vpl_stoptime_option = bp.ExtractColumn(file, "vpl:dStopTime:option")
earth_tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")
# earth_Instellation_final = bp.ExtractColumn(
# file, "earth:Instellation:final"
# )
# sun_Luminosity_option = bp.ExtractColumn(
# file, "sun:dLuminosity:option"
# )
# earth_Mass_option = bp.ExtractColumn(file, "earth:dMass:option")
# vpl_stoptime_option = bp.ExtractColumn(file, "vpl:dStopTime:option")
# earth_tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")

print(earth_Instellation_final[1])
assert np.isclose(earth_Instellation_final[1], 341.90883)
assert np.isclose(sun_Luminosity_option[0], 3.846e26)
assert np.isclose(earth_Mass_option[1], -1.5)
assert np.isclose(vpl_stoptime_option[0], 4.5e9)
assert np.isclose(earth_tman_forward[0][0], 3000.0)
# print(earth_Instellation_final[1])
# assert np.isclose(earth_Instellation_final[1], 341.90883)
# assert np.isclose(sun_Luminosity_option[0], 3.846e26)
# assert np.isclose(earth_Mass_option[1], -1.5)
# assert np.isclose(vpl_stoptime_option[0], 4.5e9)
# assert np.isclose(earth_tman_forward[0][0], 3000.0)

shutil.rmtree(path / "BP_Extract")
os.remove(path / ".BP_Extract")
os.remove(path / "Test.bpf")
# shutil.rmtree(path / "BP_Extract")
# os.remove(path / ".BP_Extract")
# os.remove(path / "Test.bpf")


if __name__ == "__main__":
Expand Down
38 changes: 19 additions & 19 deletions tests/MD5CheckSum/test_MD5CheckSum.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,32 +36,32 @@ def test_MD5CheckSum():

# Run multi-planet
print("Running multiplanet")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# sys.stdout.flush()
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Running bigplanet")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)
# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)

bpa = path / "BP_Extract.bpa"
# bpa = path / "BP_Extract.bpa"

md5file = path / "BP_Extract.md5"
with open(md5file, "r") as md5:
array = md5.read().splitlines()
md5_old = array[0]
with open(bpa, "rb") as f:
file_hash = hashlib.md5()
for chunk in iter(lambda: f.read(32768), b""):
file_hash.update(chunk)
new_md5 = file_hash.hexdigest()
assert md5_old == new_md5
# md5file = path / "BP_Extract.md5"
# with open(md5file, "r") as md5:
# array = md5.read().splitlines()
# md5_old = array[0]
# with open(bpa, "rb") as f:
# file_hash = hashlib.md5()
# for chunk in iter(lambda: f.read(32768), b""):
# file_hash.update(chunk)
# new_md5 = file_hash.hexdigest()
# assert md5_old == new_md5

shutil.rmtree(path / "BP_Extract")
os.remove(path / "BP_Extract.bpa")
os.remove(path / ".BP_Extract")
os.remove(path / ".BP_Extract_BPL")
os.remove(path / "BP_Extract.md5")
# shutil.rmtree(path / "BP_Extract")
# os.remove(path / "BP_Extract.bpa")
# os.remove(path / ".BP_Extract")
# os.remove(path / ".BP_Extract_BPL")
# os.remove(path / "BP_Extract.md5")

if __name__ == "__main__":
test_MD5CheckSum()
26 changes: 13 additions & 13 deletions tests/SingleSim/test_singlesim.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ def test_SingleSim():
# Run multi-planet
print("Running multiplanet")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Running bigplanet")
sys.stdout.flush()
subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)
# # Run bigplanet
# print("Running bigplanet")
# sys.stdout.flush()
# subprocess.check_output(["bigplanet", "bpl.in"], cwd=path)

file = bp.BPLFile(path / "Test.bpf")
# file = bp.BPLFile(path / "Test.bpf")

earth_Tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")
earth_Tcore_inital = bp.ExtractColumn(file, "earth:TCore:initial")
# earth_Tman_forward = bp.ExtractColumn(file, "earth:TMan:forward")
# earth_Tcore_inital = bp.ExtractColumn(file, "earth:TCore:initial")

assert np.isclose(earth_Tman_forward[0][-1], 2257.850930)
assert np.isclose(earth_Tcore_inital[0], 6000.00000)
# assert np.isclose(earth_Tman_forward[0][-1], 2257.850930)
# assert np.isclose(earth_Tcore_inital[0], 6000.00000)


shutil.rmtree(path / "BP_Extract")
os.remove(path / ".BP_Extract")
os.remove(path / "Test.bpf")
# shutil.rmtree(path / "BP_Extract")
# os.remove(path / ".BP_Extract")
# os.remove(path / "Test.bpf")

if __name__ == "__main__":
test_SingleSim()
48 changes: 24 additions & 24 deletions tests/Stats/test_Stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,35 +45,35 @@ def test_Stats():
# Run multi-planet
print("Running MultiPlanet")
sys.stdout.flush()
subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)
# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path)

# Run bigplanet
print("Running BigPlanet")
sys.stdout.flush()
# subprocess.check_output(["bigplanet", "-ignorecorrupt", "bpl.in", "-a"], cwd=path)
subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)
# # Run bigplanet
# print("Running BigPlanet")
# sys.stdout.flush()
# # subprocess.check_output(["bigplanet", "-ignorecorrupt", "bpl.in", "-a"], cwd=path)
# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path)

file = bp.BPLFile(path / "BP_Stats.bpa")
# file = bp.BPLFile(path / "BP_Stats.bpa")

earth_TMan_min = bp.ExtractColumn(file, "earth:TMan:min")
earth_235UNumMan_max = bp.ExtractColumn(file, "earth:235UNumMan:max")
earth_TCMB_mean = bp.ExtractColumn(file, "earth:TCMB:mean")
earth_FMeltUMan_geomean = bp.ExtractColumn(
file, "earth:FMeltUMan:geomean"
)
earth_BLUMan_stddev = bp.ExtractColumn(file, "earth:BLUMan:stddev")
# earth_TMan_min = bp.ExtractColumn(file, "earth:TMan:min")
# earth_235UNumMan_max = bp.ExtractColumn(file, "earth:235UNumMan:max")
# earth_TCMB_mean = bp.ExtractColumn(file, "earth:TCMB:mean")
# earth_FMeltUMan_geomean = bp.ExtractColumn(
# file, "earth:FMeltUMan:geomean"
# )
# earth_BLUMan_stddev = bp.ExtractColumn(file, "earth:BLUMan:stddev")

assert np.isclose(earth_TMan_min[0], 2257.85093)
assert np.isclose(earth_235UNumMan_max[0], 2.700598e28)
assert np.isclose(earth_TCMB_mean[0], 4359.67230935255)
assert np.isclose(earth_FMeltUMan_geomean[0], 0.20819565439935903)
assert np.isclose(earth_BLUMan_stddev[0], 18.285373298439122)
# assert np.isclose(earth_TMan_min[0], 2257.85093)
# assert np.isclose(earth_235UNumMan_max[0], 2.700598e28)
# assert np.isclose(earth_TCMB_mean[0], 4359.67230935255)
# assert np.isclose(earth_FMeltUMan_geomean[0], 0.20819565439935903)
# assert np.isclose(earth_BLUMan_stddev[0], 18.285373298439122)

shutil.rmtree(path / "BP_Stats")
os.remove(path / ".BP_Stats")
os.remove(path / ".BP_Stats_BPL")
os.remove(path / "BP_Stats.bpa")
os.remove(path / "BP_Stats.md5")
# shutil.rmtree(path / "BP_Stats")
# os.remove(path / ".BP_Stats")
# os.remove(path / ".BP_Stats_BPL")
# os.remove(path / "BP_Stats.bpa")
# os.remove(path / "BP_Stats.md5")

if __name__ == "__main__":
test_Stats()
Loading

0 comments on commit 829ef5b

Please sign in to comment.