Skip to content

Commit

Permalink
Fix old comparative tests script
Browse files Browse the repository at this point in the history
It needs to be run from the root of the repository
  • Loading branch information
Bachibouzouk committed Mar 19, 2024
1 parent 3d34976 commit 3819467
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Empty file added ramp/test/results/.gitkeep
Empty file.
25 changes: 24 additions & 1 deletion ramp/test/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# %% Import required modules
import pandas as pd
import matplotlib.pyplot as plt
from ramp.core.core import UseCase
from ramp.post_process import post_process as pp
import os

# %% Function to test the output against reference results
Expand Down Expand Up @@ -74,6 +76,7 @@ def series_to_average(profile_series, num_days):
axes[n - 1].legend()
axes[n - 1].set_xticklabels([])
axes[n - 2].set_xticklabels([])
plt.show()


# %% Testing the output and providing visual result
Expand All @@ -84,5 +87,25 @@ def series_to_average(profile_series, num_days):
by the tested code changes. If any differences are there, the developers should
evaluate whether these are as expected/designed or not
"""
from ramp.example.input_file_1 import User_list as User_list1
from ramp.example.input_file_2 import User_list as User_list2
from ramp.example.input_file_3 import User_list as User_list3

test_output("../results", "../test", num_input_files=3)
for i, ul in enumerate([User_list1, User_list2, User_list3]):
of_path = os.path.join(pp.BASE_PATH, "test", "results", f"output_file_{i + 1}.csv")
if os.path.exists(of_path) is False:
uc = UseCase(
users=ul,
parallel_processing=False,
)
uc.initialize(peak_enlarge=0.15, num_days=30)

Profiles_list = uc.generate_daily_load_profiles(flat=True)

pp.export_series(Profiles_list, ofname=of_path)

test_output(
os.path.join(pp.BASE_PATH, "test", "results"),
os.path.join(pp.BASE_PATH, "test"),
num_input_files=3,
)

0 comments on commit 3819467

Please sign in to comment.