Changeset ae2a197 in sasview


Ignore:
Timestamp:
Jul 26, 2015 6:28:43 PM (9 years ago)
Author:
butler
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:
225aca8
Parents:
fb3f9af (diff), e9e3e38 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasview.git

Files:
11 edited

Legend:

Unmodified
Added
Removed
  • build_tools/jenkins_osx_build.sh

    ra003f3c re9e3e38  
    4646python setup_mac.py py2app 
    4747 
    48 cd $WORKSPACE/sasview/dist 
    49 tar -czf `python -c "import pkg_resources;print '%s.tar.gz' % pkg_resources.get_distribution('sasview').egg_name()"` `python -c "import sasview; print 'SasView-%s.app' % sasview.__version__"` 
     48#cd $WORKSPACE/sasview/dist 
     49#tar -czf `python -c "import pkg_resources;print '%s.tar.gz SasView-%s.app' % (pkg_resources.get_distribution('sasview').egg_name(),pkg_resources.get_distribution('sasview').version)"` 
  • src/sas/guiframe/data_processor.py

    ra12c0a6 r44d20af  
    99 
    1010The organization of the classes goes as: 
    11 .. image::  media/BatchGridClassLayout.png 
     11 
     12.. image::  ../../user/guiframe/BatchGridClassLayout.png 
    1213   :align:   center 
    1314 
     
    3738    """ 
    3839    Object describing a cell in  the grid. 
    39  
    4040    """ 
    4141    def __init__(self): 
    4242        """ 
    4343        Initialize attributes of class (label, value, col, row, object) 
    44          
    4544        """ 
    4645        self.label = "" 
     
    5453    """ 
    5554    Return a dictionary of column label and index or row selected 
    56      
     55 
    5756    :param sentence: String to parse 
    5857    :param list: list of columns label 
    59      
     58    :returns: col_dict 
    6059    """ 
    6160 
     
    116115 
    117116class GridCellEditor(sheet.CCellEditor): 
    118     """  
     117    """ 
    119118    Custom cell editor 
    120      
     119 
    121120    This subclasses the sheet.CCellEditor (itself a subclass of 
    122121    grid.GridCellEditor) in order to override two of its methods: 
     
    125124    This is necessary as the sheet module is broken in wx 3.0.2 and 
    126125    improperly subclasses grid.GridCellEditor 
    127      
    128126    """ 
    129127    def __init__(self, grid): 
    130128        """ 
    131129        Override of CCellEditor init. Runs the grid.GridCellEditor init code 
    132  
    133130        """ 
    134131        super(GridCellEditor, self).__init__(grid) 
    135132 
    136133    def PaintBackground(self, dc, rect, attr): 
    137         """  
     134        """ 
    138135        Overrides wx.sheet.CCellEditor.PaintBackground which incorrectly calls 
    139136        the base class method. 
    140          
     137 
    141138        In wx3.0 all paint objects must explicitly 
    142139        have a wxPaintDC (Device Context) object.  Thus the paint event which 
     
    145142        not updated to reflect this and hence fails.  This could thus 
    146143        become obsolete in a future bug fix of wxPython. 
    147          
     144 
    148145        Apart from adding a dc variable in the list of arguments in the def 
    149146        and in the call to the base class the rest of this method is copied 
    150147        as is from sheet.CCellEditor.PaintBackground 
    151          
    152         :param dc: the wxDC object for the paint 
    153         ------- 
     148 
     149        **From original GridCellEditor docs:** 
     150 
    154151        Draws the part of the cell not occupied by the edit control.  The 
    155152        base class version just fills it with background colour from the 
     
    159156        to do something out of the ordinary. 
    160157 
     158        :param dc: the wxDC object for the paint 
    161159        """ 
    162160        # Call base class method. 
     
    165163 
    166164    def EndEdit(self, row, col, grid, previous): 
    167         """  
     165        """ 
    168166        Commit editing the current cell. Returns True if the value has changed. 
    169          
     167 
    170168        :param previous: previous value in the cell 
    171          
    172169        """ 
    173170        changed = False                             # Assume value not changed 
     
    184181    """ 
    185182    Class that receives the results of a batch fit. 
    186      
     183 
    187184    GridPage displays the received results in a wx.grid using sheet.  This is 
    188185    then used by GridPanel and GridFrame to present the full GUI. 
    189      
    190186    """ 
    191187    def __init__(self, parent, panel=None): 
    192188        """ 
    193189        Initialize 
    194          
     190 
    195191        Initialize all the attributes of GridPage, and the events. include 
    196192        the init stuff from sheet.CSheet as well. 
    197          
    198193        """ 
    199194        #sheet.CSheet.__init__(self, parent) 
    200          
     195 
    201196        # The following is the __init__ from CSheet. ########################## 
    202197        # We re-write it here because the class is broken in wx 3.0, 
     
    243238        # CSheet init method.  Basically these override any intrinsic binding 
    244239        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) 
    246241 
    247242        self.AdjustScrollbars() 
     
    283278        if self.GetNumberCols() > 0: 
    284279            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 
    287282        # appropriate 
    288283        #self.Bind(wx.grid.EVT_GRID_LABEL_LEFT_CLICK, self.on_left_click) 
     
    295290        """ 
    296291        Overrides sheet.CSheet.OnLefClick. 
    297          
     292 
    298293        Processes when a cell is selected by left clicking on that cell. First 
    299294        process the base Sheet method then the current class specific method 
    300           
    301295        """ 
    302296        sheet.CSheet.OnLeftClick(self, event) 
    303297        self.on_selected_cell(event) 
    304          
     298 
    305299 
    306300    def OnCellChange(self, event): 
    307301        """ 
    308302        Overrides sheet.CSheet.OnCellChange.   
    309          
     303 
    310304        Processes when a cell has been edited by a cell editor. Checks for the 
    311305        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. 
    314307        """ 
    315308        row, _ = event.GetRow(), event.GetCol() 
     
    323316        """ 
    324317        Handler catching cell selection. 
    325          
     318 
    326319        Called after calling base 'on left click' method. 
    327  
    328320        """ 
    329321 
     
    398390        """ 
    399391        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 
    402394        This processes the information on the selected column: the column name 
    403395        (in row 0 of column) and the range of cells with a valid value to be 
    404396        used by the GridPanel set_axis methods. 
    405          
    406         """ 
    407          
     397        """ 
     398 
    408399        flag = event.CmdDown() or event.ControlDown() 
    409400 
     
    449440        """ 
    450441        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 
    453444        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 
    455446        current column.  If inserting a new column can insert a blank column or 
    456447        choose a number of hidden columns.  By default all the error parameters 
     
    458449        intrinsic variables stored with the data such as Temperature, pressure, 
    459450        time etc can be used to populate this menu. 
    460          
    461         """ 
    462          
     451        """ 
     452 
    463453        col = event.GetCol() 
    464454        row = event.GetRow() 
     
    497487        method called to populate the 'insert column before current column' 
    498488        submenu. 
    499          
    500         """ 
    501          
     489        """ 
     490 
    502491        if self.data is None: 
    503492            return 
     
    521510        Method called to populate the 'insert column after current column' 
    522511        submenu 
    523          
    524         """ 
    525          
     512        """ 
     513 
    526514        if self.data is None: 
    527515            return 
     
    546534        Called when user chooses remove from the column right click menu 
    547535        Checks the columnn exists then calls the remove_column method 
    548          
    549         """ 
    550          
     536        """ 
     537 
    551538        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    552539            col = self.selected_cols[0] 
     
    556543        """ 
    557544        Remove the col column from the current grid 
    558          
    559         """ 
    560          
     545        """ 
     546 
    561547        # add data to the grid     
    562548        row = 0 
     
    581567        of the column context menu obtained when right clicking on a given 
    582568        column header. 
    583          
     569 
    584570        Sets up to insert column into the current grid before the current 
    585571        highlighted column location and sets up what to populate that column 
    586572        with.  Then calls insert_column method to actually do the insertion.  
    587          
    588         """ 
    589          
     573        """ 
     574 
    590575        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    591576            col = self.selected_cols[0] 
     
    602587        Called when user chooses insert 'column after' submenu 
    603588        of the column context menu obtained when right clicking on a given 
    604         column header.  
    605          
     589        column header. 
     590 
    606591        Sets up to insert column into the current grid after the current 
    607592        highlighted column location and sets up what to populate that column 
    608593        with.  Then calls insert_column method to actually do the insertion.  
    609          
    610         """ 
    611          
     594        """ 
     595 
    612596        if self.selected_cols is not None or len(self.selected_cols) > 0: 
    613597            col = self.selected_cols[0] + 1 
     
    623607        Insert column at position col with data[col_name] into the current 
    624608        grid. 
    625          
    626         """ 
    627          
     609        """ 
     610 
    628611        row = 0 
    629612        self.InsertCols(pos=col, numCols=1, updateLabels=True) 
     
    648631        """ 
    649632        Just calls the panel version of the method 
    650          
    651         """ 
    652          
     633        """ 
     634 
    653635        self.panel.set_xaxis(x=self.axis_value, label=self.axis_label) 
    654636 
     
    656638        """ 
    657639        Just calls the panel version of the method 
    658          
    659         """ 
     640        """ 
     641 
    660642        self.panel.set_yaxis(y=self.axis_value, label=self.axis_label) 
    661643 
     
    663645        """ 
    664646        Add data to the grid 
    665          
     647 
    666648        :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 
    671652        self.file_name = file_name 
    672653        self.details = details 
     
    704685        """ 
    705686        Set the values in grids 
    706          
    707         """ 
    708          
     687        """ 
     688 
    709689        # add data to the grid 
    710690        row = 0 
     
    741721        """ 
    742722        Return value contained in the grid 
    743          
    744         """ 
    745          
     723        """ 
     724 
    746725        grid_view = {} 
    747726        for col in xrange(self.GetNumberCols()): 
     
    761740        """ 
    762741        Return number of total rows 
    763          
    764742        """ 
    765743        return self._rows 
     
    768746        """ 
    769747        Method to handle cell right click context menu.  
    770          
     748 
    771749        THIS METHOD IS NOT CURRENTLY USED.  It is designed to provide a 
    772750        cell pop up context by right clicking on a cell and gives the 
     
    774752        future versions and is being superceded by more traditional cut and 
    775753        paste options. 
    776          
    777         """ 
    778          
     754        """ 
     755 
    779756        wx_id = wx.NewId() 
    780757        c_menu = wx.Menu() 
     
    817794        future versions and is being superceded by more traditional cut and 
    818795        paste options 
    819  
    820796        """ 
    821797 
     
    825801        """ 
    826802        Called when paste is chosen from cell right click context menu 
    827          
     803 
    828804        THIS METHOD IS NOT CURRENTLY USED.  it is part of right click cell 
    829805        context menu which is being removed. This will probably be removed in 
    830806        future versions and is being superceded by more traditional cut and 
    831807        paste options 
    832  
    833808        """ 
    834809 
     
    847822        future versions and is being superceded by more traditional cut and 
    848823        paste options 
    849  
    850824        """ 
    851825 
     
    857831    window_name = "Fit panel" 
    858832    ## Title to appear on top of the window 
    859      
    860833    """ 
    861      
     834 
    862835    window_caption = "Notebook " 
    863836 
     
    898871        display the close button on the tab if more than 1 tab exits. 
    899872        Otherwise remove the close button 
    900  
    901873        """ 
    902874 
     
    918890        Return the select cell range from a given selected column. Checks that 
    919891        all cells are from the same column 
    920  
    921892        """ 
    922893 
     
    949920        """ 
    950921        Add highlight rows 
    951  
    952922        """ 
    953923 
     
    980950        """ 
    981951        return dictionary of columns labels on the current page 
    982  
    983952        """ 
    984953 
     
    996965        Receive a list of cells and  create a string presenting the selected 
    997966        cells that can be used as data for one axis of a plot. 
    998          
     967 
    999968        :param cell_list: list of tuple 
    1000  
    1001969        """ 
    1002970        pos = self.GetSelection() 
     
    10751043        """ 
    10761044        close the page 
    1077  
    10781045        """ 
    10791046 
     
    11091076        Order a list of 'inputs.' Used to sort rows and columns to present 
    11101077        in batch results grid. 
    1111  
    11121078        """ 
    11131079 
     
    11431109        """ 
    11441110        Append a new column to the grid 
    1145  
    11461111        """ 
    11471112 
     
    11551120        """ 
    11561121        Remove the selected column from the grid 
    1157  
    11581122        """ 
    11591123        # I Believe this is no longer used now that we have removed the  
     
    11661130    """ 
    11671131    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. 
    11701133    """ 
    11711134 
     
    11741137        """ 
    11751138        Initialize the GridPanel 
    1176  
    11771139        """ 
    11781140 
     
    12641226        Get object represented by the given cells and plot them.  Basically 
    12651227        plot the colum in y vs the column in x. 
    1266  
    12671228        """ 
    12681229 
     
    13451306        """ 
    13461307        Evaluate the contains of textcrtl and plot result 
    1347  
    13481308        """ 
    13491309 
     
    14561416 
    14571417        :param evt: Triggers on clicking the help button 
    1458  
    14591418        """ 
    14601419 
     
    14711430        """ 
    14721431        Get sentence from dict 
    1473  
    14741432        """ 
    14751433 
     
    14881446        Draw the area related to the grid by adding it as the first element 
    14891447        in the panel's grid_sizer 
    1490  
    14911448        """ 
    14921449 
     
    14991456        Add the area containing all the plot options, buttons etc to a plotting 
    15001457        area sizer to later be added to the top level grid_sizer 
    1501  
    15021458        """ 
    15031459 
     
    15431499                                   (self.plot_button, 0, 
    15441500                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12), 
    1545                                    (self.help_button,0,  
     1501                                   (self.help_button,0, 
    15461502                                    wx.LEFT | wx.TOP | wx.BOTTOM, 12)]) 
    15471503 
     
    15771533        """ 
    15781534        Get the selected column on  the visible grid and set values for axis 
    1579  
    15801535        """ 
    15811536 
     
    16011556 
    16021557        :param cell_list: list of tuple 
    1603  
    16041558        """ 
    16051559 
     
    16101564        """ 
    16111565        get controls to modify 
    1612  
    16131566        """ 
    16141567 
     
    16211574        """ 
    16221575        """ 
    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 
    16241577        # edit menu from the menubar - PDB July 12, 2015 
    16251578        if self.notebook is not None: 
     
    16291582        """ 
    16301583        """ 
    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 
    16321585        # edit menu from the menubar - PDB July 12, 2015 
    16331586        if self.notebook is not None: 
     
    16381591    """ 
    16391592    The main wx.Frame for the batch results grid 
    1640  
    16411593    """ 
    16421594 
     
    16451597        """ 
    16461598        Initialize the Frame 
    1647          
    16481599        """ 
    16491600 
     
    16901641        populates the edit menu on the menubar.  Not activated as of SasView 
    16911642        3.1.0 
    1692  
    16931643        """ 
    16941644        self.edit = wx.Menu() 
     
    17251675    def on_copy(self, event): 
    17261676        """ 
    1727         On Copy from the Edit menu item on the menubar   
    1728  
     1677        On Copy from the Edit menu item on the menubar 
    17291678        """ 
    17301679        # I Believe this is no longer used now that we have removed the  
     
    17391688        """ 
    17401689        On Paste from the Edit menu item on the menubar 
    1741  
    17421690        """ 
    17431691        # I Believe this is no longer used now that we have removed the  
     
    17521700        """ 
    17531701        On Clear from the Edit menu item on the menubar 
    1754  
    17551702        """ 
    17561703        # I Believe this is no longer used now that we have removed the  
     
    17631710        """ 
    17641711        Get Label Text 
    1765  
    17661712        """ 
    17671713        for item in self.insert_before_menu.GetMenuItems(): 
     
    17731719        """ 
    17741720        On remove column from the Edit menu Item on the menubar 
    1775  
    17761721        """ 
    17771722        # I Believe this is no longer used now that we have removed the  
     
    17841729        """ 
    17851730        On menu open 
    1786  
    17871731        """ 
    17881732        if self.file == event.GetMenu(): 
     
    18461790        """ 
    18471791        Saves data in grid to a csv file. 
    1848          
     1792 
    18491793        At this time only the columns displayed get saved.  Thus any error 
    18501794        bars not inserted before saving will not be saved in the file 
    1851  
    18521795        """ 
    18531796 
     
    18831826        """ 
    18841827        Open file containing batch result 
    1885  
    18861828        """ 
    18871829 
     
    18921834        """ 
    18931835        open excel and display batch result in Excel 
    1894  
    18951836        """ 
    18961837 
     
    19191860        """ 
    19201861        Append a new column to the grid 
    1921  
    19221862        """ 
    19231863        self.panel.add_column() 
     
    19261866        """ 
    19271867        Set data 
    1928  
    19291868        """ 
    19301869        self.panel.notebook.set_data(data_inputs=data_inputs, 
     
    19361875        """ 
    19371876        Add a new table 
    1938  
    19391877        """ 
    19401878        # DO not event.Skip(): it will make 2 pages 
     
    19441882    """ 
    19451883    Allow to select where the result of batch will be displayed or stored 
    1946  
    19471884    """ 
    19481885    def __init__(self, parent, data_inputs, data_outputs, file_name="", 
     
    19521889 
    19531890        :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\ 
    19551892                application. 
    1956  
    19571893        """ 
    19581894 
     
    19781914        """ 
    19791915        Draw the content of the current dialog window 
    1980  
    19811916        """ 
    19821917 
     
    20331968        """ 
    20341969        Get the user selection and display output to the selected application 
    2035  
    20361970        """ 
    20371971 
     
    20461980        """ 
    20471981        close the Window 
    2048  
    20491982        """ 
    20501983 
     
    20551988        Receive event and display data into third party application 
    20561989        or save data to file. 
    2057  
    20581990        """ 
    20591991        if self.save_to_file.GetValue(): 
  • src/sas/guiframe/documentation_window.py

    ra12c0a6 rfb3f9af  
    4343    (self, parent, dummy_id, path, url_instruction, title, size=(850, 540)) 
    4444 
    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\ 
    4646    file.html. 
    47      
    4847    :param url_instructions: anchor string or other query e.g. '#MyAnchor' 
    4948    :param title: text to place in the title bar of the help panel 
  • src/sas/models/CoreMultiShellModel.py

    rac7be54 re0c16ce  
    5353        ## parameters with orientation: can be removed since there is no orientational params 
    5454        self._set_orientation_params() 
    55                  
    56          
     55 
    5756    def _clone(self, obj): 
    5857        """ 
     
    6766 
    6867        return obj 
    69      
    70      
     68 
    7169    def _set_dispersion(self): 
    7270        """ 
    7371        model dispersions 
    7472        Polydispersion should not be applied to s_model 
    75         """  
    76         ##set dispersion from model  
     73        """ 
     74        ##set dispersion from model 
    7775        for name , value in self.model.dispersion.iteritems():       
    7876            nshell = 0 
     
    8280                    if name.split('_')[-1] == 'shell%s' % str(nshell): 
    8381                        self.dispersion[name] = value 
    84                     else:  
     82                    else: 
    8583                        continue 
    8684            else: 
    8785                self.dispersion[name] = value 
    88                  
     86 
    8987    def _set_orientation_params(self): 
    9088        """ 
    9189        model orientation and magnetic parameters, same params for this model 
    92         """  
     90        """ 
    9391        ##set dispersion from model  
    9492        for param in self.model.orientation_params:      
     
    104102                    self.orientation_params.append(param) 
    105103                    self.magnetic_params.append(param) 
    106                     continue                            
     104                    continue 
    107105 
    108106    def _set_params(self): 
    109107        """ 
    110108        Concatenate the parameters of the model to create 
    111         this model parameters  
     109        this model parameters 
    112110        """ 
    113111        # rearrange the parameters for the given # of shells 
     
    128126            else: 
    129127                self.params[name]= value 
    130              
     128 
    131129        # set constrained values for the original model params 
    132         self._set_xtra_model_param()        
    133    
     130        self._set_xtra_model_param() 
     131 
    134132    def _set_details(self): 
    135133        """ 
    136134        Concatenate details of the original model to create 
    137         this model details  
     135        this model details 
    138136        """ 
    139137        for name ,detail in self.model.details.iteritems(): 
    140138            if name in self.params.iterkeys(): 
    141139                self.details[name]= detail 
    142              
    143      
     140 
     141 
    144142    def _set_xtra_model_param(self): 
    145143        """ 
     
    163161                                self.model.setParam(key, 0.0) 
    164162                        except: pass 
    165                       
     163 
    166164 
    167165    def getProfile(self): 
    168166        """ 
    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 values 
    173         : 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. 
    174172        """ 
    175173        r = [] 
     
    181179        r.append(self.params['rad_core0']) 
    182180        beta.append(self.params['sld_core0']) 
    183          
     181 
    184182        # for shells 
    185183        for n in range(1, self.n_shells+1): 
    186184            # Left side of each shells 
    187             r0 = r[len(r)-1]             
     185            r0 = r[len(r)-1] 
    188186            r.append(r0) 
    189187            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
     
    193191            r.append(r0) 
    194192            exec "beta.append(self.params['sld_shell%s'% str(n)])" 
    195              
     193 
    196194        # for solvent 
    197195        r0 = r[len(r)-1]             
     
    201199        r.append(r_solv) 
    202200        beta.append(self.params['sld_solv']) 
    203          
     201 
    204202        return r, beta 
    205203 
    206204    def setParam(self, name, value): 
    207         """  
     205        """ 
    208206        Set the value of a model parameter 
    209      
    210         : param name: name of the parameter 
    211         : param value: value of the parameter 
     207 
     208        :param name: name of the parameter 
     209        :param value: value of the parameter 
    212210        """ 
    213211        # set param to new model 
    214212        self._setParamHelper( name, value) 
    215         ## setParam to model  
     213        ## setParam to model 
    216214        if name == 'sld_solv': 
    217215            # the sld_*** model.params not in params must set to value of sld_solv 
     
    243241                self.params[item] = value 
    244242                return 
    245          
    246243        #raise ValueError, "Model does not contain parameter %s" % name 
    247               
    248     
     244 
     245 
    249246    def _set_fixed_params(self): 
    250247        """ 
     
    252249        """ 
    253250        for item in self.model.fixed: 
    254             if item.split('.')[0] in self.params.keys():  
     251            if item.split('.')[0] in self.params.keys(): 
    255252                self.fixed.append(item) 
    256253 
    257254        self.fixed.sort() 
    258                  
     255 
    259256    def run(self, x = 0.0): 
    260         """  
     257        """ 
    261258        Evaluate the model 
    262          
    263         : param x: input q-value (float or [float, float] as [r, theta]) 
    264         : return: (DAB value) 
     259 
     260        :param x: input q-value (float or [float, float] as [r, theta]) 
     261        :return: (DAB value) 
    265262        """ 
    266263        # set effective radius and scaling factor before run 
     
    269266 
    270267    def runXY(self, x = 0.0): 
    271         """  
     268        """ 
    272269        Evaluate the model 
    273          
    274         : param x: input q-value (float or [float, float] as [qx, qy]) 
    275         : return: DAB value 
     270 
     271        :param x: input q-value (float or [float, float] as [qx, qy]) 
     272        :return: DAB value 
    276273        """   
    277274        # set effective radius and scaling factor before run 
    278275 
    279276        return self.model.runXY(x) 
    280      
     277 
    281278    ## Now (May27,10) directly uses the model eval function  
    282279    ## instead of the for-loop in Base Component. 
    283280    def evalDistribution(self, x = []): 
    284         """  
     281        """ 
    285282        Evaluate the model in cartesian coordinates 
    286          
    287         : param x: input q[], or [qx[], qy[]] 
    288         : return: scattering function P(q[]) 
     283 
     284        :param x: input q[], or [qx[], qy[]] 
     285        :return: scattering function P(q[]) 
    289286        """ 
    290287        # set effective radius and scaling factor before run 
    291288        return self.model.evalDistribution(x) 
    292      
     289 
    293290    def calculate_ER(self): 
    294         """  
     291        """ 
    295292        Calculate the effective radius for P(q)*S(q) 
    296          
     293 
    297294        :return: the value of the effective radius 
    298          
    299         """        
     295        """ 
    300296        return self.model.calculate_ER()  
    301      
     297 
    302298    def calculate_VR(self): 
    303         """  
     299        """ 
    304300        Calculate the volf ratio for P(q)*S(q) 
    305          
     301 
    306302        :return: the value of the volf ratio 
    307          
    308         """        
     303        """ 
    309304        return self.model.calculate_VR() 
    310      
     305 
    311306    def set_dispersion(self, parameter, dispersion): 
    312307        """ 
    313308        Set the dispersion object for a model parameter 
    314          
    315         : param parameter: name of the parameter [string] 
    316         :dispersion: dispersion object of type DispersionModel 
     309 
     310        :param parameter: name of the parameter [string] 
     311        :param dispersion: dispersion object of type DispersionModel 
    317312        """ 
    318313        value = None 
     
    323318            return value 
    324319        except: 
    325             raise  
     320            raise 
  • src/sas/models/MultiplicationModel.py

    rac7be54 rfb3f9af  
    1010        which will be calculated from P(Q) via calculate_ER(),  
    1111        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'. 
    1313        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'. 
    1516    """ 
    1617    def __init__(self, p_model, s_model ): 
     
    8182    def _clone(self, obj): 
    8283        """ 
    83             Internal utility function to copy the internal 
    84             data members to a fresh copy. 
     84        Internal utility function to copy the internal data members to a 
     85        fresh copy. 
    8586        """ 
    8687        obj.params     = copy.deepcopy(self.params) 
     
    9697    def _set_dispersion(self): 
    9798        """ 
    98            combined the two models dispersions 
    99            Polydispersion should not be applied to s_model 
     99        combine the two models' dispersions. Polydispersity should not be 
     100        applied to s_model 
    100101        """ 
    101102        ##set dispersion only from p_model  
     
    107108        Get SLD profile of p_model if exists 
    108109         
    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). 
    112114        """ 
    113115        try: 
     
    121123    def _set_params(self): 
    122124        """ 
    123             Concatenate the parameters of the two models to create 
    124             this model parameters  
     125        Concatenate the parameters of the two models to create 
     126        these model parameters  
    125127        """ 
    126128 
     
    141143    def _set_details(self): 
    142144        """ 
    143             Concatenate details of the two models to create 
    144             this model details  
     145        Concatenate details of the two models to create 
     146        this model's details  
    145147        """ 
    146148        for name, detail in self.p_model.details.iteritems(): 
     
    154156    def _set_scale_factor(self): 
    155157        """ 
    156             Set scale=volfraction to P model 
     158        Set scale=volfraction for P model 
    157159        """ 
    158160        value = self.params['volfraction'] 
     
    168170    def _set_effect_radius(self): 
    169171        """ 
    170             Set effective radius to S(Q) model 
     172        Set effective radius to S(Q) model 
    171173        """ 
    172174        if not 'effect_radius' in self.s_model.params.keys(): 
     
    206208    def _setParamHelper(self, name, value): 
    207209        """ 
    208             Helper function to setparam 
     210        Helper function to setparam 
    209211        """ 
    210212        # Look for dispersion parameters 
     
    229231    def _set_fixed_params(self): 
    230232        """ 
    231              fill the self.fixed list with the p_model fixed list 
     233        Fill the self.fixed list with the p_model fixed list 
    232234        """ 
    233235        for item in self.p_model.fixed: 
     
    240242        """  
    241243        Evaluate the model 
     244         
    242245        :param x: input q-value (float or [float, float] as [r, theta]) 
    243246        :return: (scattering function value) 
     
    250253 
    251254    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 
    255260        """   
    256261        # set effective radius and scaling factor before run 
     
    266271        """  
    267272        Evaluate the model in cartesian coordinates 
     273         
    268274        :param x: input q[], or [qx[], qy[]] 
    269275        :return: scattering function P(q[]) 
     
    279285        """ 
    280286        Set the dispersion object for a model parameter 
     287         
    281288        :param parameter: name of the parameter [string] 
    282289        :dispersion: dispersion object of type DispersionModel 
     
    293300    def fill_description(self, p_model, s_model): 
    294301        """ 
    295             Fill the description for P(Q)*S(Q) 
     302        Fill the description for P(Q)*S(Q) 
    296303        """ 
    297304        description = "" 
  • src/sas/models/c_extension/c_models/GelFit.cpp

    r79492222 r1d115ef  
    3434    radius = Parameter(104.0,true); 
    3535    radius.set_min(2.0); 
    36     scale = Parameter(2.0,true); 
     36    FractalExp = Parameter(2.0,true); 
    3737    background = Parameter(0.01); 
    3838} 
     
    4343    dp[0] = zeta(); 
    4444    dp[1] = radius(); 
    45     dp[2] = scale(); 
     45    dp[2] = FractalExp(); 
    4646     
    4747    if (dp[2] <= 0) 
  • src/sas/models/c_extension/python_wrapper/WrapperGenerator.py

    r13e46abe r1f5f206  
    560560    def replaceToken(self, line, key, value): #pylint: disable-msg=R0201 
    561561        """ Replace a token in the template file  
    562             @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 
     562            :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 
    566566        """ 
     567        _str_value = str(value) 
     568        _new_value = _str_value.replace('\\','/') 
    567569        lenkey = len(key) 
    568570        newline = line 
     
    570572        while newline.count(key) > 0: 
    571573            index = newline.index(key) 
    572             newline = newline[:index] + value + newline[index + lenkey:] 
     574            newline = newline[:index] + _new_value + newline[index + lenkey:] 
    573575 
    574576        return newline 
  • src/sas/models/c_extension/python_wrapper/modelTemplate.txt

    rc93122e r1f5f206  
    1717 
    1818.. WARNING:: 
    19  
    2019   THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY 
    2120   DO NOT MODIFY THIS FILE, MODIFY 
     
    3029def create_[PYTHONCLASS](): 
    3130    """ 
    32        Create a model instance 
     31    Create a model instance 
    3332    """ 
    3433    obj = [PYTHONCLASS]() 
     
    10099        """ 
    101100        Evaluate the model 
     101 
    102102        :param x: input q, or [q,phi] 
    103103        :return: scattering function P(q) 
     
    108108        """ 
    109109        Evaluate the model in cartesian coordinates 
     110 
    110111        :param x: input q, or [qx, qy] 
    111112        :return: scattering function P(q) 
     
    116117        """ 
    117118        Evaluate the model in cartesian coordinates 
     119 
    118120        :param x: input q[], or [qx[], qy[]] 
    119121        :return: scattering function P(q[]) 
     
    124126        """ 
    125127        Calculate the effective radius for P(q)*S(q) 
     128 
    126129        :return: the value of the effective radius 
    127130        """ 
     
    131134        """ 
    132135        Calculate the volf ratio for P(q)*S(q) 
     136 
    133137        :return: the value of the volf ratio 
    134138        """ 
     
    138142        """ 
    139143        Set the dispersion object for a model parameter 
     144 
    140145        :param parameter: name of the parameter [string] 
    141146        :param dispersion: dispersion object of type DispersionModel 
  • src/sas/models/include/GelFit.h

    r79492222 r1d115ef  
    3333  Parameter radius; 
    3434 
    35   //  [DEFAULT]=scale= 2 
    36   Parameter scale; 
     35  //  [DEFAULT]=FractalExp= 2 
     36  Parameter FractalExp; 
    3737 
    3838  //  [DEFAULT]=background= 0.01 
  • src/sas/models/include/dabmodel.h

    r79492222 rf008ee2  
    1717// [PYTHONCLASS] = DABModel 
    1818// [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 
    2122//     </text> 
    2223// [FIXED] =  
  • src/sas/models/sas_extension/__init__.py

    r79492222 rfb3f9af  
     1""" 
     2This is an empty package - should probably delete 
     3""" 
Note: See TracChangeset for help on using the changeset viewer.