FAQ | This is a LIVE service | Changelog

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

updated solvationmapgenerator to also write out solvation map values.

parent fcbee42b
No related branches found
No related tags found
No related merge requests found
......@@ -11,6 +11,7 @@ two SSIPs forthe x and y axes need to be supplied.
import logging
import resultsanalysis.resultsoutput.plottinginput as plottinginput
import solventmapcreator.io.polynomialdatareader as polynomialdatareader
import solventmapcreator.io.solvationmapwriter as solvationmapwriter
import solventmapcreator.solvationcalculation.fractionaloccupancycalculator as fractionaloccupancycalculator
import solventmapcreator.solvationcalculation.solvationplotinformation as solvationplotinformation
......@@ -30,13 +31,21 @@ def create_solvation_plot(epsilon_i_list, epsilon_j_list,
polynomial_order, **kwargs)
LOGGER.debug("Input data:")
LOGGER.debug(input_data)
return plot_and_write_contour_map(input_data, **kwargs)
matrix_write_out = write_matrix_to_file(input_data["figure_label"] + '.csv',
epsilon_i_list, epsilon_j_list,
input_data["z_data"])
return plot_and_write_contour_map(input_data, **kwargs), matrix_write_out
def plot_and_write_contour_map(input_data, **kwargs):
"""This creates and plots a contour map wit the input given.
"""
return plottinginput.create_and_write_contour_plot(input_data, kwargs.get("fileformat", "eps"))
def write_matrix_to_file(filename, x_values, y_values, solvation_matrix):
"""This writes the matrix to file.
"""
return solvationmapwriter.write_matrix_to_file(filename, x_values, y_values, solvation_matrix)
def create_plot_input_data_from_files(epsilon_i_list, epsilon_j_list,
solvent_filename, solvent_id,
polynomial_filename, polynomial_order, **kwargs):
......
......@@ -9,6 +9,7 @@ that assemble the data. The functions that write plots are not tested.
import logging
import unittest
import os
import numpy as np
import solventmapcreator.solvationcalculation.solvationmapgenerator as solvationmapgenerator
......@@ -34,6 +35,27 @@ class SolvationMapGeneratorTestCase(unittest.TestCase):
"""clean up after tests.
"""
del self.expected_data_by_solvent_id
del self.epsilon_i_list
del self.epsilon_j_list
if os.path.isfile("actualsimilmatrix.csv"):
os.remove("actualsimilmatrix.csv")
def test_write_matrix_to_file(self):
"""
"""
expected_file_name = "resources/similmatrix.csv"
actual_file_name = "actualsimilmatrix.csv"
simil_out_file = solvationmapgenerator.write_matrix_to_file(actual_file_name,
self.epsilon_i_list,
self.epsilon_j_list,
np.array([[-4.332289, -5.403718],
[-5.403718, -5.757629],
[-6.475146, -6.167992]]))
self.assertEqual(0, simil_out_file)
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_create_plot_input_data_from_files(self):
"""Test to see if expected dictionary is produced.
"""
......
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