FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 49dd4db8 authored by M.D. Driver's avatar M.D. Driver
Browse files

update to make sure correct range is covered as axis is reverted in x direction.

parent 119926e0
No related branches found
No related tags found
No related merge requests found
...@@ -38,14 +38,16 @@ def create_line_lists(axis_range): ...@@ -38,14 +38,16 @@ def create_line_lists(axis_range):
""" """
x_range = int(np.abs(axis_range[0] - axis_range[1])) x_range = int(np.abs(axis_range[0] - axis_range[1]))
y_range = int(np.abs(axis_range[2]- axis_range[3])) y_range = int(np.abs(axis_range[2]- axis_range[3]))
LOGGER.debug("x range: %d", x_range)
LOGGER.debug("y range: %d", y_range)
if y_range <= 5: if y_range <= 5:
h_lines = [x/4.0 for x in range(int(np.floor(axis_range[2])), 4 * y_range + 1)] h_lines = [x/4.0 for x in range(int(np.floor(axis_range[2])), 4 * y_range + 1)]
else: else:
h_lines = [x/2.0 for x in range(int(np.floor(axis_range[2])), 2 * y_range + 1)] h_lines = [x/2.0 for x in range(int(np.floor(axis_range[2])), 2 * y_range + 1)]
if x_range <= 5: if x_range <= 5:
v_lines = [x/4.0 for x in range(int(np.floor(axis_range[0])), 4 * x_range + 1)] v_lines = [x/4.0 for x in range(int(np.floor(axis_range[1])), 4 * x_range + 1)]
else: else:
v_lines = [x/2.0 for x in range(int(np.floor(axis_range[0])), 2 * x_range + 1)] v_lines = [x/2.0 for x in range(int(np.floor(axis_range[1])), 2 * x_range + 1)]
return {"h_lines":h_lines, "v_lines":v_lines} return {"h_lines":h_lines, "v_lines":v_lines}
def create_input_data_values(epsilon_i_list, epsilon_j_list, temperature, theta, polynomial_coefficients): def create_input_data_values(epsilon_i_list, epsilon_j_list, temperature, theta, polynomial_coefficients):
......
...@@ -69,7 +69,7 @@ class SolvationMapGeneratorTestCase(unittest.TestCase): ...@@ -69,7 +69,7 @@ class SolvationMapGeneratorTestCase(unittest.TestCase):
"figure_label":"water_solv_map", "figure_label":"water_solv_map",
"levels":[-9, -7, -5], "levels":[-9, -7, -5],
"h_lines":[0., 0.25, 0.5, 0.75, 1.0], "h_lines":[0., 0.25, 0.5, 0.75, 1.0],
"v_lines":[0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]} "v_lines":[0.0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]}
actual_dict = solvationmapgenerator.create_plot_input_data_from_files(self.epsilon_i_list, self.epsilon_j_list, actual_dict = solvationmapgenerator.create_plot_input_data_from_files(self.epsilon_i_list, self.epsilon_j_list,
"resources/watersolvent.xml", "water", "resources/watersolvent.xml", "water",
"resources/expected_poly_fit.csv", 1) "resources/expected_poly_fit.csv", 1)
...@@ -109,7 +109,7 @@ class SolvationMapGeneratorTestCase(unittest.TestCase): ...@@ -109,7 +109,7 @@ class SolvationMapGeneratorTestCase(unittest.TestCase):
"plot_axis_range":(2.0, 0.0, 0.0, 1.0), "plot_axis_range":(2.0, 0.0, 0.0, 1.0),
"levels":[-9, -7], "levels":[-9, -7],
"h_lines":[0., 0.25, 0.5, 0.75, 1.0], "h_lines":[0., 0.25, 0.5, 0.75, 1.0],
"v_lines":[0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]} "v_lines":[0.0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]}
actual_dict = solvationmapgenerator.create_plot_input_data(self.epsilon_i_list, actual_dict = solvationmapgenerator.create_plot_input_data(self.epsilon_i_list,
self.epsilon_j_list, self.epsilon_j_list,
298.0, 1.0, 298.0, 1.0,
......
...@@ -40,7 +40,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase): ...@@ -40,7 +40,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase):
"plot_axis_range":(2.0, 0.0, 0.0, 1.0), "plot_axis_range":(2.0, 0.0, 0.0, 1.0),
"levels":[-9, -7], "levels":[-9, -7],
"h_lines":[0., 0.25, 0.5, 0.75, 1.0], "h_lines":[0., 0.25, 0.5, 0.75, 1.0],
"v_lines":[0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]} "v_lines":[0.0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]}
actual_dict = solvationplotinformation.create_plot_input_data(self.epsilon_i_list, self.epsilon_j_list, 298.0, 1.0, np.array([0.5, 1.0]), "x_label", "y_label") actual_dict = solvationplotinformation.create_plot_input_data(self.epsilon_i_list, self.epsilon_j_list, 298.0, 1.0, np.array([0.5, 1.0]), "x_label", "y_label")
self.assertListEqual(sorted(expected_dict.keys()), sorted(actual_dict.keys())) self.assertListEqual(sorted(expected_dict.keys()), sorted(actual_dict.keys()))
for key in expected_dict.keys(): for key in expected_dict.keys():
...@@ -59,7 +59,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase): ...@@ -59,7 +59,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase):
"plot_axis_range":(2.0, 0.0, 0.0, 1.0), "plot_axis_range":(2.0, 0.0, 0.0, 1.0),
"levels":[-9, -7], "levels":[-9, -7],
"h_lines":[0., 0.25, 0.5, 0.75, 1.0], "h_lines":[0., 0.25, 0.5, 0.75, 1.0],
"v_lines":[0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]} "v_lines":[0.0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]}
input_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]), input_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]),
'y_data':np.array([[0, 1], [0, 1], [0, 1]]), 'y_data':np.array([[0, 1], [0, 1], [0, 1]]),
'z_data':np.array([[-7.396882, -8.217107], 'z_data':np.array([[-7.396882, -8.217107],
...@@ -78,7 +78,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase): ...@@ -78,7 +78,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase):
"""Test to se if expected values are returned. """Test to se if expected values are returned.
""" """
expected_dict = {"h_lines":[0., 0.25, 0.5, 0.75, 1.0], expected_dict = {"h_lines":[0., 0.25, 0.5, 0.75, 1.0],
"v_lines":[0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]} "v_lines":[0.0, 0.25, 0.5, 0.75, 1., 1.25, 1.5, 1.75, 2.]}
actual_dict = solvationplotinformation.create_line_lists((2.0, 0.0, 0.0, 1.0)) actual_dict = solvationplotinformation.create_line_lists((2.0, 0.0, 0.0, 1.0))
for key in expected_dict.keys(): for key in expected_dict.keys():
np.testing.assert_array_equal(np.array(expected_dict[key]), np.array(actual_dict[key])) np.testing.assert_array_equal(np.array(expected_dict[key]), np.array(actual_dict[key]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment