diff --git a/tests/CreateHDF5/test_CreateHDF5.py b/tests/CreateHDF5/test_CreateHDF5.py index 5bd5d08..c5aed4b 100644 --- a/tests/CreateHDF5/test_CreateHDF5.py +++ b/tests/CreateHDF5/test_CreateHDF5.py @@ -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() diff --git a/tests/ExtractArchive/test_ExtractArchive.py b/tests/ExtractArchive/test_ExtractArchive.py index a349cd1..edbdcef 100644 --- a/tests/ExtractArchive/test_ExtractArchive.py +++ b/tests/ExtractArchive/test_ExtractArchive.py @@ -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() diff --git a/tests/ExtractFilterArchive/test_ExtractFilterArchive.py b/tests/ExtractFilterArchive/test_ExtractFilterArchive.py index b9808a6..6bb2cb2 100644 --- a/tests/ExtractFilterArchive/test_ExtractFilterArchive.py +++ b/tests/ExtractFilterArchive/test_ExtractFilterArchive.py @@ -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() diff --git a/tests/ExtractFilterRaw/test_ExtractFilterRaw.py b/tests/ExtractFilterRaw/test_ExtractFilterRaw.py index 8109e84..5ebe534 100644 --- a/tests/ExtractFilterRaw/test_ExtractFilterRaw.py +++ b/tests/ExtractFilterRaw/test_ExtractFilterRaw.py @@ -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__": diff --git a/tests/MD5CheckSum/test_MD5CheckSum.py b/tests/MD5CheckSum/test_MD5CheckSum.py index 55b676b..c2c6de3 100644 --- a/tests/MD5CheckSum/test_MD5CheckSum.py +++ b/tests/MD5CheckSum/test_MD5CheckSum.py @@ -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() diff --git a/tests/SingleSim/test_singlesim.py b/tests/SingleSim/test_singlesim.py index b1078f9..faef962 100644 --- a/tests/SingleSim/test_singlesim.py +++ b/tests/SingleSim/test_singlesim.py @@ -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() diff --git a/tests/Stats/test_Stats.py b/tests/Stats/test_Stats.py index 9615366..19fda68 100644 --- a/tests/Stats/test_Stats.py +++ b/tests/Stats/test_Stats.py @@ -45,35 +45,34 @@ 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", "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() diff --git a/tests/Status/test_Status.py b/tests/Status/test_Status.py index 1cb46a2..8825ffd 100644 --- a/tests/Status/test_Status.py +++ b/tests/Status/test_Status.py @@ -35,23 +35,22 @@ def test_bpstatus(): subprocess.check_output(["vspace", "vspace.in"], cwd=path) # Run multi-planet -# subprocess.check_output(["multiplanet", "vspace.in"], cwd=path) + subprocess.check_output(["multiplanet", "vspace.in"], cwd=path) -# # Run bigplanet -# # subprocess.check_output(["bigplanet", "-ignorecorrupt", "bpl.in", "-a"], cwd=path) -# subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path) -# subprocess.check_output(["bpstatus", "vspace.in"], cwd=path) + # Run bigplanet + subprocess.check_output(["bigplanet", "bpl.in", "-a"], cwd=path) + subprocess.check_output(["bpstatus", "vspace.in"], cwd=path) -# file = path / "BP_Status.bpa" + file = path / "BP_Status.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_Status") -# os.remove(path / ".BP_Status") -# os.remove(path / ".BP_Status_BPL") -# os.remove(path / "BP_Status.bpa") -# os.remove(path / "BP_Status.md5") + shutil.rmtree(path / "BP_Status") + os.remove(path / ".BP_Status") + os.remove(path / ".BP_Status_BPL") + os.remove(path / "BP_Status.bpa") + os.remove(path / "BP_Status.md5") if __name__ == "__main__": test_bpstatus() diff --git a/tests/UlyssesAggregated/test_UlyssesAggregated.py b/tests/UlyssesAggregated/test_UlyssesAggregated.py index 09d4e9b..1f3c122 100644 --- a/tests/UlyssesAggregated/test_UlyssesAggregated.py +++ b/tests/UlyssesAggregated/test_UlyssesAggregated.py @@ -36,23 +36,23 @@ def test_UlyssesAggregated(): # 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 = path / "User.csv" + file = path / "User.csv" - # data = bp.CSVToDict(file, 1) - # assert np.isclose( - # float(data["earth:Instellation:final"][0]), 1367.635318 - # ) + data = bp.CSVToDict(file, 1) + assert np.isclose( + float(data["earth:Instellation:final"][0]), 1367.635318 + ) - # shutil.rmtree(path / "BP_Extract") - # os.remove(path / ".BP_Extract") - # os.remove(path / "User.csv") + shutil.rmtree(path / "BP_Extract") + os.remove(path / ".BP_Extract") + os.remove(path / "User.csv") if __name__ == "__main__": test_UlyssesAggregated() diff --git a/tests/UlyssesForward/test_UlyssesForward.py b/tests/UlyssesForward/test_UlyssesForward.py index f55e319..8f28320 100644 --- a/tests/UlyssesForward/test_UlyssesForward.py +++ b/tests/UlyssesForward/test_UlyssesForward.py @@ -34,24 +34,24 @@ def test_UlyssesForward(): # 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 = path / "User.csv" + file = path / "User.csv" - # data = bp.CSVToDict(file, 1) + data = bp.CSVToDict(file, 1) - # value = float(data["earth:TCore:forward"][451]) + value = float(data["earth:TCore:forward"][451]) - # assert np.isclose(value, 4999.131849) + assert np.isclose(value, 4999.131849) - # shutil.rmtree(path / "BP_Extract") - # os.remove(path / ".BP_Extract") - # os.remove(path / "User.csv") + shutil.rmtree(path / "BP_Extract") + os.remove(path / ".BP_Extract") + os.remove(path / "User.csv") if __name__ == "__main__": test_UlyssesForward()