Author: bugman Date: Fri Jul 8 16:05:55 2011 New Revision: 13544 URL: http://svn.gna.org/viewcvs/relax?rev=13544&view=rev Log: Convert the dx.map() user function documentation to the new design. Modified: branches/gui_testing/prompt/dx.py Modified: branches/gui_testing/prompt/dx.py URL: http://svn.gna.org/viewcvs/relax/branches/gui_testing/prompt/dx.py?rev=13544&r1=13543&r2=13544&view=diff ============================================================================== --- branches/gui_testing/prompt/dx.py (original) +++ branches/gui_testing/prompt/dx.py Fri Jul 8 16:05:55 2011 @@ -38,23 +38,6 @@ """Class for interfacing with OpenDX.""" def execute(self, file="map", dir="dx", dx_exe="dx", vp_exec=True): - """Function for running OpenDX. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - file: The file name prefix. For example if file is set to 'temp', then the OpenDX program - temp.net will be loaded. - - dir: The directory to change to for running OpenDX. If this is set to None, OpenDX will - be run in the current directory. - - dx_exe: The OpenDX executable file. - - vp_exec: A flag specifying whether to execute the visual program automatically at - start-up. The default of True causes the program to be executed. - """ - # Function intro text. if self._exec_info.intro: text = self._exec_info.ps3 + "dx(" @@ -73,92 +56,19 @@ # Execute the functional code. opendx.main.run(file_prefix=file, dir=dir, dx_exe=dx_exe, vp_exec=vp_exec) + # The function doc info. + execute._doc_title = "Execution of OpenDX." + execute._doc_title_short = "OpenDX execution." + execute._doc_args = [ + ["file", "The file name prefix. For example if file is set to 'temp', then the OpenDX program temp.net will be loaded."], + ["dir", "The directory to change to for running OpenDX. If this is set to None, OpenDX will be run in the current directory."], + ["dx_exe", "The OpenDX executable file."], + ["vp_exec", "A flag specifying whether to execute the visual program automatically at start-up. The default of True causes the program to be executed."] + ] + _build_doc(execute) + def map(self, params=None, map_type="Iso3D", spin_id=None, inc=20, lower=None, upper=None, axis_incs=5, file_prefix="map", dir="dx", point=None, point_file="point", remap=None): - """Function for creating a map of the given space in OpenDX format. - - Keyword Arguments - ~~~~~~~~~~~~~~~~~ - - params: The parameters to be mapped. This argument should be an array of strings, the - meanings of which are described below. - - map_type: The type of map to create. For example the default, a 3D isosurface, the type is - 'Iso3D'. See below for more details. - - spin_id: The spin identification numbe. - - inc: The number of increments to map in each dimension. This value controls the resolution - of the map. - - lower: The lower bounds of the space. If you wish to change the lower bounds of the map - then supply an array of length equal to the number of parameters in the model. A lower - bound for each parameter must be supplied. If nothing is supplied then the defaults will - be used. - - upper: The upper bounds of the space. If you wish to change the upper bounds of the map - then supply an array of length equal to the number of parameters in the model. A upper - bound for each parameter must be supplied. If nothing is supplied then the defaults will - be used. - - axis_incs: The number of increments or ticks displaying parameter values along the axes of - the OpenDX plot. - - file_prefix: The file name. All the output files are prefixed with this name. The main file - containing the data points will be called the value of 'file'. The OpenDX program will be - called 'file.net' and the OpenDX import file will be called 'file.general'. - - dir: The directory to output files to. Set this to 'None' if you do not want the files to - be placed in subdirectory. If the directory does not exist, it will be created. - - point: An array of parameter values where a point in the map, shown as a red sphere, will - be placed. The length must be equal to the number of parameters. - - point_file: The name of that the point output files will be prefixed with. - - remap: A user supplied remapping function. This function will receive the parameter array - and must return an array of equal length. - - - Map type - ~~~~~~~~ - - The map type can be changed by supplying the 'map_type' keyword argument. Here is a list of - currently supported map types: - _____________________________________________________________________________ - | | | - | Surface type | Pattern | - |___________________________________________|_______________________________| - | | | - | 3D isosurface | 'Iso3D' | - |___________________________________________|_______________________________| - - This argument is case insensitive. - - - Examples - ~~~~~~~~ - - The following commands will generate a map of the extended model-free space for model 'm5' - consisting of the parameters {S2, S2f, ts}. Files will be output into the - directory 'dx' and will be prefixed by 'map'. In this case, the system is a protein and - residue number 6 will be mapped. - - relax> dx.map(['S2', 'S2f', 'ts'], spin_id=':6') - relax> dx.map(['S2', 'S2f', 'ts'], spin_id=':6', file_prefix='map', dir='dx') - relax> dx.map(params=['S2', 'S2f', 'ts'], spin_id=':6', inc=20, file_prefix='map', dir='dx') - relax> dx.map(params=['S2', 'S2f', 'ts'], spin_id=':6', map_type='Iso3D', inc=20, - file_prefix='map', dir='dx') - - - To map the model-free space 'm4' for residue 2, spin N6 defined by the parameters {S2, te, - Rex}, name the results 'test', and to place the files in the current directory, use one of - the following commands: - - relax> dx.map(['S2', 'te', 'Rex'], spin_id=':2@N6', file_prefix='test', dir=None) - relax> dx.map(params=['S2', 'te', 'Rex'], spin_id=':2@N6', inc=100, file_prefix='test', dir=None) - """ - # Function intro text. if self._exec_info.intro: text = self._exec_info.ps3 + "map(" @@ -198,11 +108,56 @@ # Execute the functional code. opendx.main.map(params=params, map_type=map_type, spin_id=spin_id, inc=inc, lower=lower, upper=upper, axis_incs=axis_incs, file_prefix=file_prefix, dir=dir, point=point, point_file=point_file, remap=remap) + # The function doc info. + map._doc_title = "Create a map of the given space in OpenDX format." + map._doc_title_short = "OpenDX map creation." + map._doc_args = [ + ["params", "The parameters to be mapped. This argument should be an array of strings, the meanings of which are described below."], + ["map_type", "The type of map to create. For example the default, a 3D isosurface, the type is 'Iso3D'. See below for more details."], + ["spin_id", "The spin identification numbe."], + ["inc", "The number of increments to map in each dimension. This value controls the resolution of the map."], + ["lower", "The lower bounds of the space. If you wish to change the lower bounds of the map then supply an array of length equal to the number of parameters in the model. A lower bound for each parameter must be supplied. If nothing is supplied then the defaults will be used."], + ["upper", "The upper bounds of the space. If you wish to change the upper bounds of the map then supply an array of length equal to the number of parameters in the model. A upper bound for each parameter must be supplied. If nothing is supplied then the defaults will be used."], + ["axis_incs", "The number of increments or ticks displaying parameter values along the axes of the OpenDX plot."], + ["file_prefix", "The file name. All the output files are prefixed with this name. The main file containing the data points will be called the value of 'file'. The OpenDX program will be called 'file.net' and the OpenDX import file will be called 'file.general'."], + ["dir", "The directory to output files to. Set this to 'None' if you do not want the files to be placed in subdirectory. If the directory does not exist, it will be created."], + ["point", "An array of parameter values where a point in the map, shown as a red sphere, will be placed. The length must be equal to the number of parameters."], + ["point_file", "The name of that the point output files will be prefixed with."], + ["remap", "A user supplied remapping function. This function will receive the parameter array and must return an array of equal length."] + ] + map._doc_desc = """ + The map type can be changed to one of the following supported map types: + _____________________________________________________________________________ + | | | + | Surface type | Name | + |___________________________________________|_______________________________| + | | | + | 3D isosurface | 'Iso3D' | + |___________________________________________|_______________________________| + """ + map._doc_examples = """ + The following commands will generate a map of the extended model-free space for model 'm5' + consisting of the parameters {S2, S2f, ts}. Files will be output into the + directory 'dx' and will be prefixed by 'map'. In this case, the system is a protein and + residue number 6 will be mapped. - # Docstring modification. - ######################### + relax> dx.map(['S2', 'S2f', 'ts'], spin_id=':6') + relax> dx.map(['S2', 'S2f', 'ts'], spin_id=':6', file_prefix='map', dir='dx') + relax> dx.map(params=['S2', 'S2f', 'ts'], spin_id=':6', inc=20, file_prefix='map', dir='dx') + relax> dx.map(params=['S2', 'S2f', 'ts'], spin_id=':6', map_type='Iso3D', inc=20, + file_prefix='map', dir='dx') - # Write function. - map.__doc__ = map.__doc__ + "\n\n" + docs.regexp.doc + "\n" - map.__doc__ = map.__doc__ + diffusion_tensor.__return_data_name_prompt_doc__ + "\n\n" - map.__doc__ = map.__doc__ + Model_free.return_data_name_doc + "\n\n" + + To map the model-free space 'm4' for residue 2, spin N6 defined by the parameters {S2, te, + Rex}, name the results 'test', and to place the files in the current directory, use one of + the following commands: + + relax> dx.map(['S2', 'te', 'Rex'], spin_id=':2@N6', file_prefix='test', dir=None) + relax> dx.map(params=['S2', 'te', 'Rex'], spin_id=':2@N6', inc=100, file_prefix='test', dir=None) + """ + map._doc_additional = [ + docs.regexp.doc, + diffusion_tensor.__return_data_name_prompt_doc__, + Model_free.return_data_name_doc + ] + _build_doc(map)