Author: bugman Date: Mon Apr 8 15:07:50 2013 New Revision: 19401 URL: http://svn.gna.org/viewcvs/relax?rev=19401&view=rev Log: Created the pipe_control.plotting module. This will be used as a base for the plotting of all types of data. This includes the current OpenDX and Grace modules, as well as future modules. The determine_functions() function has been added and is used to simplify the pipe_control.grace.get_data() function. Added: trunk/pipe_control/plotting.py Modified: trunk/pipe_control/__init__.py trunk/pipe_control/grace.py Modified: trunk/pipe_control/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/__init__.py?rev=19401&r1=19400&r2=19401&view=diff ============================================================================== --- trunk/pipe_control/__init__.py (original) +++ trunk/pipe_control/__init__.py Mon Apr 8 15:07:50 2013 @@ -48,6 +48,7 @@ 'paramag', 'pcs', 'pipes', + 'plotting', 'pymol_control', 'rdc', 'relax_data', Modified: trunk/pipe_control/grace.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/grace.py?rev=19401&r1=19400&r2=19401&view=diff ============================================================================== --- trunk/pipe_control/grace.py (original) +++ trunk/pipe_control/grace.py Mon Apr 8 15:07:50 2013 @@ -32,6 +32,7 @@ from pipe_control.mol_res_spin import count_molecules, count_residues, count_spins, exists_mol_res_spin_data, generate_spin_id, spin_loop from pipe_control import pipes from pipe_control.result_files import add_result_file +from pipe_control.plotting import determine_functions from lib.errors import RelaxError, RelaxNoSequenceError, RelaxNoSimError from lib.io import get_file_path, open_write_file, test_binary from lib.software.grace import write_xy_data, write_xy_header @@ -183,18 +184,8 @@ data_dict = False # Specific x and y value returning functions. - x_return_value = y_return_value = specific_analyses.setup.get_specific_fn('return_value', pipes.get_type()) - x_return_conversion_factor = y_return_conversion_factor = specific_analyses.setup.get_specific_fn('return_conversion_factor', pipes.get_type()) - - # Test if the X-axis data type is a minimisation statistic. - if x_data_type != 'spin' and pipe_control.minimise.return_data_name(x_data_type): - x_return_value = pipe_control.minimise.return_value - x_return_conversion_factor = pipe_control.minimise.return_conversion_factor - - # Test if the Y-axis data type is a minimisation statistic. - if y_data_type != 'spin' and pipe_control.minimise.return_data_name(y_data_type): - y_return_value = pipe_control.minimise.return_value - y_return_conversion_factor = pipe_control.minimise.return_conversion_factor + x_return_value, x_return_conversion_factor, x_get_type = determine_functions(category=x_data_type) + y_return_value, y_return_conversion_factor, y_get_type = determine_functions(category=y_data_type) # Number of graph sets. if plot_data == 'sim': Added: trunk/pipe_control/plotting.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/plotting.py?rev=19401&view=auto ============================================================================== --- trunk/pipe_control/plotting.py (added) +++ trunk/pipe_control/plotting.py Mon Apr 8 15:07:50 2013 @@ -1,0 +1,53 @@ +############################################################################### +# # +# Copyright (C) 2013 Edward d'Auvergne # +# # +# This file is part of the program relax (http://www.nmr-relax.com). # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see <http://www.gnu.org/licenses/>. # +# # +############################################################################### + +# Module docstring. +"""Module for the plotting of data.""" + + +# relax module imports. +from pipe_control import minimise +import specific_analyses + + +def determine_functions(category): + """Determine the specific functions for the given data type. + + @param category: The data category. + @type category: str + @return: The analysis specific return_value, return_conversion_factor, and get_type methods. + @rtype: tuple of methods or None + """ + + # Spin category. + if category == 'spin': + return None, None, None + + # A minimisation statistic. + if minimise.return_data_name(category): + return minimise.return_value, minimise.return_conversion_factor, None + + # Analysis specific value returning functions. + else: + return_value = specific_analyses.setup.get_specific_fn('return_value') + return_conversion_factor = specific_analyses.setup.get_specific_fn('return_conversion_factor') + data_type = specific_analyses.setup.get_specific_fn('data_type') + return return_value, return_conversion_factor, data_type