diff --git a/solventmapcreator/solvationcalculation/solvationmapgenerator.py b/solventmapcreator/solvationcalculation/solvationmapgenerator.py index 02472c19510c836f4efc96467ed51240a1759ce8..f12991019883b51725ec1fad5532733d87b8275a 100644 --- a/solventmapcreator/solvationcalculation/solvationmapgenerator.py +++ b/solventmapcreator/solvationcalculation/solvationmapgenerator.py @@ -31,9 +31,9 @@ def create_solvation_plot(epsilon_i_list, epsilon_j_list, return plot_and_write_contour_map(input_data, **kwargs) def plot_and_write_contour_map(input_data, **kwargs): - """This creates and plots a contour map wit hthe input given. + """This creates and plots a contour map wit the input given. """ - return plottinginput.create_and_write_contour_plot(input_data, **kwargs) + return plottinginput.create_and_write_contour_plot(input_data, kwargs.get("fileformat", "eps")) def create_plot_input_data_from_files(epsilon_i_list, epsilon_j_list, solvent_filename, solvent_id, diff --git a/solventmapcreator/solvationcalculation/solvationplotinformation.py b/solventmapcreator/solvationcalculation/solvationplotinformation.py index a7db1e4cb7a8af0041a43379de625dab4987c67a..9122ea910a642cf7f11a19653447a04d865ba983 100644 --- a/solventmapcreator/solvationcalculation/solvationplotinformation.py +++ b/solventmapcreator/solvationcalculation/solvationplotinformation.py @@ -37,13 +37,13 @@ def create_input_data_values(epsilon_i_list, epsilon_j_list, temperature, theta, def get_axis_range(epsilon_i_list, epsilon_j_list): """This gets the range of the values in the x and y data. """ - return ((epsilon_i_list.min(), epsilon_i_list.max()), - (epsilon_j_list.min(), epsilon_j_list.max())) + return (epsilon_i_list.min(), epsilon_i_list.max(), + epsilon_j_list.min(), epsilon_j_list.max()) def create_meshgrids(epsilon_i_list, epsilon_j_list): """This creates the mesh grids of the x and y coordinates, to get the right dimensionality for plotting. """ - return np.meshgrid(epsilon_i_list, epsilon_j_list) + return np.meshgrid(epsilon_i_list, epsilon_j_list, indexing='ij') def calculate_association_energy_matrix(epsilon_i_list, epsilon_j_list, temperature, theta, polynomial_coefficients): """This creates the matrix of association constants. diff --git a/solventmapcreator/test/solvationcalculationtest/solvationmapgeneratortest.py b/solventmapcreator/test/solvationcalculationtest/solvationmapgeneratortest.py index 856a75e6fb0bcbcedf08dee13005632b6fa39212..f31bf33432134a393876e0088c406801d9951611 100644 --- a/solventmapcreator/test/solvationcalculationtest/solvationmapgeneratortest.py +++ b/solventmapcreator/test/solvationcalculationtest/solvationmapgeneratortest.py @@ -37,13 +37,13 @@ class SolvationMapGeneratorTestCase(unittest.TestCase): def test_create_plot_input_data_from_files(self): """Test to see if expected dictionary is produced. """ - expected_dict = {'x_data':np.array([[0, 1, 2],[0, 1, 2]]), - 'y_data':np.array([[0, 0, 0], [1, 1, 1]]), + expected_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]), + 'y_data':np.array([[0, 1], [0, 1], [0, 1]]), 'z_data':np.array([[-4.532289, -3.46086], [-3.46086, -1.671915], [-2.389432, 0.06058]]), "x_label":"\\beta", "y_label":"\\alpha", - "plot_axis_range":((0.0, 2.0), (0.0, 1.0)), + "plot_axis_range":(0.0, 2.0, 0.0, 1.0), "figure_label":"water_solv_map"} actual_dict = solvationmapgenerator.create_plot_input_data_from_files(self.epsilon_i_list, self.epsilon_j_list, "resources/watersolvent.xml", "water", @@ -75,13 +75,13 @@ class SolvationMapGeneratorTestCase(unittest.TestCase): def test_create_plot_input_data(self): """Test to see if expected input data is returned. """ - expected_dict = {'x_data':np.array([[0, 1, 2],[0, 1, 2]]), - 'y_data':np.array([[0, 0, 0], [1, 1, 1]]), + expected_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]), + 'y_data':np.array([[0, 1], [0, 1], [0, 1]]), 'z_data':np.array([[-4.004792, -3.004792], [-3.004792, -1.250065], [-2.004792, 0.454246]]), "x_label":"x_label", "y_label":"y_label", - "plot_axis_range":((0.0, 2.0), (0.0, 1.0))} + "plot_axis_range":(0.0, 2.0, 0.0, 1.0)} actual_dict = solvationmapgenerator.create_plot_input_data(self.epsilon_i_list, self.epsilon_j_list, 298.0, 1.0, diff --git a/solventmapcreator/test/solvationcalculationtest/solvationplotinformationtest.py b/solventmapcreator/test/solvationcalculationtest/solvationplotinformationtest.py index 569bd61367fc80aa1a62ea6959d38f0400fc9a1b..7000a501425701410d4ade00bd66f8eb774cd583 100644 --- a/solventmapcreator/test/solvationcalculationtest/solvationplotinformationtest.py +++ b/solventmapcreator/test/solvationcalculationtest/solvationplotinformationtest.py @@ -31,13 +31,13 @@ class SolvationPlotInformationTestCase(unittest.TestCase): def test_create_plot_input_data(self): """Test to see if expected dictionary is produced. """ - expected_dict = {'x_data':np.array([[0, 1, 2],[0, 1, 2]]), - 'y_data':np.array([[0, 0, 0], [1, 1, 1]]), + expected_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]), + 'y_data':np.array([[0, 1], [0, 1], [0, 1]]), 'z_data':np.array([[-4.004792, -3.004792], [-3.004792, -1.250065], [-2.004792, 0.454246]]), "x_label":"x_label", "y_label":"y_label", - "plot_axis_range":((0.0, 2.0), (0.0, 1.0))} + "plot_axis_range":(0.0, 2.0, 0.0, 1.0)} 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())) for key in expected_dict.keys(): @@ -51,7 +51,7 @@ class SolvationPlotInformationTestCase(unittest.TestCase): """Test to see if expected dictionary is produced. """ expected_dict = {"x_label":"x_label", "y_label":"y_label", - "plot_axis_range":((0.0, 2.0), (0.0, 1.0))} + "plot_axis_range":(0.0, 2.0, 0.0, 1.0)} actual_dict = solvationplotinformation.create_input_data_labels(self.epsilon_i_list, self.epsilon_j_list, "x_label", "y_label") self.assertListEqual(sorted(expected_dict.keys()), sorted(actual_dict.keys())) for key in expected_dict.keys(): @@ -62,8 +62,8 @@ class SolvationPlotInformationTestCase(unittest.TestCase): def test_create_input_data_values(self): """Test to see if expected dictionary is produced. """ - expected_dict = {'x_data':np.array([[0, 1, 2],[0, 1, 2]]), - 'y_data':np.array([[0, 0, 0], [1, 1, 1]]), + expected_dict = {'x_data':np.array([[0, 0], [1, 1], [2, 2]]), + 'y_data':np.array([[0, 1], [0, 1], [0, 1]]), 'z_data':np.array([[-4.004792, -3.004792], [-3.004792, -1.250065], [-2.004792, 0.454246]])} @@ -74,14 +74,14 @@ class SolvationPlotInformationTestCase(unittest.TestCase): def test_get_axis_range(self): """Test to see if expected axis range is returned. """ - expected_range = ((0.0, 2.0),(0.0, 1.0)) + expected_range = (0.0, 2.0, 0.0, 1.0) actual_range = solvationplotinformation.get_axis_range(self.epsilon_i_list, self.epsilon_j_list) np.testing.assert_array_almost_equal(np.array(expected_range), np.array(actual_range)) def test_create_meshgrids(self): """Test to see if expected arrays are produced. """ - expected_x = np.array([[0, 1, 2],[0, 1, 2]]) - expected_y = np.array([[0, 0, 0], [1, 1, 1]]) + expected_x = np.array([[0, 0], [1, 1], [2, 2]]) + expected_y = np.array([[0, 1], [0, 1], [0, 1]]) actual_x, actual_y = solvationplotinformation.create_meshgrids(self.epsilon_i_list, self.epsilon_j_list) np.testing.assert_array_almost_equal(expected_x, actual_x) np.testing.assert_array_almost_equal(expected_y, actual_y)