1   
  2   
  3   
  4   
  5   
  6   
  7   
  8   
  9   
 10   
 11   
 12   
 13   
 14   
 15   
 16   
 17   
 18   
 19   
 20   
 21   
 22   
 23   
 24  """Module containing the functions which interface relax with OpenDX.""" 
 25   
 26   
 27   
 28  from os import system 
 29  import string 
 30   
 31   
 32  import isosurface_3D 
 33  from relax_errors import RelaxError 
 34  from relax_io import test_binary 
 35   
 36   
 37 -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): 
  38      """Map the space corresponding to the spin identifier and create the OpenDX files. 
 39   
 40      @keyword params:         
 41      @type params:            
 42      @keyword map_type:      The type of map to create.  The available options are: 
 43                                  - 'Iso3D', a 3D isosurface visualisation of the space. 
 44      @type map_type:         str 
 45      @keyword spin_id:       The spin identification string. 
 46      @type spin_id:          str 
 47      @keyword inc:           The resolution of the plot.  This is the number of increments per 
 48                              dimension. 
 49      @type inc:              int 
 50      @keyword lower:         The lower bounds of the space to map.  If supplied, this should be a 
 51                              list of floats, its length equal to the number of parameters in the 
 52                              model. 
 53      @type lower:            None or list of float 
 54      @keyword upper:         The upper bounds of the space to map.  If supplied, this should be a 
 55                              list of floats, its length equal to the number of parameters in the 
 56                              model. 
 57      @type upper:            None or list of float 
 58      @keyword axis_incs:     The number of tick marks to display in the OpenDX plot in each 
 59                              dimension. 
 60      @type axis_incs:        int 
 61      @keyword file_prefix:   The file prefix for all the created files. 
 62      @type file_prefix:      str 
 63      @keyword dir:           The directory to place the files into. 
 64      @type dir:              str or None 
 65      @keyword point:         If supplied, a red sphere will be placed at these coordinates. 
 66      @type point:            None or list of float 
 67      @keyword point_file:    The file prefix for the point output files. 
 68      @type point_file:       str or None 
 69      @keyword remap:         A function which is used to remap the space.  The function should accept 
 70                              the parameter array (list of float) and return an array of equal length 
 71                              (again list of float). 
 72      @type remap:            None or func 
 73      """ 
 74   
 75       
 76      if string.lower(map_type) == "iso3d": 
 77          if len(params) != 3: 
 78              raise RelaxError("The 3D isosurface map requires a 3 parameter model.") 
 79   
 80           
 81          isosurface_3D.Iso3D(params, spin_id, inc, lower, upper, axis_incs, file_prefix, dir, point, point_file, remap) 
 82      else: 
 83          raise RelaxError("The map type '" + map_type + "' is not supported.") 
  84   
 85   
 86 -def run(file_prefix="map", dir="dx", dx_exe="dx", vp_exec=True): 
  87      """Execute OpenDX. 
 88   
 89      @keyword file_prefix:   The file prefix for all the created files. 
 90      @type file_prefix:      str 
 91      @keyword dir:           The directory to place the files into. 
 92      @type dir:              str or None 
 93      @keyword dx_exe:        The path to the OpenDX executable file.  This can be changed if the 
 94                              binary 'dx' is not located in the system path. 
 95      @type dx_exe:           str 
 96      @keyword vp_exec:       If True, then the OpenDX visual program will be launched. 
 97      @type vp_exec:          bool 
 98      """ 
 99   
100       
101      dir_text = "" 
102      if dir != None: 
103          dir_text = " -directory " + dir 
104   
105       
106      execute_text = "" 
107      if vp_exec: 
108          execute_text = " -execute" 
109   
110       
111      test_binary(dx_exe) 
112   
113       
114      system(dx_exe + dir_text + " -program " + file_prefix + ".net" + execute_text + " &") 
 115