Changes in / [882cfec:c926a97] in sasview
- Files:
-
- 12 added
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
docs/sphinx-docs/source/_extensions/dollarmath.py
r2a2fb09 reddf6af5 11 11 12 12 import re 13 _dollar = re.compile(r"(?:^|(?<=\s |[-(]))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[-.,;:?\\)]))")13 _dollar = re.compile(r"(?:^|(?<=\s))[$]([^\n]*?)(?<![\\])[$](?:$|(?=\s|[.,;:?\\()]))") 14 14 _notdollar = re.compile(r"\\[$]") 15 15 -
docs/sphinx-docs/source/conf.py
r3ca67dcf r96f00a0 78 78 # 79 79 # The short X.Y version. 80 version = '4. 2'80 version = '4.1' 81 81 # The full version, including alpha/beta/rc tags. 82 release = '4. 2.0'82 release = '4.1.2' 83 83 84 84 # The language for content autogenerated by Sphinx. Refer to documentation -
setup.py
rae42c85 r36ca21e 428 428 entry_points={ 429 429 'console_scripts': [ 430 "sasview = sas.sasview.sasview:run _gui",430 "sasview = sas.sasview.sasview:run", 431 431 ] 432 432 }, -
src/examples/test_panel2D.py
r20fa5fe r9a5097c 205 205 L=Loader() 206 206 207 #Rec eives data207 #Recieves data 208 208 try: 209 209 output=L.load(path) -
src/sas/sascalc/calculator/instrument.py
rf4775563 r574adc7 314 314 """ 315 315 To plot the wavelength spactrum 316 : requir ement: matplotlib.pyplot316 : requirment: matplotlib.pyplot 317 317 """ 318 318 try: -
src/sas/sascalc/dataloader/file_reader_base_class.py
r20fa5fe rdeaa0c6 85 85 86 86 # Return a list of parsed entries that data_loader can manage 87 final_data = self.output 88 self.reset_state() 89 return final_data 90 91 def reset_state(self): 92 """ 93 Resets the class state to a base case when loading a new data file so previous 94 data files do not appear a second time 95 """ 96 self.current_datainfo = None 97 self.current_dataset = None 98 self.output = [] 87 return self.output 99 88 100 89 def nextline(self): … … 123 112 """ 124 113 Generic error handler to add an error to the current datainfo to 125 prop agate the error up the error chain.114 propogate the error up the error chain. 126 115 :param msg: Error message 127 116 """ … … 325 314 def splitline(line): 326 315 """ 327 Splits a line into pieces based on common delim iters316 Splits a line into pieces based on common delimeters 328 317 :param line: A single line of text 329 318 :return: list of values -
src/sas/sascalc/dataloader/readers/cansas_reader.py
r2469df7 r2b538cd 68 68 data files do not appear a second time 69 69 """ 70 super(Reader, self).reset_state() 70 self.current_datainfo = None 71 self.current_dataset = None 72 self.current_data1d = None 71 73 self.data = [] 72 74 self.process = Process() … … 77 79 self.names = [] 78 80 self.cansas_defaults = {} 81 self.output = [] 79 82 self.ns_list = None 80 83 self.logging = [] … … 82 85 83 86 def read(self, xml_file, schema_path="", invalid=True): 84 if schema_path != "" or not invalid:87 if schema_path != "" or invalid != True: 85 88 # read has been called from self.get_file_contents because xml file doens't conform to schema 86 89 _, self.extension = os.path.splitext(os.path.basename(xml_file)) … … 942 945 pos, "z", datainfo.sample.position.z, 943 946 {"unit": datainfo.sample.position_unit}) 944 if written :947 if written == True: 945 948 self.append(pos, sample) 946 949 … … 955 958 ori, "yaw", datainfo.sample.orientation.z, 956 959 {"unit": datainfo.sample.orientation_unit}) 957 if written :960 if written == True: 958 961 self.append(ori, sample) 959 962 … … 1002 1005 size, "z", datainfo.source.beam_size.z, 1003 1006 {"unit": datainfo.source.beam_size_unit}) 1004 if written :1007 if written == True: 1005 1008 self.append(size, source) 1006 1009 … … 1058 1061 size, "z", aperture.size.z, 1059 1062 {"unit": aperture.size_unit}) 1060 if written :1063 if written == True: 1061 1064 self.append(size, apert) 1062 1065 … … 1081 1084 written = written | self.write_node(det, "SDD", item.distance, 1082 1085 {"unit": item.distance_unit}) 1083 if written :1086 if written == True: 1084 1087 self.append(det, instr) 1085 1088 … … 1091 1094 written = written | self.write_node(off, "z", item.offset.z, 1092 1095 {"unit": item.offset_unit}) 1093 if written :1096 if written == True: 1094 1097 self.append(off, det) 1095 1098 … … 1103 1106 item.orientation.z, 1104 1107 {"unit": item.orientation_unit}) 1105 if written :1108 if written == True: 1106 1109 self.append(ori, det) 1107 1110 … … 1115 1118 item.beam_center.z, 1116 1119 {"unit": item.beam_center_unit}) 1117 if written :1120 if written == True: 1118 1121 self.append(center, det) 1119 1122 … … 1125 1128 written = written | self.write_node(pix, "z", item.pixel_size.z, 1126 1129 {"unit": item.pixel_size_unit}) 1127 if written :1130 if written == True: 1128 1131 self.append(pix, det) 1129 1132 self.write_node(det, "slit_length", item.slit_length, -
src/sas/sascalc/dataloader/readers/cansas_reader_HDF5.py
r61f329f0 r2b538cd 65 65 """ 66 66 # Reinitialize when loading a new data file to reset all class variables 67 self.reset_ state()67 self.reset_class_variables() 68 68 69 69 filename = self.f_open.name … … 101 101 raise FileContentsException("Fewer than 5 data points found.") 102 102 103 def reset_ state(self):103 def reset_class_variables(self): 104 104 """ 105 105 Create the reader object and define initial states for class variables 106 106 """ 107 super(Reader, self).reset_state() 107 self.current_datainfo = None 108 self.current_dataset = None 108 109 self.data1d = [] 109 110 self.data2d = [] … … 111 112 self.errors = set() 112 113 self.logging = [] 114 self.output = [] 113 115 self.parent_class = u'' 114 116 self.detector = Detector() -
src/sas/sascalc/dataloader/readers/danse_reader.py
r2469df7 raf3e9f5 157 157 # Store all data 158 158 # Store wavelength 159 if has_converter and self.current_datainfo.source.wavelength_unit != 'A':159 if has_converter == True and self.current_datainfo.source.wavelength_unit != 'A': 160 160 conv = Converter('A') 161 161 wavelength = conv(wavelength, … … 164 164 165 165 # Store distance 166 if has_converter and detector.distance_unit != 'm':166 if has_converter == True and detector.distance_unit != 'm': 167 167 conv = Converter('m') 168 168 distance = conv(distance, units=detector.distance_unit) … … 170 170 171 171 # Store pixel size 172 if has_converter and detector.pixel_size_unit != 'mm':172 if has_converter == True and detector.pixel_size_unit != 'mm': 173 173 conv = Converter('mm') 174 174 pixel = conv(pixel, units=detector.pixel_size_unit) -
src/sas/sascalc/file_converter/otoko_loader.py
r20fa5fe r0b1a677 36 36 37 37 Given the paths of two header files, this function will load each axis in 38 turn. If loading is successful then an instance of the OTOKOData class38 turn. If loading is successfull then an instance of the OTOKOData class 39 39 will be returned, else an exception will be raised. 40 40 -
src/sas/sascalc/fit/AbstractFitEngine.py
r20fa5fe r574adc7 78 78 def get_params(self, fitparams): 79 79 """ 80 return a list of value of param eter to fit81 82 :param fitparams: list of param eters name to fit80 return a list of value of paramter to fit 81 82 :param fitparams: list of paramaters name to fit 83 83 84 84 """ -
src/sas/sascalc/fit/qsmearing.py
r2469df7 r50fcb09 90 90 #print "data1D.dx[0]",data1D.dx[0],data1D.dxl[0] 91 91 # If we found resolution smearing data, return a QSmearer 92 if _found_resolution :92 if _found_resolution == True: 93 93 return pinhole_smear(data, model) 94 94 … … 113 113 break 114 114 # If we found slit smearing data, return a slit smearer 115 if _found_slit :115 if _found_slit == True: 116 116 return slit_smear(data, model) 117 117 return None -
src/sas/sascalc/pr/c_extensions/Cinvertor.c
ra52f32f rd04ac05 735 735 736 736 const char get_peaks_doc[] = 737 "Returns the number of peaks in the output P(r) distr ibution\n"737 "Returns the number of peaks in the output P(r) distrubution\n" 738 738 "for the given set of coefficients.\n" 739 739 " @param args: c-parameters\n" -
src/sas/sascalc/pr/fit/AbstractFitEngine.py
r20fa5fe r574adc7 78 78 def get_params(self, fitparams): 79 79 """ 80 return a list of value of param eter to fit81 82 :param fitparams: list of param eters name to fit80 return a list of value of paramter to fit 81 82 :param fitparams: list of paramaters name to fit 83 83 84 84 """ -
src/sas/sascalc/pr/invertor.py
r2469df7 rd04ac05 222 222 elif name == 'est_bck': 223 223 value = self.get_est_bck() 224 return value == 1 224 if value == 1: 225 return True 226 else: 227 return False 225 228 elif name in self.__dict__: 226 229 return self.__dict__[name] … … 457 460 458 461 # If we need to fit the background, add a term 459 if self.est_bck :462 if self.est_bck == True: 460 463 nfunc_0 = nfunc 461 464 nfunc += 1 … … 503 506 504 507 # Keep a copy of the last output 505 if not self.est_bck:508 if self.est_bck == False: 506 509 self.out = c 507 510 self.cov = err … … 655 658 file.write("#slit_width=%g\n" % self.slit_width) 656 659 file.write("#background=%g\n" % self.background) 657 if self.est_bck :660 if self.est_bck == True: 658 661 file.write("#has_bck=1\n") 659 662 else: … … 735 738 elif line.startswith('#has_bck='): 736 739 toks = line.split('=') 737 self.est_bck = int(toks[1]) == 1 740 if int(toks[1]) == 1: 741 self.est_bck = True 742 else: 743 self.est_bck = False 738 744 739 745 # Now read in the parameters -
src/sas/sascalc/pr/num_term.py
r2469df7 ra1b8fee 55 55 medi = 0 56 56 for i in range(dv): 57 if odd :57 if odd == True: 58 58 medi = osc[int(med)] 59 59 else: … … 98 98 new_osc3.append(self.osc_list[i]) 99 99 100 if flag9 :100 if flag9 == True: 101 101 self.dataset = new_osc1 102 elif flag8 :102 elif flag8 == True: 103 103 self.dataset = new_osc2 104 104 else: … … 141 141 div = len(nts) 142 142 tem = float(div) / 2.0 143 if self.is_odd(div): 143 odd = self.is_odd(div) 144 if odd == True: 144 145 nt = nts[int(tem)] 145 146 else: … … 147 148 return nt, self.alpha_list[nt - 10], self.mess_list[nt - 10] 148 149 except: 149 #TODO: check the logic above and make sure it doesn't 150 #TODO: check the logic above and make sure it doesn't 150 151 # rely on the try-except. 151 152 return self.nterm_min, self.invertor.alpha, '' -
src/sas/sasgui/guiframe/data_processor.py
r20fa5fe ra1b8fee 758 758 cell pop up context by right clicking on a cell and gives the 759 759 option to cut, paste, and clear. This will probably be removed in 760 future versions and is being super seded by more traditional cut and760 future versions and is being superceded by more traditional cut and 761 761 paste options. 762 762 """ … … 800 800 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 801 801 context menu which is being removed. This will probably be removed in 802 future versions and is being super seded by more traditional cut and802 future versions and is being superceded by more traditional cut and 803 803 paste options 804 804 """ … … 812 812 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 813 813 context menu which is being removed. This will probably be removed in 814 future versions and is being super seded by more traditional cut and814 future versions and is being superceded by more traditional cut and 815 815 paste options 816 816 """ … … 828 828 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 829 829 context menu which is being removed. This will probably be removed in 830 future versions and is being super seded by more traditional cut and830 future versions and is being superceded by more traditional cut and 831 831 paste options 832 832 """ … … 1233 1233 """ 1234 1234 Get object represented by the given cells and plot them. Basically 1235 plot the colum nin y vs the column in x.1235 plot the colum in y vs the column in x. 1236 1236 """ 1237 1237 … … 1961 1961 selection_sizer.Add(self.save_to_file, (iy, ix), 1962 1962 (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 1963 #contruction the sizer conta ining button1963 #contruction the sizer contaning button 1964 1964 button_sizer.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) 1965 1965 -
src/sas/sasgui/guiframe/events.py
r20fa5fe r959eb01 14 14 #create a panel slicer 15 15 (SlicerPanelEvent, EVT_SLICER_PANEL) = wx.lib.newevent.NewEvent() 16 #print update param eers for panel slicer16 #print update paramaters for panel slicer 17 17 (SlicerParamUpdateEvent, EVT_SLICER_PARS_UPDATE) = wx.lib.newevent.NewEvent() 18 18 #update the slicer from the panel -
src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py
r20fa5fe rb963b20 90 90 def can_load_data(self): 91 91 """ 92 if return True, then call handler to l oad data92 if return True, then call handler to laod data 93 93 """ 94 94 return True -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter1D.py
r2469df7 r7432acb 827 827 on_Modify Plot Property_close 828 828 """ 829 if self.appD.okay_clicked :829 if self.appD.okay_clicked == True: 830 830 info = self.appD.get_current_values() 831 831 self.appearance_selected_plot.custom_color = \ -
src/sas/sasgui/guiframe/local_perspectives/plotting/binder.py
r20fa5fe r463e7ffc 359 359 # TODO: Do we need an explicit focus command for keyboard? 360 360 # TODO: Can we tab between items? 361 # TODO: How do unhandled events get prop agated to axes, figure and361 # TODO: How do unhandled events get propogated to axes, figure and 362 362 # TODO: finally to application? Do we need to implement a full tags 363 363 # TODO: architecture a la Tk? -
src/sas/sasgui/guiframe/local_perspectives/plotting/boxSlicer.py
r20fa5fe r7432acb 216 216 """ 217 217 self.base.thaw_axes() 218 # Post param eters218 # Post paramters 219 219 event = SlicerParameterEvent() 220 220 event.type = self.__class__.__name__ -
src/sas/sasgui/guiframe/local_perspectives/plotting/masking.py
r20fa5fe r45dffa69 77 77 def compute(self): 78 78 """ 79 ex ecuting computation79 excuting computation 80 80 """ 81 81 elapsed = time.time() - self.starttime -
src/sas/sasgui/guiframe/plugin_base.py
r20fa5fe r7432acb 82 82 def can_load_data(self): 83 83 """ 84 if return True, then call handler to l oad data84 if return True, then call handler to laod data 85 85 """ 86 86 return False -
src/sas/sasgui/guiframe/proxy.py
r20fa5fe ra1b8fee 17 17 connect() function: 18 18 - auto detects proxy in windows, osx 19 - in ux systems, the http_proxy enviro nment variable must be set19 - in ux systems, the http_proxy enviroment variable must be set 20 20 - if it fails, try to find the proxy.pac address. 21 21 - parses the file, and looks up for all possible proxies -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r20fa5fe ra1b8fee 113 113 def compute(self): 114 114 """ 115 ex ecuting computation115 excuting computation 116 116 """ 117 117 #elapsed = time.time() - self.starttime -
src/sas/sasgui/perspectives/calculator/media/sas_calculator_help.rst
r1b67f3e r5ed76f8 26 26 intensity from the particle is 27 27 28 .. math:: 29 30 I(\vec Q) = \frac{1}{V}\left| 31 \sum_j^N v_j \beta_j \exp(i\vec Q \cdot \vec r_j)\right|^2 28 .. image:: gen_i.png 32 29 33 30 Equation 1. … … 49 46 atomic structure (such as taken from a PDB file) to get the right normalization. 50 47 51 *NOTE! * $\beta_j$ *displayed in the GUI may be incorrect but this will not48 *NOTE! $\beta_j$ displayed in the GUI may be incorrect but this will not 52 49 affect the scattering computation if the correction of the total volume V is made.* 53 50 … … 59 56 ^^^^^^^^^^^^^^^^^^^ 60 57 61 For magnetic scattering, only the magnetization component, $ \mathbf{M}_\perp$,62 perpendicular to the scattering vector $ \vecQ$ contributes to the magnetic58 For magnetic scattering, only the magnetization component, $M_\perp$, 59 perpendicular to the scattering vector $Q$ contributes to the magnetic 63 60 scattering length. 64 61 … … 67 64 The magnetic scattering length density is then 68 65 69 .. math:: 70 71 \beta_M = \frac{\gamma r_0}{2 \mu_B}\sigma \cdot \mathbf{M}_\perp 72 = D_M\sigma \cdot \mathbf{M}_\perp 66 .. image:: dm_eq.png 73 67 74 68 where the gyromagnetic ratio is $\gamma = -1.913$, $\mu_B$ is the Bohr … … 87 81 .. image:: gen_mag_pic.png 88 82 89 Now let us assume that the angles of the $\vec Q$ vector and the spin-axis ($x'$)90 to the $x$-axis are $\phi$ and $\theta_\text{up}$ respectively (see above). Then,83 Now let us assume that the angles of the *Q* vector and the spin-axis (x') 84 to the x-axis are $\phi$ and $\theta_\text{up}$ respectively (see above). Then, 91 85 depending upon the polarization (spin) state of neutrons, the scattering 92 86 length densities, including the nuclear scattering length density ($\beta_N$) … … 95 89 * for non-spin-flips 96 90 97 .. math:: 98 \beta_{\pm\pm} = \beta_N \mp D_M M_{\perp x'} 91 .. image:: sld1.png 99 92 100 93 * for spin-flips 101 94 102 .. math:: 103 \beta_{\pm\mp} = - D_M(M_{\perp y'} \pm i M_{\perp z'}) 95 .. image:: sld2.png 104 96 105 97 where 106 98 107 .. math::99 .. image:: mxp.png 108 100 109 M_{\perp x'} &= M_{0q_x}\cos\theta_\text{up} + M_{0q_y}\sin\theta_\text{up} \\ 110 M_{\perp y'} &= M_{0q_y}\cos\theta_\text{up} - M_{0q_x}\sin\theta_\text{up} \\ 111 M_{\perp z'} &= M_{0z} \\ 112 M_{0q_x} &= (M_{0x}\cos\phi - M_{0y}\sin\phi)\cos\phi \\ 113 M_{0q_y} &= (M_{0y}\sin\phi - M_{0y}\cos\phi)\sin\phi 101 .. image:: myp.png 114 102 115 Here the $M_{0x}$, $M_{0y}$ and $M_{0z}$ are 116 the $x$, $y$ and $z$ components of the magnetisation vector in the 117 laboratory $x$-$y$-$z$ frame. 103 .. image:: mzp.png 104 105 .. image:: mqx.png 106 107 .. image:: mqy.png 108 109 Here the $M0_x$, $M0_y$ and $M0_z$ are the $x$, $y$ and $z$ 110 components of the magnetisation vector in the laboratory $xyz$ frame. 118 111 119 112 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 155 148 uses the Debye equation below providing a 1D output 156 149 157 .. math:: 158 159 I(|\vec Q|) = \frac{1}{V}\sum_j^N v_j\beta_j \sum_k^N v_k \beta_k 160 \frac{\sin(|\vec Q||\vec r_j - \vec r_k|)}{|\vec Q||\vec r_j - \vec r_k|} 150 .. image:: gen_debye_eq.png 161 151 162 152 where $v_j \beta_j \equiv b_j$ is the scattering -
src/sas/sasgui/perspectives/calculator/model_editor.py
r2469df7 r23359ccb 338 338 list_fnames = os.listdir(self.plugin_dir) 339 339 # fake existing regular model name list 340 m_list = [model + ".py" for model in self.model_list]340 m_list = [model.name + ".py" for model in self.model_list] 341 341 list_fnames.append(m_list) 342 342 if t_fname in list_fnames and title != mname: … … 344 344 msg = "Name exists already." 345 345 346 if not self.good_name:346 if self.good_name == False: 347 347 self.name_tcl.SetBackgroundColour('pink') 348 348 info = 'Error' -
src/sas/sasgui/perspectives/calculator/resolcal_thread.py
r20fa5fe r959eb01 44 44 def compute(self): 45 45 """ 46 ex ecuting computation46 excuting computation 47 47 """ 48 48 self.image = map(self.func, self.qx, self.qy, -
src/sas/sasgui/perspectives/fitting/fitproblem.py
r20fa5fe r251ef684 1 1 """ 2 2 Inferface containing information to store data, model, range of data, etc... 3 and retr ieve this information. This is an inferface3 and retreive this information. This is an inferface 4 4 for a fitProblem i.e relationship between data and model. 5 5 """ … … 56 56 """ 57 57 :param flag: bool.When flag is 1 get the computer smear value. When 58 flag is 0 i gnore smear value.58 flag is 0 ingore smear value. 59 59 """ 60 60 self.smearer_enable = flag … … 305 305 """ 306 306 :param flag: bool.When flag is 1 get the computer smear value. When 307 flag is 0 i gnore smear value.307 flag is 0 ingore smear value. 308 308 """ 309 309 self._smear_on = flag -
src/sas/sasgui/perspectives/fitting/fitting.py
r20fa5fe r9706d88 763 763 the current page and set value. 764 764 :param value: integer 0 or 1 765 :param uid: the id related to a page conta ining fitting information765 :param uid: the id related to a page contaning fitting information 766 766 """ 767 767 if uid in self.page_finder.keys(): … … 778 778 Used by simfitpage.py to reset a parameter given the string constrainst. 779 779 780 :param modelname: the name o fthe model for with the parameter780 :param modelname: the name ot the model for with the parameter 781 781 has to reset 782 782 :param value: can be a string in this case. 783 :param names: the param eter name783 :param names: the paramter name 784 784 """ 785 785 sim_page_id = self.sim_page.uid … … 797 797 name into model name and parameter name example: :: 798 798 799 param eterset (item) = M1.A799 paramaterset (item) = M1.A 800 800 Will return model_name = M1 , parameter name = A 801 801 … … 1117 1117 def store_data(self, uid, data_list=None, caption=None): 1118 1118 """ 1119 Rec eive a list of data and store them ans well as a caption of1119 Recieve a list of data and store them ans well as a caption of 1120 1120 the fit page where they come from. 1121 1121 :param uid: if related to a fit page … … 1196 1196 for a given interactor. 1197 1197 1198 :param event: contains type of slicer , param eters for updating1198 :param event: contains type of slicer , paramaters for updating 1199 1199 the panel and panel_name to find the slicer 's panel concerned. 1200 1200 """ -
src/sas/sasgui/perspectives/fitting/fitting_widgets.py
r20fa5fe r959eb01 64 64 selection_sizer.Add(self.data_2d_selected, (iy, ix), 65 65 (1, 1), wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 15) 66 #contruction the sizer conta ining button66 #contruction the sizer contaning button 67 67 button_sizer.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0) 68 68 button_sizer.Add(button_cancel, 0, -
src/sas/sasgui/perspectives/fitting/gpu_options.py
r20fa5fe r3bd677b 88 88 self.option_button = {} 89 89 self.buttons = [] 90 #Check if SAS_OPENCL is already set as enviro nmentvariable90 #Check if SAS_OPENCL is already set as enviromental variable 91 91 self.sas_opencl = os.environ.get("SAS_OPENCL", "") 92 92 -
src/sas/sasgui/perspectives/fitting/simfitpage.py
r20fa5fe r0a3c740 976 976 param_cbox = self.constraints_list[-1].param_cbox 977 977 param_cbox.Clear() 978 # insert only fittable param eters978 # insert only fittable paramaters 979 979 for param in param_list: 980 980 param_cbox.Append(str(param), model) -
src/sas/sasgui/perspectives/invariant/invariant_details.py
r20fa5fe r959eb01 422 422 except: 423 423 scale = RECTANGLE_SCALE 424 self.warning_msg += "Rec eive an invalid scale for %s\n"424 self.warning_msg += "Recieve an invalid scale for %s\n" 425 425 self.warning_msg += "check this value : %s\n" % str(percentage) 426 426 return scale -
src/sas/sasgui/perspectives/invariant/invariant_panel.py
r2469df7 r7432acb 707 707 708 708 # reset power_out to default to get ready for another '_on_text' 709 if self.is_power_out :709 if self.is_power_out == True: 710 710 self.state.container = copy.deepcopy(self.inv_container) 711 711 self.state.timestamp = self._get_time_stamp() -
src/sas/sasgui/perspectives/invariant/invariant_state.py
r2469df7 r1fa4f736 655 655 : return: None 656 656 """ 657 if self.cansas :657 if self.cansas == True: 658 658 return self._read_cansas(path) 659 659 else: … … 763 763 """ 764 764 # Sanity check 765 if self.cansas :765 if self.cansas == True: 766 766 doc = self.write_toXML(datainfo, invstate) 767 767 # Write the XML document -
src/sas/sasgui/perspectives/pr/explore_dialog.py
r20fa5fe r959eb01 93 93 94 94 :TODO: Would be nice to add printing and log/linear scales. 95 The current ver sion of plottools no longer plays well with95 The current verison of plottools no longer plays well with 96 96 plots outside of guiframe. Guiframe team needs to fix this. 97 97 """ -
src/sas/sasgui/perspectives/pr/inversion_state.py
r2469df7 r1fa4f736 389 389 390 390 """ 391 if self.cansas :391 if self.cansas == True: 392 392 return self._read_cansas(path) 393 393 else: … … 505 505 """ 506 506 # Sanity check 507 if self.cansas :507 if self.cansas == True: 508 508 doc = self.write_toXML(datainfo, prstate) 509 509 # Write the XML document -
src/sas/sasgui/perspectives/pr/pr.py
r2469df7 rcb62bd5 407 407 y[i] = value 408 408 409 if self._normalize_output :409 if self._normalize_output == True: 410 410 y = y / total 411 411 dy = dy / total 412 elif self._scale_output_unity :412 elif self._scale_output_unity == True: 413 413 y = y / pmax 414 414 dy = dy / pmax … … 544 544 lines = buff.split('\n') 545 545 for line in lines: 546 if data_started :546 if data_started == True: 547 547 try: 548 548 toks = line.split() -
src/sas/sasgui/plottools/PlotPanel.py
r2469df7 ra1b8fee 476 476 return 477 477 self.mousemotion = True 478 if self.leftdown and self.mousemotion:478 if self.leftdown == True and self.mousemotion == True: 479 479 ax = event.inaxes 480 480 if ax is not None: # the dragging is perform inside the figure -
src/sas/sasgui/plottools/binder.py
r20fa5fe ra1b8fee 366 366 # TODO: Do we need an explicit focus command for keyboard? 367 367 # TODO: Can we tab between items? 368 # TODO: How do unhandled events get prop agated to axes, figure and368 # TODO: How do unhandled events get propogated to axes, figure and 369 369 # TODO: finally to application? Do we need to implement a full tags 370 370 # TODO: architecture a la Tk? -
src/sas/sasgui/plottools/fitDialog.py
r2469df7 r7432acb 44 44 fitting and derives and displays specialized output parameters based 45 45 on the scale choice of the plot calling it. 46 46 47 47 :note1: The fitting is currently a bit convoluted as besides using 48 48 plottools.transform.py to handle all the conversions, it uses … … 55 55 This would considerably simplify the code and remove the need I think 56 56 for LineModel.py and possibly fittins.py altogether. -PDB 7/10/16 57 57 58 58 :note2: The linearized fits do not take resolution into account. This 59 59 means that for poor resolution such as slit smearing the answers will … … 142 142 """ 143 143 144 # set up sizers first. 144 # set up sizers first. 145 145 # vbox is the panel sizer and is a vertical sizer 146 146 # The first element of the panel is sizer which is a gridbagsizer … … 151 151 sizer = wx.GridBagSizer(5, 5) 152 152 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 153 153 154 154 #size of string boxes in pixels 155 155 _BOX_WIDTH = 100 … … 395 395 sizer_button.Add(self.btClose, 0, 396 396 wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10) 397 397 398 398 vbox.Add(sizer) 399 self.static_line_1 = wx.StaticLine(self, -1) 399 self.static_line_1 = wx.StaticLine(self, -1) 400 400 vbox.Add(self.static_line_1, 0, wx.EXPAND, 0) 401 401 vbox.Add(sizer_button, 0, wx.EXPAND | wx.BOTTOM | wx.TOP, 10) … … 439 439 # makes transformation for y as a line to fit 440 440 if self.x != []: 441 if self.checkFitValues(self.xminFit) :441 if self.checkFitValues(self.xminFit) == True: 442 442 # Check if the field of Fit Dialog contain values 443 443 # and use the x max and min of the user -
src/sas/sasgui/plottools/plottable_interactor.py
r2469df7 ra1b8fee 166 166 from within the boundaries of an artist. 167 167 """ 168 if self._context_menu :168 if self._context_menu == True: 169 169 self._context_menu = False 170 170 evt.artist = self.marker … … 216 216 """ 217 217 if not evt.artist.__class__.__name__ == "AxesSubplot": 218 if not self._context_menu:218 if self._context_menu == False: 219 219 self.base.plottable_selected(None) 220 220 try: -
src/sas/sasgui/plottools/plottables.py
r2469df7 r2d9526d 227 227 max_value = None 228 228 for p in self.plottables: 229 if p.hidden :229 if p.hidden == True: 230 230 continue 231 231 if p.x is not None: … … 1062 1062 Renders the plottable on the graph 1063 1063 """ 1064 if self.interactive :1064 if self.interactive == True: 1065 1065 kw['symbol'] = self.symbol 1066 1066 kw['id'] = self.id -
src/sas/sasgui/plottools/toolbar.py
r20fa5fe r959eb01 145 145 def OnPrintPage(self, page): 146 146 """ 147 Most rudimentry OnPrintPage over ride. instatiates a dc object, gets147 Most rudimentry OnPrintPage overide. instatiates a dc object, gets 148 148 its size, gets the size of the figure object, scales it to the dc 149 149 canvas size keeping the aspect ratio intact, then prints as bitmap -
src/sas/sasview/__init__.py
r3ca67dcf r6a88ad9 1 __version__ = "4. 2.0"1 __version__ = "4.1" 2 2 __build__ = "GIT_COMMIT" -
src/sas/sasview/sasview.py
r20fa5fe r0225a3f 203 203 plugin_dir = os.path.join(sas.get_user_dir(), PLUGIN_MODEL_DIR) 204 204 os.environ['SAS_MODELPATH'] = plugin_dir 205 #Initi alize environmentvariable with custom setting but only if variable not set205 #Initiliaze enviromental variable with custom setting but only if variable not set 206 206 SAS_OPENCL = sas.get_custom_config().SAS_OPENCL 207 207 if SAS_OPENCL and "SAS_OPENCL" not in os.environ: -
test/fileconverter/test/utest_nxcansas_writer.py
rc16ffe7 r248ff73 3 3 4 4 import os 5 import pylint 5 6 import unittest 6 7 import warnings -
test/sasdataloader/test/utest_abs_reader.py
rfe15198 r574adc7 20 20 def setUp(self): 21 21 reader = AbsReader() 22 self.data_list= reader.read("jan08002.ABS")23 self.data = self.data_list[0]22 data = reader.read("jan08002.ABS") 23 self.data= data[0] 24 24 25 25 def test_abs_checkdata(self): … … 76 76 def setUp(self): 77 77 reader = DANSEReader() 78 self.data_list= reader.read("MP_New.sans")79 self.data = self.data_list[0]78 data = reader.read("MP_New.sans") 79 self.data = data[0] 80 80 81 81 def test_checkdata(self): … … 87 87 tests won't pass 88 88 """ 89 self.assertEqual(len(self.data_list), 1)90 89 self.assertEqual(self.data.filename, "MP_New.sans") 91 90 self.assertEqual(self.data.meta_data['loader'], "DANSE") … … 115 114 # the generic loader should work as well 116 115 data = Loader().load("MP_New.sans") 117 self.assertEqual(len(data), 1)118 116 self.assertEqual(data[0].meta_data['loader'], "DANSE") 119 117 … … 123 121 def setUp(self): 124 122 reader = CANSASReader() 125 self.data_list= reader.read("cansas1d.xml")126 self.data = self.data_list[0]123 data = reader.read("cansas1d.xml") 124 self.data = data[0] 127 125 128 126 def test_generic_loader(self): 129 127 # the generic loader should work as well 130 128 data = Loader().load("cansas1d.xml") 131 self.assertEqual(len(data), 1)132 129 self.assertEqual(data[0].meta_data['loader'], "CanSAS XML 1D") 133 130 … … 144 141 tests won't pass 145 142 """ 146 self.assertEqual(len(self.data_list), 1)147 143 self.assertEqual(self.data.run[0], "1234") 148 144 self.assertEqual(self.data.meta_data['loader'], "CanSAS XML 1D") … … 285 281 data = Loader().load(filename) 286 282 self.data = data[0] 287 self.assertEqual(len(data), 1)288 283 self.assertEqual(self.data.filename, filename) 289 284 self._checkdata() … … 299 294 data = CANSASReader().read(filename) 300 295 self.data = data[0] 301 self.assertEqual(len(data), 1)302 296 self.assertEqual(self.data.filename, filename) 303 297 self._checkdata() … … 311 305 data = CANSASReader().read(filename) 312 306 self.data = data[0] 313 self.assertEqual(len(data), 1)314 307 self.assertEqual(self.data.filename, filename) 315 308 # The followed should not have been loaded … … 328 321 data = CANSASReader().read(filename) 329 322 self.data = data[0] 330 self.assertEqual(len(data), 1)331 self.assertEqual(len(self.data_list), 1)332 323 self.assertEqual(self.data.filename, filename) 333 324 self.assertEqual(self.data.run[0], "1234") -
test/sasdataloader/test/utest_ascii.py
rfe15198 ra78a02f 29 29 """ 30 30 # The length of the data is 10 31 self.assertEqual(len(self.f1_list), 1)32 self.assertEqual(len(self.f2_list), 1)33 self.assertEqual(len(self.f3_list), 1)34 self.assertEqual(len(self.f4_list), 1)35 self.assertEqual(len(self.f5_list), 1)36 31 self.assertEqual(len(self.f1.x), 10) 37 32 self.assertEqual(self.f1.x[0],0.002618) -
test/sasdataloader/test/utest_averaging.py
rfe15198 r2a52b0e 104 104 filepath = os.path.join(os.path.dirname( 105 105 os.path.realpath(__file__)), 'MAR07232_rest.h5') 106 self.data_list = Loader().load(filepath) 107 self.data = self.data_list[0] 106 self.data = Loader().load(filepath)[0] 108 107 109 108 def test_ring(self): … … 120 119 filepath = os.path.join(os.path.dirname( 121 120 os.path.realpath(__file__)), 'ring_testdata.txt') 122 answer_list = Loader().load(filepath) 123 answer = answer_list[0] 124 125 self.assertEqual(len(answer_list), 1) 121 answer = Loader().load(filepath)[0] 122 126 123 for i in range(r.nbins_phi - 1): 127 124 self.assertAlmostEqual(o.x[i + 1], answer.x[i], 4) -
test/sasdataloader/test/utest_generic_file_reader_class.py
r3648cbf rbeba407 17 17 18 18 def setUp(self): 19 self.reader = TestFileReader()19 self.reader = FileReader() 20 20 self.bad_file = "ACB123.txt" 21 21 self.good_file = "123ABC.txt" 22 self.msg = "Unable to find file at: {}\n".format(self.bad_file) 23 self.msg += "Please check your file path and try again." 24 x = np.zeros(0) 25 y = np.zeros(0) 26 self.reader.current_dataset = plottable_1D(x, y) 27 self.reader.current_datainfo = DataInfo() 28 self.reader.send_to_output() 22 29 23 30 def test_bad_file_path(self): 24 31 output = self.reader.read(self.bad_file) 25 self.assertEqual(output, []) 32 self.assertEqual(len(output[0].errors), 1) 33 self.assertEqual(output[0].errors[0], self.msg) 26 34 27 35 def test_good_file_path(self): 28 f = open(self.good_file, 'w') 29 f.write('123ABC exists!') 30 f.close() 36 f_open = open(self.good_file, 'w') 37 f_open.close() 31 38 output = self.reader.read(self.good_file) 32 self.assertEqual(len(output ), 1)33 self.assertEqual(output[0]. meta_data["blah"], '123ABC exists!')39 self.assertEqual(len(output[0].errors), 1) 40 self.assertEqual(output[0].errors[0], self.msg) 34 41 35 42 def tearDown(self): … … 38 45 if os.path.isfile(self.good_file): 39 46 os.remove(self.good_file) 40 41 class TestFileReader(FileReader):42 def get_file_contents(self):43 """44 Reader specific class to access the contents of the file45 All reader classes that inherit from FileReader must implement46 """47 x = np.zeros(0)48 y = np.zeros(0)49 self.current_dataset = plottable_1D(x,y)50 self.current_datainfo = DataInfo()51 self.current_datainfo.meta_data["blah"] = self.nextline()52 self.send_to_output() -
test/sasdataloader/test/utest_red2d_reader.py
rfe15198 r248ff73 14 14 def setUp(self): 15 15 self.loader = Loader() 16 self.data_list = self.loader.load("exp18_14_igor_2dqxqy.dat")17 16 18 17 def test_checkdata(self): … … 20 19 Test .DAT file loaded as IGOR/DAT 2D Q_map 21 20 """ 22 f = self. data_list[0]21 f = self.loader.load("exp18_14_igor_2dqxqy.dat")[0] 23 22 # The length of the data is 10 24 self.assertEqual(len(self.data_list), 1)25 23 self.assertEqual(len(f.qx_data), 36864) 26 24 self.assertEqual(f.qx_data[0],-0.03573497) -
test/sasdataloader/test/utest_sesans.py
rfe15198 ra78a02f 22 22 f = file[0] 23 23 # self.assertEqual(f, 5) 24 self.assertEqual(len(file), 1)25 24 self.assertEqual(len(f.x), 40) 26 25 self.assertEqual(f.x[0], 391.56) … … 40 39 file = self.loader("sesans_examples/sphere_isis.ses") 41 40 f = file[0] 42 self.assertEqual(len(file), 1)43 41 self.assertEqual(len(f.x), 57) 44 42 self.assertEqual(f.x[-1], 19303.4)
Note: See TracChangeset
for help on using the changeset viewer.