FAQ | This is a LIVE service | Changelog

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

added method to do polynomial analysis on a subset of points.

parent e1c36f28
No related branches found
No related tags found
No related merge requests found
......@@ -31,6 +31,16 @@ def parse_energies_create_plot_input_data(free_energy_filename, polynomial_order
plot_data['figure_label'] = free_energy_filename.replace('.xml', '')
return plot_data
def parse_energies_and_output_poly_data_subset(free_energy_filename, order_list, poly_filename, subset_list):
"""This reads in the energy information, and then selects teh subset of
points to carry out the analysis on, outputs the polynomial information to file.
"""
datapoints = parse_free_energy_from_file_with_data_arrays(free_energy_filename)
datapoints_subset = datapoints.createDatapointsSubGroup(subset_list)
datapoints_subset.createDataArrays()
return write_poly_data_to_file(datapoints_subset, order_list, poly_filename)
def parse_energies_and_output_poly_data(free_energy_filename, order_list, poly_filename):
"""This reads in the energy information, and then outputs the polynomial
information to file.
......
......@@ -30,6 +30,8 @@ class PolynomialPlottingTestCase(unittest.TestCase):
del self.expected_datapoints
if os.path.isfile("actual_water_poly_fit.csv"):
os.remove("actual_water_poly_fit.csv")
if os.path.isfile("actual_water_poly_fit_subset.csv"):
os.remove("actual_water_poly_fit_subset.csv")
def test_parse_energies_create_plot_input_data(self):
"""Test to see expected plot data is returned.
"""
......@@ -69,6 +71,19 @@ class PolynomialPlottingTestCase(unittest.TestCase):
else:
LOGGER.debug("assert equal string")
self.assertEqual(actual_dict[key], expected_dict[key])
def test_parse_energies_and_output_poly_data_subset(self):
"""Test to see if expected_fit is done on a smaller subset of points.
"""
expected_file_name = "resources/water_poly_fit_subset.csv"
actual_file_name = "actual_water_poly_fit_subset.csv"
subset_list = ["-5.400solute", "-4.300solute", "-9.100solute", "-11.100solute", "-15.400solute"]
poly_file_out = polynomialplotting.parse_energies_and_output_poly_data_subset("resources/water.xml", [2, 4], actual_file_name, subset_list)
self.assertEqual(0, poly_file_out)
with open(expected_file_name, 'r') as exp_file:
exp_file_lines = exp_file.readlines()
with open(actual_file_name, 'r') as act_file:
act_file_lines = act_file.readlines()
self.assertListEqual(act_file_lines, exp_file_lines)
def test_parse_energies_and_output_poly_data(self):
"""Test to see if expected polynomial fit information is outputted to file.
"""
......
Order RMSE Covariance Coefficients
2 0.0188857 0.0017833 6.3245323 2.8927088 -0.0017566
4 0.0000000 5.0388427 2.2906276 -0.0985583 -0.0064807 -0.0001546
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