Changes in / [e9e3e38:ae2a197] in sasview
- Location:
- src/sas
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/guiframe/data_processor.py
ra12c0a6 r44d20af 9 9 10 10 The organization of the classes goes as: 11 .. image:: media/BatchGridClassLayout.png 11 12 .. image:: ../../user/guiframe/BatchGridClassLayout.png 12 13 :align: center 13 14 … … 37 38 """ 38 39 Object describing a cell in the grid. 39 40 40 """ 41 41 def __init__(self): 42 42 """ 43 43 Initialize attributes of class (label, value, col, row, object) 44 45 44 """ 46 45 self.label = "" … … 54 53 """ 55 54 Return a dictionary of column label and index or row selected 56 55 57 56 :param sentence: String to parse 58 57 :param list: list of columns label 59 58 :returns: col_dict 60 59 """ 61 60 … … 116 115 117 116 class GridCellEditor(sheet.CCellEditor): 118 """ 117 """ 119 118 Custom cell editor 120 119 121 120 This subclasses the sheet.CCellEditor (itself a subclass of 122 121 grid.GridCellEditor) in order to override two of its methods: … … 125 124 This is necessary as the sheet module is broken in wx 3.0.2 and 126 125 improperly subclasses grid.GridCellEditor 127 128 126 """ 129 127 def __init__(self, grid): 130 128 """ 131 129 Override of CCellEditor init. Runs the grid.GridCellEditor init code 132 133 130 """ 134 131 super(GridCellEditor, self).__init__(grid) 135 132 136 133 def PaintBackground(self, dc, rect, attr): 137 """ 134 """ 138 135 Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 139 136 the base class method. 140 137 141 138 In wx3.0 all paint objects must explicitly 142 139 have a wxPaintDC (Device Context) object. Thus the paint event which … … 145 142 not updated to reflect this and hence fails. This could thus 146 143 become obsolete in a future bug fix of wxPython. 147 144 148 145 Apart from adding a dc variable in the list of arguments in the def 149 146 and in the call to the base class the rest of this method is copied 150 147 as is from sheet.CCellEditor.PaintBackground 151 152 :param dc: the wxDC object for the paint153 ------- 148 149 **From original GridCellEditor docs:** 150 154 151 Draws the part of the cell not occupied by the edit control. The 155 152 base class version just fills it with background colour from the … … 159 156 to do something out of the ordinary. 160 157 158 :param dc: the wxDC object for the paint 161 159 """ 162 160 # Call base class method. … … 165 163 166 164 def EndEdit(self, row, col, grid, previous): 167 """ 165 """ 168 166 Commit editing the current cell. Returns True if the value has changed. 169 167 170 168 :param previous: previous value in the cell 171 172 169 """ 173 170 changed = False # Assume value not changed … … 184 181 """ 185 182 Class that receives the results of a batch fit. 186 183 187 184 GridPage displays the received results in a wx.grid using sheet. This is 188 185 then used by GridPanel and GridFrame to present the full GUI. 189 190 186 """ 191 187 def __init__(self, parent, panel=None): 192 188 """ 193 189 Initialize 194 190 195 191 Initialize all the attributes of GridPage, and the events. include 196 192 the init stuff from sheet.CSheet as well. 197 198 193 """ 199 194 #sheet.CSheet.__init__(self, parent) 200 195 201 196 # The following is the __init__ from CSheet. ########################## 202 197 # We re-write it here because the class is broken in wx 3.0, … … 243 238 # CSheet init method. Basically these override any intrinsic binding 244 239 self.Bind(wx.grid.EVT_GRID_LABEL_RIGHT_CLICK, self.on_right_click) 245 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 240 self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 246 241 247 242 self.AdjustScrollbars() … … 283 278 if self.GetNumberCols() > 0: 284 279 self.default_col_width = self.GetColSize(0) 285 # We have moved these to the top of the init section with the 286 # rest of the grid event bindings from the sheet init when 280 # We have moved these to the top of the init section with the 281 # rest of the grid event bindings from the sheet init when 287 282 # appropriate 288 283 #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) … … 295 290 """ 296 291 Overrides sheet.CSheet.OnLefClick. 297 292 298 293 Processes when a cell is selected by left clicking on that cell. First 299 294 process the base Sheet method then the current class specific method 300 301 295 """ 302 296 sheet.CSheet.OnLeftClick(self, event) 303 297 self.on_selected_cell(event) 304 298 305 299 306 300 def OnCellChange(self, event): 307 301 """ 308 302 Overrides sheet.CSheet.OnCellChange. 309 303 310 304 Processes when a cell has been edited by a cell editor. Checks for the 311 305 edited row being outside the max row to use attribute and if so updates 312 the last row. Then calls the base handler using skip. 313 306 the last row. Then calls the base handler using skip. 314 307 """ 315 308 row, _ = event.GetRow(), event.GetCol() … … 323 316 """ 324 317 Handler catching cell selection. 325 318 326 319 Called after calling base 'on left click' method. 327 328 320 """ 329 321 … … 398 390 """ 399 391 Is triggered when the left mouse button is clicked while the mouse 400 is hovering over the column 'label.' 401 392 is hovering over the column 'label.' 393 402 394 This processes the information on the selected column: the column name 403 395 (in row 0 of column) and the range of cells with a valid value to be 404 396 used by the GridPanel set_axis methods. 405 406 """ 407 397 """ 398 408 399 flag = event.CmdDown() or event.ControlDown() 409 400 … … 449 440 """ 450 441 Is triggered when the right mouse button is clicked while the mouse 451 is hovering over the column 'label.' 452 442 is hovering over the column 'label.' 443 453 444 This brings up a context menu that allows the deletion of the column, 454 or the insertion of a new column either to the right or left of the 445 or the insertion of a new column either to the right or left of the 455 446 current column. If inserting a new column can insert a blank column or 456 447 choose a number of hidden columns. By default all the error parameters … … 458 449 intrinsic variables stored with the data such as Temperature, pressure, 459 450 time etc can be used to populate this menu. 460 461 """ 462 451 """ 452 463 453 col = event.GetCol() 464 454 row = event.GetRow() … … 497 487 method called to populate the 'insert column before current column' 498 488 submenu. 499 500 """ 501 489 """ 490 502 491 if self.data is None: 503 492 return … … 521 510 Method called to populate the 'insert column after current column' 522 511 submenu 523 524 """ 525 512 """ 513 526 514 if self.data is None: 527 515 return … … 546 534 Called when user chooses remove from the column right click menu 547 535 Checks the columnn exists then calls the remove_column method 548 549 """ 550 536 """ 537 551 538 if self.selected_cols is not None or len(self.selected_cols) > 0: 552 539 col = self.selected_cols[0] … … 556 543 """ 557 544 Remove the col column from the current grid 558 559 """ 560 545 """ 546 561 547 # add data to the grid 562 548 row = 0 … … 581 567 of the column context menu obtained when right clicking on a given 582 568 column header. 583 569 584 570 Sets up to insert column into the current grid before the current 585 571 highlighted column location and sets up what to populate that column 586 572 with. Then calls insert_column method to actually do the insertion. 587 588 """ 589 573 """ 574 590 575 if self.selected_cols is not None or len(self.selected_cols) > 0: 591 576 col = self.selected_cols[0] … … 602 587 Called when user chooses insert 'column after' submenu 603 588 of the column context menu obtained when right clicking on a given 604 column header. 605 589 column header. 590 606 591 Sets up to insert column into the current grid after the current 607 592 highlighted column location and sets up what to populate that column 608 593 with. Then calls insert_column method to actually do the insertion. 609 610 """ 611 594 """ 595 612 596 if self.selected_cols is not None or len(self.selected_cols) > 0: 613 597 col = self.selected_cols[0] + 1 … … 623 607 Insert column at position col with data[col_name] into the current 624 608 grid. 625 626 """ 627 609 """ 610 628 611 row = 0 629 612 self.InsertCols(pos=col, numCols=1, updateLabels=True) … … 648 631 """ 649 632 Just calls the panel version of the method 650 651 """ 652 633 """ 634 653 635 self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 654 636 … … 656 638 """ 657 639 Just calls the panel version of the method 658 659 """ 640 """ 641 660 642 self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) 661 643 … … 663 645 """ 664 646 Add data to the grid 665 647 666 648 :param data_inputs: data to use from the context menu of the grid 667 :param data_ouputs: default columns deplayed 668 669 """ 670 649 :param data_ouputs: default columns displayed 650 """ 651 671 652 self.file_name = file_name 672 653 self.details = details … … 704 685 """ 705 686 Set the values in grids 706 707 """ 708 687 """ 688 709 689 # add data to the grid 710 690 row = 0 … … 741 721 """ 742 722 Return value contained in the grid 743 744 """ 745 723 """ 724 746 725 grid_view = {} 747 726 for col in xrange(self.GetNumberCols()): … … 761 740 """ 762 741 Return number of total rows 763 764 742 """ 765 743 return self._rows … … 768 746 """ 769 747 Method to handle cell right click context menu. 770 748 771 749 THIS METHOD IS NOT CURRENTLY USED. It is designed to provide a 772 750 cell pop up context by right clicking on a cell and gives the … … 774 752 future versions and is being superceded by more traditional cut and 775 753 paste options. 776 777 """ 778 754 """ 755 779 756 wx_id = wx.NewId() 780 757 c_menu = wx.Menu() … … 817 794 future versions and is being superceded by more traditional cut and 818 795 paste options 819 820 796 """ 821 797 … … 825 801 """ 826 802 Called when paste is chosen from cell right click context menu 827 803 828 804 THIS METHOD IS NOT CURRENTLY USED. it is part of right click cell 829 805 context menu which is being removed. This will probably be removed in 830 806 future versions and is being superceded by more traditional cut and 831 807 paste options 832 833 808 """ 834 809 … … 847 822 future versions and is being superceded by more traditional cut and 848 823 paste options 849 850 824 """ 851 825 … … 857 831 window_name = "Fit panel" 858 832 ## Title to appear on top of the window 859 860 833 """ 861 834 862 835 window_caption = "Notebook " 863 836 … … 898 871 display the close button on the tab if more than 1 tab exits. 899 872 Otherwise remove the close button 900 901 873 """ 902 874 … … 918 890 Return the select cell range from a given selected column. Checks that 919 891 all cells are from the same column 920 921 892 """ 922 893 … … 949 920 """ 950 921 Add highlight rows 951 952 922 """ 953 923 … … 980 950 """ 981 951 return dictionary of columns labels on the current page 982 983 952 """ 984 953 … … 996 965 Receive a list of cells and create a string presenting the selected 997 966 cells that can be used as data for one axis of a plot. 998 967 999 968 :param cell_list: list of tuple 1000 1001 969 """ 1002 970 pos = self.GetSelection() … … 1075 1043 """ 1076 1044 close the page 1077 1078 1045 """ 1079 1046 … … 1109 1076 Order a list of 'inputs.' Used to sort rows and columns to present 1110 1077 in batch results grid. 1111 1112 1078 """ 1113 1079 … … 1143 1109 """ 1144 1110 Append a new column to the grid 1145 1146 1111 """ 1147 1112 … … 1155 1120 """ 1156 1121 Remove the selected column from the grid 1157 1158 1122 """ 1159 1123 # I Believe this is no longer used now that we have removed the … … 1166 1130 """ 1167 1131 A ScrolledPanel class that contains the grid sheet as well as a number of 1168 widgets to create interesting plots and buttons for help etc. 1169 1132 widgets to create interesting plots and buttons for help etc. 1170 1133 """ 1171 1134 … … 1174 1137 """ 1175 1138 Initialize the GridPanel 1176 1177 1139 """ 1178 1140 … … 1264 1226 Get object represented by the given cells and plot them. Basically 1265 1227 plot the colum in y vs the column in x. 1266 1267 1228 """ 1268 1229 … … 1345 1306 """ 1346 1307 Evaluate the contains of textcrtl and plot result 1347 1348 1308 """ 1349 1309 … … 1456 1416 1457 1417 :param evt: Triggers on clicking the help button 1458 1459 1418 """ 1460 1419 … … 1471 1430 """ 1472 1431 Get sentence from dict 1473 1474 1432 """ 1475 1433 … … 1488 1446 Draw the area related to the grid by adding it as the first element 1489 1447 in the panel's grid_sizer 1490 1491 1448 """ 1492 1449 … … 1499 1456 Add the area containing all the plot options, buttons etc to a plotting 1500 1457 area sizer to later be added to the top level grid_sizer 1501 1502 1458 """ 1503 1459 … … 1543 1499 (self.plot_button, 0, 1544 1500 wx.LEFT | wx.TOP | wx.BOTTOM, 12), 1545 (self.help_button,0, 1501 (self.help_button,0, 1546 1502 wx.LEFT | wx.TOP | wx.BOTTOM, 12)]) 1547 1503 … … 1577 1533 """ 1578 1534 Get the selected column on the visible grid and set values for axis 1579 1580 1535 """ 1581 1536 … … 1601 1556 1602 1557 :param cell_list: list of tuple 1603 1604 1558 """ 1605 1559 … … 1610 1564 """ 1611 1565 get controls to modify 1612 1613 1566 """ 1614 1567 … … 1621 1574 """ 1622 1575 """ 1623 # I Believe this is no longer used now that we have removed the 1576 # I Believe this is no longer used now that we have removed the 1624 1577 # edit menu from the menubar - PDB July 12, 2015 1625 1578 if self.notebook is not None: … … 1629 1582 """ 1630 1583 """ 1631 # I Believe this is no longer used now that we have removed the 1584 # I Believe this is no longer used now that we have removed the 1632 1585 # edit menu from the menubar - PDB July 12, 2015 1633 1586 if self.notebook is not None: … … 1638 1591 """ 1639 1592 The main wx.Frame for the batch results grid 1640 1641 1593 """ 1642 1594 … … 1645 1597 """ 1646 1598 Initialize the Frame 1647 1648 1599 """ 1649 1600 … … 1690 1641 populates the edit menu on the menubar. Not activated as of SasView 1691 1642 3.1.0 1692 1693 1643 """ 1694 1644 self.edit = wx.Menu() … … 1725 1675 def on_copy(self, event): 1726 1676 """ 1727 On Copy from the Edit menu item on the menubar 1728 1677 On Copy from the Edit menu item on the menubar 1729 1678 """ 1730 1679 # I Believe this is no longer used now that we have removed the … … 1739 1688 """ 1740 1689 On Paste from the Edit menu item on the menubar 1741 1742 1690 """ 1743 1691 # I Believe this is no longer used now that we have removed the … … 1752 1700 """ 1753 1701 On Clear from the Edit menu item on the menubar 1754 1755 1702 """ 1756 1703 # I Believe this is no longer used now that we have removed the … … 1763 1710 """ 1764 1711 Get Label Text 1765 1766 1712 """ 1767 1713 for item in self.insert_before_menu.GetMenuItems(): … … 1773 1719 """ 1774 1720 On remove column from the Edit menu Item on the menubar 1775 1776 1721 """ 1777 1722 # I Believe this is no longer used now that we have removed the … … 1784 1729 """ 1785 1730 On menu open 1786 1787 1731 """ 1788 1732 if self.file == event.GetMenu(): … … 1846 1790 """ 1847 1791 Saves data in grid to a csv file. 1848 1792 1849 1793 At this time only the columns displayed get saved. Thus any error 1850 1794 bars not inserted before saving will not be saved in the file 1851 1852 1795 """ 1853 1796 … … 1883 1826 """ 1884 1827 Open file containing batch result 1885 1886 1828 """ 1887 1829 … … 1892 1834 """ 1893 1835 open excel and display batch result in Excel 1894 1895 1836 """ 1896 1837 … … 1919 1860 """ 1920 1861 Append a new column to the grid 1921 1922 1862 """ 1923 1863 self.panel.add_column() … … 1926 1866 """ 1927 1867 Set data 1928 1929 1868 """ 1930 1869 self.panel.notebook.set_data(data_inputs=data_inputs, … … 1936 1875 """ 1937 1876 Add a new table 1938 1939 1877 """ 1940 1878 # DO not event.Skip(): it will make 2 pages … … 1944 1882 """ 1945 1883 Allow to select where the result of batch will be displayed or stored 1946 1947 1884 """ 1948 1885 def __init__(self, parent, data_inputs, data_outputs, file_name="", … … 1952 1889 1953 1890 :param parent: Window instantiating this dialog 1954 :param result: result to display in a grid or export to an external 1891 :param result: result to display in a grid or export to an external\ 1955 1892 application. 1956 1957 1893 """ 1958 1894 … … 1978 1914 """ 1979 1915 Draw the content of the current dialog window 1980 1981 1916 """ 1982 1917 … … 2033 1968 """ 2034 1969 Get the user selection and display output to the selected application 2035 2036 1970 """ 2037 1971 … … 2046 1980 """ 2047 1981 close the Window 2048 2049 1982 """ 2050 1983 … … 2055 1988 Receive event and display data into third party application 2056 1989 or save data to file. 2057 2058 1990 """ 2059 1991 if self.save_to_file.GetValue(): -
src/sas/guiframe/documentation_window.py
ra12c0a6 rfb3f9af 43 43 (self, parent, dummy_id, path, url_instruction, title, size=(850, 540)) 44 44 45 :param path: path to html file beginning AFTER /doc/ and ending in the 45 :param path: path to html file beginning AFTER /doc/ and ending in the\ 46 46 file.html. 47 48 47 :param url_instructions: anchor string or other query e.g. '#MyAnchor' 49 48 :param title: text to place in the title bar of the help panel -
src/sas/models/CoreMultiShellModel.py
rac7be54 re0c16ce 53 53 ## parameters with orientation: can be removed since there is no orientational params 54 54 self._set_orientation_params() 55 56 55 57 56 def _clone(self, obj): 58 57 """ … … 67 66 68 67 return obj 69 70 68 71 69 def _set_dispersion(self): 72 70 """ 73 71 model dispersions 74 72 Polydispersion should not be applied to s_model 75 """ 76 ##set dispersion from model 73 """ 74 ##set dispersion from model 77 75 for name , value in self.model.dispersion.iteritems(): 78 76 nshell = 0 … … 82 80 if name.split('_')[-1] == 'shell%s' % str(nshell): 83 81 self.dispersion[name] = value 84 else: 82 else: 85 83 continue 86 84 else: 87 85 self.dispersion[name] = value 88 86 89 87 def _set_orientation_params(self): 90 88 """ 91 89 model orientation and magnetic parameters, same params for this model 92 """ 90 """ 93 91 ##set dispersion from model 94 92 for param in self.model.orientation_params: … … 104 102 self.orientation_params.append(param) 105 103 self.magnetic_params.append(param) 106 continue 104 continue 107 105 108 106 def _set_params(self): 109 107 """ 110 108 Concatenate the parameters of the model to create 111 this model parameters 109 this model parameters 112 110 """ 113 111 # rearrange the parameters for the given # of shells … … 128 126 else: 129 127 self.params[name]= value 130 128 131 129 # set constrained values for the original model params 132 self._set_xtra_model_param() 133 130 self._set_xtra_model_param() 131 134 132 def _set_details(self): 135 133 """ 136 134 Concatenate details of the original model to create 137 this model details 135 this model details 138 136 """ 139 137 for name ,detail in self.model.details.iteritems(): 140 138 if name in self.params.iterkeys(): 141 139 self.details[name]= detail 142 143 140 141 144 142 def _set_xtra_model_param(self): 145 143 """ … … 163 161 self.model.setParam(key, 0.0) 164 162 except: pass 165 163 166 164 167 165 def getProfile(self): 168 166 """ 169 Get SLD profile 170 171 : return: (r, beta) where r is a list of radius of the transition points 172 beta is a list of the corresponding SLD values173 : Note: This works only for func_shell num = 2.167 Get SLD profile 168 **Note:** This works only for func_shell num = 2. 169 170 :return: (r, beta) where r is a list of radius of the transition points\ 171 and beta is a list of the corresponding SLD values. 174 172 """ 175 173 r = [] … … 181 179 r.append(self.params['rad_core0']) 182 180 beta.append(self.params['sld_core0']) 183 181 184 182 # for shells 185 183 for n in range(1, self.n_shells+1): 186 184 # Left side of each shells 187 r0 = r[len(r)-1] 185 r0 = r[len(r)-1] 188 186 r.append(r0) 189 187 exec "beta.append(self.params['sld_shell%s'% str(n)])" … … 193 191 r.append(r0) 194 192 exec "beta.append(self.params['sld_shell%s'% str(n)])" 195 193 196 194 # for solvent 197 195 r0 = r[len(r)-1] … … 201 199 r.append(r_solv) 202 200 beta.append(self.params['sld_solv']) 203 201 204 202 return r, beta 205 203 206 204 def setParam(self, name, value): 207 """ 205 """ 208 206 Set the value of a model parameter 209 210 : 211 : 207 208 :param name: name of the parameter 209 :param value: value of the parameter 212 210 """ 213 211 # set param to new model 214 212 self._setParamHelper( name, value) 215 ## setParam to model 213 ## setParam to model 216 214 if name == 'sld_solv': 217 215 # the sld_*** model.params not in params must set to value of sld_solv … … 243 241 self.params[item] = value 244 242 return 245 246 243 #raise ValueError, "Model does not contain parameter %s" % name 247 248 244 245 249 246 def _set_fixed_params(self): 250 247 """ … … 252 249 """ 253 250 for item in self.model.fixed: 254 if item.split('.')[0] in self.params.keys(): 251 if item.split('.')[0] in self.params.keys(): 255 252 self.fixed.append(item) 256 253 257 254 self.fixed.sort() 258 255 259 256 def run(self, x = 0.0): 260 """ 257 """ 261 258 Evaluate the model 262 263 : 264 : 259 260 :param x: input q-value (float or [float, float] as [r, theta]) 261 :return: (DAB value) 265 262 """ 266 263 # set effective radius and scaling factor before run … … 269 266 270 267 def runXY(self, x = 0.0): 271 """ 268 """ 272 269 Evaluate the model 273 274 : 275 : 270 271 :param x: input q-value (float or [float, float] as [qx, qy]) 272 :return: DAB value 276 273 """ 277 274 # set effective radius and scaling factor before run 278 275 279 276 return self.model.runXY(x) 280 277 281 278 ## Now (May27,10) directly uses the model eval function 282 279 ## instead of the for-loop in Base Component. 283 280 def evalDistribution(self, x = []): 284 """ 281 """ 285 282 Evaluate the model in cartesian coordinates 286 287 : 288 : 283 284 :param x: input q[], or [qx[], qy[]] 285 :return: scattering function P(q[]) 289 286 """ 290 287 # set effective radius and scaling factor before run 291 288 return self.model.evalDistribution(x) 292 289 293 290 def calculate_ER(self): 294 """ 291 """ 295 292 Calculate the effective radius for P(q)*S(q) 296 293 297 294 :return: the value of the effective radius 298 299 """ 295 """ 300 296 return self.model.calculate_ER() 301 297 302 298 def calculate_VR(self): 303 """ 299 """ 304 300 Calculate the volf ratio for P(q)*S(q) 305 301 306 302 :return: the value of the volf ratio 307 308 """ 303 """ 309 304 return self.model.calculate_VR() 310 305 311 306 def set_dispersion(self, parameter, dispersion): 312 307 """ 313 308 Set the dispersion object for a model parameter 314 315 : 316 : dispersion: dispersion object of type DispersionModel309 310 :param parameter: name of the parameter [string] 311 :param dispersion: dispersion object of type DispersionModel 317 312 """ 318 313 value = None … … 323 318 return value 324 319 except: 325 raise 320 raise -
src/sas/models/MultiplicationModel.py
rac7be54 rfb3f9af 10 10 which will be calculated from P(Q) via calculate_ER(), 11 11 and 2) 'scale' in P model which is synchronized w/ volfraction in S 12 then P*S is multiplied by a new param , 'scale_factor'.12 then P*S is multiplied by a new parameter, 'scale_factor'. 13 13 The polydispersion is applicable only to P(Q), not to S(Q). 14 Note: P(Q) refers to 'form factor' model while S(Q) does to 'structure factor'. 14 15 .. note:: P(Q) refers to 'form factor' model while S(Q) does to 'structure factor'. 15 16 """ 16 17 def __init__(self, p_model, s_model ): … … 81 82 def _clone(self, obj): 82 83 """ 83 Internal utility function to copy the internal84 data members to afresh copy.84 Internal utility function to copy the internal data members to a 85 fresh copy. 85 86 """ 86 87 obj.params = copy.deepcopy(self.params) … … 96 97 def _set_dispersion(self): 97 98 """ 98 combined the two models dispersions99 Polydispersion should not beapplied to s_model99 combine the two models' dispersions. Polydispersity should not be 100 applied to s_model 100 101 """ 101 102 ##set dispersion only from p_model … … 107 108 Get SLD profile of p_model if exists 108 109 109 : return: (r, beta) where r is a list of radius of the transition points 110 beta is a list of the corresponding SLD values 111 : Note: This works only for func_shell num = 2 (exp function). 110 :return: (r, beta) where r is a list of radius of the transition points\ 111 beta is a list of the corresponding SLD values 112 113 .. note:: This works only for func_shell num = 2 (exp function). 112 114 """ 113 115 try: … … 121 123 def _set_params(self): 122 124 """ 123 124 thismodel parameters125 Concatenate the parameters of the two models to create 126 these model parameters 125 127 """ 126 128 … … 141 143 def _set_details(self): 142 144 """ 143 144 this modeldetails145 Concatenate details of the two models to create 146 this model's details 145 147 """ 146 148 for name, detail in self.p_model.details.iteritems(): … … 154 156 def _set_scale_factor(self): 155 157 """ 156 Set scale=volfraction toP model158 Set scale=volfraction for P model 157 159 """ 158 160 value = self.params['volfraction'] … … 168 170 def _set_effect_radius(self): 169 171 """ 170 172 Set effective radius to S(Q) model 171 173 """ 172 174 if not 'effect_radius' in self.s_model.params.keys(): … … 206 208 def _setParamHelper(self, name, value): 207 209 """ 208 210 Helper function to setparam 209 211 """ 210 212 # Look for dispersion parameters … … 229 231 def _set_fixed_params(self): 230 232 """ 231 fill the self.fixed list with the p_model fixed list233 Fill the self.fixed list with the p_model fixed list 232 234 """ 233 235 for item in self.p_model.fixed: … … 240 242 """ 241 243 Evaluate the model 244 242 245 :param x: input q-value (float or [float, float] as [r, theta]) 243 246 :return: (scattering function value) … … 250 253 251 254 def runXY(self, x = 0.0): 252 """ Evaluate the model 253 @param x: input q-value (float or [float, float] as [qx, qy]) 254 @return: scattering function value 255 """ 256 Evaluate the model 257 258 :param x: input q-value (float or [float, float] as [qx, qy]) 259 :return: scattering function value 255 260 """ 256 261 # set effective radius and scaling factor before run … … 266 271 """ 267 272 Evaluate the model in cartesian coordinates 273 268 274 :param x: input q[], or [qx[], qy[]] 269 275 :return: scattering function P(q[]) … … 279 285 """ 280 286 Set the dispersion object for a model parameter 287 281 288 :param parameter: name of the parameter [string] 282 289 :dispersion: dispersion object of type DispersionModel … … 293 300 def fill_description(self, p_model, s_model): 294 301 """ 295 302 Fill the description for P(Q)*S(Q) 296 303 """ 297 304 description = "" -
src/sas/models/c_extension/c_models/GelFit.cpp
r79492222 r1d115ef 34 34 radius = Parameter(104.0,true); 35 35 radius.set_min(2.0); 36 scale= Parameter(2.0,true);36 FractalExp = Parameter(2.0,true); 37 37 background = Parameter(0.01); 38 38 } … … 43 43 dp[0] = zeta(); 44 44 dp[1] = radius(); 45 dp[2] = scale();45 dp[2] = FractalExp(); 46 46 47 47 if (dp[2] <= 0) -
src/sas/models/c_extension/python_wrapper/WrapperGenerator.py
r13e46abe r1f5f206 560 560 def replaceToken(self, line, key, value): #pylint: disable-msg=R0201 561 561 """ Replace a token in the template file 562 @param line: line of text to inspect563 @param key: token to look for564 @param value: string value to replace the token with565 @return: new string value562 :param line: line of text to inspect 563 :param key: token to look for 564 :param value: string value to replace the token with 565 :return: new string value 566 566 """ 567 _str_value = str(value) 568 _new_value = _str_value.replace('\\','/') 567 569 lenkey = len(key) 568 570 newline = line … … 570 572 while newline.count(key) > 0: 571 573 index = newline.index(key) 572 newline = newline[:index] + value + newline[index + lenkey:]574 newline = newline[:index] + _new_value + newline[index + lenkey:] 573 575 574 576 return newline -
src/sas/models/c_extension/python_wrapper/modelTemplate.txt
rc93122e r1f5f206 17 17 18 18 .. WARNING:: 19 20 19 THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 21 20 DO NOT MODIFY THIS FILE, MODIFY … … 30 29 def create_[PYTHONCLASS](): 31 30 """ 32 31 Create a model instance 33 32 """ 34 33 obj = [PYTHONCLASS]() … … 100 99 """ 101 100 Evaluate the model 101 102 102 :param x: input q, or [q,phi] 103 103 :return: scattering function P(q) … … 108 108 """ 109 109 Evaluate the model in cartesian coordinates 110 110 111 :param x: input q, or [qx, qy] 111 112 :return: scattering function P(q) … … 116 117 """ 117 118 Evaluate the model in cartesian coordinates 119 118 120 :param x: input q[], or [qx[], qy[]] 119 121 :return: scattering function P(q[]) … … 124 126 """ 125 127 Calculate the effective radius for P(q)*S(q) 128 126 129 :return: the value of the effective radius 127 130 """ … … 131 134 """ 132 135 Calculate the volf ratio for P(q)*S(q) 136 133 137 :return: the value of the volf ratio 134 138 """ … … 138 142 """ 139 143 Set the dispersion object for a model parameter 144 140 145 :param parameter: name of the parameter [string] 141 146 :param dispersion: dispersion object of type DispersionModel -
src/sas/models/include/GelFit.h
r79492222 r1d115ef 33 33 Parameter radius; 34 34 35 // [DEFAULT]= scale= 236 Parameter scale;35 // [DEFAULT]=FractalExp= 2 36 Parameter FractalExp; 37 37 38 38 // [DEFAULT]=background= 0.01 -
src/sas/models/include/dabmodel.h
r79492222 rf008ee2 17 17 // [PYTHONCLASS] = DABModel 18 18 // [DISP_PARAMS] = length, scale, background 19 // [DESCRIPTION] = <text>Provide F(x) = scale/( 1 + (x*L)^2 )^(2) + background 20 // DAB (Debye Anderson Brumberger) function as a BaseComponent model 19 // [DESCRIPTION] = <text>DAB (Debye Anderson Brumberger) Model 20 // F(x) = scale * L^3/( 1 + (q*L)^2 )^2 + background 21 // L: the correlation length 21 22 // </text> 22 23 // [FIXED] = -
src/sas/models/sas_extension/__init__.py
r79492222 rfb3f9af 1 """ 2 This is an empty package - should probably delete 3 """
Note: See TracChangeset
for help on using the changeset viewer.