Changeset aab8ad7 in sasview
- Timestamp:
- Sep 14, 2008 10:11:00 AM (16 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 14d05ba
- Parents:
- c7bc3e7
- Location:
- prview
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
prview/perspectives/pr/pr.py
rf1181977 raab8ad7 11 11 import math, numpy 12 12 from sans.pr.invertor import Invertor 13 from DataLoader.loader import Loader 13 14 14 15 PR_FIT_LABEL = r"$P_{fit}(r)$" … … 344 345 by our standard DataLoader class. 345 346 """ 346 #TODO: use DataLoader347 347 class FileData: 348 348 x = None … … 355 355 356 356 self._current_file_data = FileData(path) 357 basename = os.path.basename(path) 358 root, ext = os.path.splitext(basename) 359 if ext.lower()=='.abs': 360 x, y, err = self.load_abs(path) 361 362 else: 363 x, y, err = self.load_columns(path) 364 357 358 # Use data loader to load file 359 dataread = Loader().load(path) 360 x = None 361 y = None 362 err = None 363 if dataread.__class__.__name__ == 'Data1D': 364 x = dataread.x 365 y = dataread.y 366 err = dataread.dy 367 else: 368 raise RuntimeError, "This tool can only read 1D data" 369 365 370 self._current_file_data.x = x 366 371 self._current_file_data.y = y … … 874 879 @param path: path of the file to read in 875 880 """ 876 from sans.guiframe.data_loader import load_ascii_1D877 import numpy878 879 881 # Load data 880 882 if os.path.isfile(path): … … 882 884 if self._current_file_data is not None \ 883 885 and self._current_file_data.path==path: 886 # Protect against corrupted data from 887 # previous failed load attempt 888 if self._current_file_data.x is None: 889 return None 884 890 x = self._current_file_data.x 885 891 y = self._current_file_data.y … … 887 893 else: 888 894 x, y, err = self.load(path) 889 #x, y, err = load_ascii_1D(path)890 895 891 896 # If we have not errors, add statistical errors 892 if err==None :897 if err==None and y is not None: 893 898 err = numpy.zeros(len(y)) 899 scale = None 900 min_err = 0.0 894 901 for i in range(len(y)): 895 err[i] = math.sqrt( math.fabs(y[i]) ) 902 # Scale the error so that we can fit over several decades of Q 903 if scale==None: 904 scale = 0.05*math.sqrt(y[i]) 905 min_err = 0.01*y[i] 906 err[i] = scale*math.sqrt( math.fabs(y[i]) ) + min_err 896 907 message = "The loaded file had no error bars, statistical errors are assumed." 897 908 wx.PostEvent(self.parent, StatusEvent(status=message)) … … 899 910 wx.PostEvent(self.parent, StatusEvent(status='')) 900 911 901 # Get the data from the chosen data set and perform inversion 902 pr = Invertor() 903 pr.d_max = self.max_length 904 pr.alpha = self.alpha 905 pr.q_min = self.q_min 906 pr.q_max = self.q_max 907 pr.x = x 908 pr.y = y 909 pr.err = err 910 pr.has_bck = self.has_bck 911 pr.slit_height = self.slit_height 912 pr.slit_width = self.slit_width 913 return pr 912 try: 913 # Get the data from the chosen data set and perform inversion 914 pr = Invertor() 915 pr.d_max = self.max_length 916 pr.alpha = self.alpha 917 pr.q_min = self.q_min 918 pr.q_max = self.q_max 919 pr.x = x 920 pr.y = y 921 pr.err = err 922 pr.has_bck = self.has_bck 923 pr.slit_height = self.slit_height 924 pr.slit_width = self.slit_width 925 return pr 926 except: 927 wx.PostEvent(self.parent, StatusEvent(status="Problem reading data: %s" % sys.exc_value)) 914 928 return None 915 929 -
prview/release_notes.txt
rea5551f raab8ad7 4 4 PrView 0.2 5 5 6 Package name: None6 Package name: prview 7 7 8 8 1- Version 0.2.x … … 11 11 - Fixed problem with loading additional data after the P(r) graph's scale has been changed. 12 12 - Fixed problem of silent failure upon loading a file with a point at Q=0. 13 13 - Added use of SANS DataLoader 14 15 Version 0.2.3 16 - Release date: 7/9/2008 17 - Mac compatibility 18 14 19 Version 0.2.2 15 16 20 - Release date: 7/8/2008 17 21 - Added option to normalize P(r) to 1, scale P_max to 1, or leave as is. … … 26 30 - Constant background estimation. 27 31 - Functionality to compare p(r) output with data from a file. 28 - Functionality to change the number of p(r) points of the output d sitribution.32 - Functionality to change the number of p(r) points of the output distribution. 29 33 30 34 Version 0.1.0 … … 46 50 svn://danse.us/sans/releases/pr_inversion-0.2.1 47 51 - The following modules are required: 48 * matplotlib 0.91.4 (avoid 0.98.1)52 * matplotlib 49 53 * numpy 50 54 * scipy … … 54 58 55 59 3.1- All systems: 56 Version 0.2.2: 57 - The application only loads .txt files. The expected format is 2- or 3-column ascii. 58 - More than a single additional data set should be plottable on the P(r) graph. 59 - Additional data plotted on the P(r) graph should also be normalizable. 60 - If additional P(r) data is loaded after a scale change has been done, the loaded data appears in another window rather than on the same graph. If additional P(r) data is loaded while the scale of the P(r) graph is linear, the behavior is correct. 61 - The application will not load data files with a point at Q=0. The user will not be notified. 62 60 - None 63 61 64 62 3.2- Windows: 65 63 - None 66 64 67 3.3- Linux:68 - None65 3.3- Mac OS: 66 - Context menu dialog interfere with dragging when displayed over plots. 69 67 70 68 4- Troubleshooting
Note: See TracChangeset
for help on using the changeset viewer.