Author: tlinnet Date: Fri May 9 18:57:37 2014 New Revision: 23139 URL: http://svn.gna.org/viewcvs/relax?rev=23139&view=rev Log: Now saves all chi2 values, to better find reasonable chi level for the Innermost, Inner, Middle and Outer Isosurface.
task #7792: (https://gna.org/task/?7792) Make the dx.map write suggest chi surface values. Modified: trunk/lib/software/opendx/files.py trunk/pipe_control/opendx.py Modified: trunk/lib/software/opendx/files.py URL: http://svn.gna.org/viewcvs/relax/trunk/lib/software/opendx/files.py?rev=23139&r1=23138&r2=23139&view=diff ============================================================================== --- trunk/lib/software/opendx/files.py (original) +++ trunk/lib/software/opendx/files.py Fri May 9 18:57:37 2014 @@ -184,7 +184,7 @@ point_file_general.close() -def write_program(file_prefix=None, point_file=None, dir=None, inc=None, N=None, num_points=None, labels=None, tick_locations=None, tick_values=None, date=None, min_chi2=7.0, max_chi2=500.0, median_chi2=100.0): +def write_program(file_prefix=None, point_file=None, dir=None, inc=None, N=None, num_points=None, labels=None, tick_locations=None, tick_values=None, date=None, chi_surface=[7.0, 20.0, 100.0, 500.0]): """Create the OpenDX .net program file. @keyword file_prefix: The base part of the file name without extension. @@ -207,12 +207,8 @@ @type tick_values: str @keyword date: The date string to include in the configuration. @type date: str - @keyword min_chi2: The minimum Chi-squared value found when creating the map. This will set the Innermost Isosurface value. - @type float: float - @keyword max_chi2: The maxium Chi-squared value found when creating the map. This will set the Outer Isosurface value. - @type float: float - @keyword median_chi2: The median Chi-squared value found when creating the map. This will set the Middle Isosurface value. - @type float: float + @keyword chi_surface: Chi2 surface level for the Innermost, Inner, Middle and Outer Isosurface. + @type chi_surface: list of 4 floats """ # Print out. @@ -238,19 +234,8 @@ image_array2 = "[%s %s %s]" % (0.6 * (inc + 1.0), 0.3 * (inc + 1.0), 6.0 * (inc + 1.0)) image_val = repr(3.0 * (inc + 1.0)) - # Setting the default values for the 4 isosurfaces. - # For Innermost Isosurface, let it be the min chi2 value. - innermost_isosurface_value = min_chi2 - - # For Outer Isosurface, let it be max chi2 value, round to ceiling of first 3 digits. - nr_digits = len((str(max_chi2).split(".")[0])) - 3 - outer_isosurface_value = ceil(max_chi2/(10**nr_digits) )*(10**nr_digits) - - # For the Middle Isosurface, let it be the median value of chi2. - middle_isosurface_value = median_chi2 - - # For the Inner Isosurface, let it be the median value between Innermost Isosurface and Middle Isosurface. - inner_isosurface_value = median([innermost_isosurface_value, middle_isosurface_value]) + # Unpacking the values for the 4 isosurfaces. + innermost_isosurface_value, inner_isosurface_value, middle_isosurface_value, outer_isosurface_value = chi_surface # Generate the text of the program. ################################### Modified: trunk/pipe_control/opendx.py URL: http://svn.gna.org/viewcvs/relax/trunk/pipe_control/opendx.py?rev=23139&r1=23138&r2=23139&view=diff ============================================================================== --- trunk/pipe_control/opendx.py (original) +++ trunk/pipe_control/opendx.py Fri May 9 18:57:37 2014 @@ -161,8 +161,12 @@ # Generate the map. self.create_map() + # Default the chi2 surface values, for Innermost, Inner, Middle and Outer Isosurface. + if chi_surface == None: + chi_surface = [7.0, 20.0, 100.0, 500.0] + # Create the OpenDX .net program file. - write_program(file_prefix=self.file_prefix, point_file=self.point_file, dir=self.dir, inc=self.inc, N=self.n, num_points=self.num_points, labels=self.labels, tick_locations=self.tick_locations, tick_values=self.tick_values, date=self.date, min_chi2=self.min_chi2, max_chi2=self.max_chi2, median_chi2=self.median_chi2) + write_program(file_prefix=self.file_prefix, point_file=self.point_file, dir=self.dir, inc=self.inc, N=self.n, num_points=self.num_points, labels=self.labels, tick_locations=self.tick_locations, tick_values=self.tick_values, date=self.date, chi_surface = chi_surface) # Create the OpenDX .cfg program configuration file. write_config(file_prefix=self.file_prefix, dir=self.dir, date=self.date) @@ -206,9 +210,7 @@ percent_inc = 100.0 / (self.inc + 1.0)**(self.n - 1.0) print("%-10s%8.3f%-1s" % ("Progress:", percent, "%")) - # Define min/max chi2 values. - min_chi2 = 1e20 - max_chi2 = 1. + # Collect all chi2, to help finding a reasobale chi level for the Innermost, Inner, Middle and Outer Isosurface. all_chi = [] # Fix the diffusion tensor. @@ -256,13 +258,8 @@ else: map_file.write("%30f\n" % chi2) - # Save min and max values of chi2. + # Save all values of chi2. To help find reasonale level for the Innermost, Inner, Middle and Outer Isosurface. all_chi.append(chi2) - if chi2 < min_chi2: - min_chi2 = chi2 - - if chi2 > max_chi2: - max_chi2 = chi2 # Increment the value of the third parameter. values[2] = values[2] + self.step_size[2] @@ -281,11 +278,8 @@ if unfix: cdp.diff_tensor.fixed = False - # Save the min/max chi2 values. - self.min_chi2 = min_chi2 - self.max_chi2 = max_chi2 - # Save the median chi2 value. - self.median_chi2 = median(array(all_chi)) + # Save all chi2 values. + self.all_chi = all_chi def map_axes(self): """Function for creating labels, tick locations, and tick values for an OpenDX map.""" _______________________________________________ relax (http://www.nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits