Author: bugman Date: Sat Mar 23 23:06:29 2013 New Revision: 19090 URL: http://svn.gna.org/viewcvs/relax?rev=19090&view=rev Log: Shifted some more OpenDX code from pipe_control.opendx.main into the new module lib.opendx.execute. Added: trunk/lib/opendx/execute.py - copied, changed from r19089, trunk/pipe_control/opendx/main.py Modified: trunk/lib/opendx/__init__.py trunk/pipe_control/opendx/main.py trunk/user_functions/dx.py Modified: trunk/lib/opendx/__init__.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/opendx/__init__.py?rev=19090&r1=19089&r2=19090&view=diff ============================================================================== --- trunk/lib/opendx/__init__.py (original) +++ trunk/lib/opendx/__init__.py Sat Mar 23 23:06:29 2013 @@ -23,5 +23,6 @@ """The relax-lib NMR package - a library of functions for interacting with the OpenDX software.""" __all__ = [ + 'execute', 'files' ] Copied: trunk/lib/opendx/execute.py (from r19089, trunk/pipe_control/opendx/main.py) URL: http://svn.gna.org/viewcvs/relax/trunk/lib/opendx/execute.py?p2=trunk/lib/opendx/execute.py&p1=trunk/pipe_control/opendx/main.py&r1=19089&r2=19090&rev=19090&view=diff ============================================================================== --- trunk/pipe_control/opendx/main.py (original) +++ trunk/lib/opendx/execute.py Sat Mar 23 23:06:29 2013 @@ -20,71 +20,14 @@ ############################################################################### # Module docsting. -"""Module containing the functions which interface relax with OpenDX.""" +"""Module for executing OpenDX.""" # Python module imports. from os import system # relax module imports. -from pipe_control.opendx import isosurface_3D -from lib.errors import RelaxError from lib.io import test_binary - - -def map(params=None, map_type='Iso3D', spin_id=None, inc=20, lower=None, upper=None, axis_incs=10, file_prefix="map", dir="dx", point=None, point_file="point", remap=None): - """Map the space corresponding to the spin identifier and create the OpenDX files. - - @keyword params: - @type params: - @keyword map_type: The type of map to create. The available options are: - - 'Iso3D', a 3D isosurface visualisation of the space. - @type map_type: str - @keyword spin_id: The spin identification string. - @type spin_id: str - @keyword inc: The resolution of the plot. This is the number of increments per - dimension. - @type inc: int - @keyword lower: The lower bounds of the space to map. If supplied, this should be a - list of floats, its length equal to the number of parameters in the - model. - @type lower: None or list of float - @keyword upper: The upper bounds of the space to map. If supplied, this should be a - list of floats, its length equal to the number of parameters in the - model. - @type upper: None or list of float - @keyword axis_incs: The number of tick marks to display in the OpenDX plot in each - dimension. - @type axis_incs: int - @keyword file_prefix: The file prefix for all the created files. - @type file_prefix: str - @keyword dir: The directory to place the files into. - @type dir: str or None - @keyword point: If supplied, a red sphere will be placed at these coordinates. - @type point: None or list of float - @keyword point_file: The file prefix for the point output files. - @type point_file: str or None - @keyword remap: A function which is used to remap the space. The function should accept - the parameter array (list of float) and return an array of equal length - (again list of float). - @type remap: None or func - """ - - # Check the args. - if inc <= 1: - raise RelaxError("The increment value needs to be greater than 1.") - if axis_incs <= 1: - raise RelaxError("The axis increment value needs to be greater than 1.") - - # Space type. - if map_type.lower() == "iso3d": - if len(params) != 3: - raise RelaxError("The 3D isosurface map requires a 3 parameter model.") - - # Create the map. - isosurface_3D.Iso3D(params, spin_id, inc, lower, upper, axis_incs, file_prefix, dir, point, point_file, remap) - else: - raise RelaxError("The map type '" + map_type + "' is not supported.") def run(file_prefix="map", dir="dx", dx_exe="dx", vp_exec=True): Modified: trunk/pipe_control/opendx/main.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/opendx/main.py?rev=19090&r1=19089&r2=19090&view=diff ============================================================================== --- trunk/pipe_control/opendx/main.py (original) +++ trunk/pipe_control/opendx/main.py Sat Mar 23 23:06:29 2013 @@ -23,13 +23,9 @@ """Module containing the functions which interface relax with OpenDX.""" -# Python module imports. -from os import system - # relax module imports. from pipe_control.opendx import isosurface_3D from lib.errors import RelaxError -from lib.io import test_binary def map(params=None, map_type='Iso3D', spin_id=None, inc=20, lower=None, upper=None, axis_incs=10, file_prefix="map", dir="dx", point=None, point_file="point", remap=None): @@ -85,34 +81,3 @@ isosurface_3D.Iso3D(params, spin_id, inc, lower, upper, axis_incs, file_prefix, dir, point, point_file, remap) else: raise RelaxError("The map type '" + map_type + "' is not supported.") - - -def run(file_prefix="map", dir="dx", dx_exe="dx", vp_exec=True): - """Execute OpenDX. - - @keyword file_prefix: The file prefix for all the created files. - @type file_prefix: str - @keyword dir: The directory to place the files into. - @type dir: str or None - @keyword dx_exe: The path to the OpenDX executable file. This can be changed if the - binary 'dx' is not located in the system path. - @type dx_exe: str - @keyword vp_exec: If True, then the OpenDX visual program will be launched. - @type vp_exec: bool - """ - - # Text for changing to the directory dir. - dir_text = "" - if dir != None: - dir_text = " -directory " + dir - - # Text for executing OpenDX. - execute_text = "" - if vp_exec: - execute_text = " -execute" - - # Test the binary file string corresponds to a valid executable. - test_binary(dx_exe) - - # Run OpenDX. - system(dx_exe + dir_text + " -program " + file_prefix + ".net" + execute_text + " &") Modified: trunk/user_functions/dx.py URL: http://svn.gna.org/viewcvs/relax/trunk/user_functions/dx.py?rev=19090&r1=19089&r2=19090&view=diff ============================================================================== --- trunk/user_functions/dx.py (original) +++ trunk/user_functions/dx.py Sat Mar 23 23:06:29 2013 @@ -25,6 +25,7 @@ # relax module imports. from pipe_control import diffusion_tensor from graphics import WIZARD_IMAGE_PATH +import lib.opendx.execute import pipe_control.opendx.main from prompt.doc_string import regexp_doc from specific_analyses.model_free import Model_free @@ -77,7 +78,7 @@ # Description. uf.desc.append(Desc_container()) uf.desc[-1].add_paragraph("This will execute OpenDX to display the space maps created previously by the dx.map user function. This will work for any type of OpenDX map.") -uf.backend = pipe_control.opendx.main.run +uf.backend = lib.opendx.execute.run uf.menu_text = "&execute" uf.gui_icon = "oxygen.categories.applications-education" uf.wizard_size = (700, 500)