Changeset 9087214 in sasview for src/sas/sasgui/perspectives/fitting


Ignore:
Timestamp:
Oct 11, 2016 11:09:47 AM (8 years ago)
Author:
jhbakker
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
4581ac9, 7949dcf7
Parents:
392056d (diff), 46dfee9 (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' into Jurrian1D, fingers crossed!

Location:
src/sas/sasgui/perspectives/fitting
Files:
1 added
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/basepage.py

    r51a4d78 r9087214  
    10371037            dispersity = self.disp_box.GetClientData(n) 
    10381038            name = dispersity.__name__ 
    1039  
    10401039            self._set_dipers_Param(event=None) 
    10411040 
     
    11081107        self.Refresh() 
    11091108 
     1109    def get_cat_combo_box_pos(self, state): 
     1110        """ 
     1111        Iterate through the categories to find the structurefactor 
     1112        :return: combo_box_position 
     1113        """ 
     1114        for key, value in self.master_category_dict.iteritems(): 
     1115            for list_item in value: 
     1116                if state.formfactorcombobox in list_item: 
     1117                    return self.categorybox.Items.index(key) 
     1118 
    11101119    def reset_page_helper(self, state): 
    11111120        """ 
     
    11631172            category_pos = int(state.categorycombobox) 
    11641173        except: 
     1174            state.formfactorcombobox = unicode(state.formfactorcombobox.lower()) 
     1175            state.categorycombobox = unicode(state.categorycombobox) 
    11651176            category_pos = 0 
    1166             for ind_cat in range(self.categorybox.GetCount()): 
    1167                 if self.categorybox.GetString(ind_cat) == \ 
    1168                                         state.categorycombobox: 
    1169                     category_pos = int(ind_cat) 
    1170                     break 
     1177            if state.categorycombobox in self.categorybox.Items: 
     1178                category_pos = self.categorybox.Items.index( 
     1179                    state.categorycombobox) 
     1180            else: 
     1181                # Look in master list for model name (model.lower) 
     1182                category_pos = self.get_cat_combo_box_pos(state) 
    11711183 
    11721184        self.categorybox.Select(category_pos) 
     
    11891201            structfactor_pos = int(state.structurecombobox) 
    11901202        except: 
    1191             structfactor_pos = 0 
    1192             for ind_struct in range(self.structurebox.GetCount()): 
    1193                 if self.structurebox.GetString(ind_struct) == \ 
    1194                                                     (state.structurecombobox): 
    1195                     structfactor_pos = int(ind_struct) 
    1196                     break 
     1203            if state.structurecombobox is not None: 
     1204                structfactor_pos = 0 
     1205                state.structurecombobox = unicode(state.structurecombobox) 
     1206                for ind_struct in range(self.structurebox.GetCount()): 
     1207                    if self.structurebox.GetString(ind_struct) == \ 
     1208                                                        (state.structurecombobox): 
     1209                        structfactor_pos = int(ind_struct) 
     1210                        break 
    11971211 
    11981212        self.structurebox.SetSelection(structfactor_pos) 
     
    14071421        self.state.npts = self.npts_x 
    14081422 
    1409     def _onparamEnter_helper(self): 
     1423    def _onparamEnter_helper(self,is_modified = False): 
    14101424        """ 
    14111425        check if values entered by the user are changed and valid to replot 
     
    14131427        """ 
    14141428        # Flag to register when a parameter has changed. 
    1415         is_modified = False 
     1429        #is_modified = False 
    14161430        self.fitrange = True 
    14171431        is_2Ddata = False 
     
    14211435            is_2Ddata = True 
    14221436        if self.model != None: 
    1423             is_modified = (self._check_value_enter(self.fittable_param) 
    1424                            or self._check_value_enter(self.fixed_param) 
    1425                            or self._check_value_enter(self.parameters)) 
     1437            #Either we get a is_modified = True passed in because 
     1438            #_update_paramv_on_fit() has been called already or 
     1439            # we need to check here ourselves. 
     1440            if not is_modified: 
     1441                is_modified = (self._check_value_enter(self.fittable_param) 
     1442                               or self._check_value_enter(self.fixed_param) 
     1443                               or self._check_value_enter(self.parameters)) 
    14261444 
    14271445            # Here we should check whether the boundaries have been modified. 
     
    14721490        flag = True 
    14731491        self.fitrange = True 
     1492        is_modified = False 
    14741493 
    14751494        #wx.PostEvent(self._manager.parent, StatusEvent(status=" \ 
     
    14841503                                                                [self.data]) 
    14851504            ##Check the values 
    1486             self._check_value_enter(self.fittable_param) 
    1487             self._check_value_enter(self.fixed_param) 
    1488             self._check_value_enter(self.parameters) 
     1505            is_modified = (self._check_value_enter(self.fittable_param) 
     1506                            or self._check_value_enter(self.fixed_param) 
     1507                            or self._check_value_enter(self.parameters)) 
    14891508 
    14901509            # If qmin and qmax have been modified, update qmin and qmax and 
     
    15681587            logging.error(traceback.format_exc()) 
    15691588 
    1570         return flag 
     1589        return flag,is_modified 
    15711590 
    15721591    def _reset_parameters_state(self, listtorestore, statelist): 
     
    19791998            form_factor = self.formfactorbox.GetClientData(f_id) 
    19801999 
    1981         if form_factor is None or not form_factor.is_form_factor: 
     2000        if form_factor is None or \ 
     2001            not hasattr(form_factor, 'is_form_factor') or \ 
     2002            not form_factor.is_form_factor: 
    19822003            self.structurebox.Hide() 
    19832004            self.text2.Hide() 
     
    23062327            wx.PostEvent(self.parent, event) 
    23072328        #draw the model with the current dispersity 
    2308         self._draw_model() 
     2329 
     2330        #Wojtek P, Oct 8, 2016: Calling draw_model seems to be unessecary. 
     2331        #By comenting it we save an extra Iq calculation 
     2332        #self._draw_model() 
     2333 
    23092334        ## Need to use FitInside again here to replace the next four lines. 
    23102335        ## Otherwised polydispersity off does not resize the scrollwindow. 
     
    30553080        """ 
    30563081        content = '' 
     3082        bound_hi = '' 
     3083        bound_lo = '' 
    30573084        # go through the str params 
    30583085        for item in param: 
     
    30863113                    value = item[2].GetValue() 
    30873114 
     3115            # Bounds 
     3116            try: 
     3117                bound_lo = item[5].GetValue() 
     3118                bound_hi = item[6].GetValue() 
     3119            except Exception: 
     3120                # harmless - need to just pass 
     3121                pass 
     3122 
    30883123            # add to the content 
    30893124            if disfunc != '': 
     
    31013136            except Exception: 
    31023137                logging.error(traceback.format_exc()) 
    3103             content += name + ',' + str(check) + ',' + value + disfunc + ':' 
     3138            content += name + ',' + str(check) + ',' +\ 
     3139                    value + disfunc + ',' + bound_lo + ',' +\ 
     3140                    bound_hi + ':' 
    31043141 
    31053142        return content 
     
    31523189                # Transfer the text to content[dictionary] 
    31533190                context[name] = [check, value] 
     3191 
     3192                # limits 
     3193                limit_lo = item[3] 
     3194                context[name].append(limit_lo) 
     3195                limit_hi = item[4] 
     3196                context[name].append(limit_hi) 
     3197 
    31543198            # ToDo: PlugIn this poly disp function for pasting 
    31553199            try: 
    3156                 poly_func = item[3] 
     3200                poly_func = item[5] 
    31573201                context[name].append(poly_func) 
    31583202                try: 
    31593203                    # take the vals and weights for  array 
    3160                     array_values = item[4].split(' ') 
    3161                     array_weights = item[5].split(' ') 
     3204                    array_values = item[6].split(' ') 
     3205                    array_weights = item[7].split(' ') 
    31623206                    val = [float(a_val) for a_val in array_values[1:]] 
    31633207                    weit = [float(a_weit) for a_weit in array_weights[1:]] 
     
    32073251                name = item[1] 
    32083252                if name in content.keys(): 
    3209                     check = content[name][0] 
    3210                     pd = content[name][1] 
     3253                    values = content[name] 
     3254                    check = values[0] 
     3255                    pd = values[1] 
     3256 
    32113257                    if name.count('.') > 0: 
    32123258                        # If this is parameter.width, then pd may be a floating 
     
    32313277                            fun_val = self.model.fun_list[content[name][1]] 
    32323278                            self.model.setParam(name, fun_val) 
     3279                    try: 
     3280                        item[5].SetValue(str(values[-3])) 
     3281                        item[6].SetValue(str(values[-2])) 
     3282                    except Exception: 
     3283                        # passing as harmless non-update 
     3284                        pass 
    32333285 
    32343286                    value = content[name][1:] 
     
    32753327                                self.model.setParam(name, fun_val) 
    32763328                                # save state 
     3329                        try: 
     3330                            item[5].SetValue(str(value[-3])) 
     3331                            item[6].SetValue(str(value[-2])) 
     3332                        except Exception: 
     3333                            # passing as harmless non-update 
     3334                            pass 
     3335 
    32773336                        self._paste_poly_help(item, value) 
    32783337                        if check == 'True': 
     
    33093368        """ 
    33103369        # Do nothing if not setting polydispersity 
    3311         if len(value[1]) == 0: 
     3370        if len(value[3]) == 0: 
    33123371            return 
    33133372 
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    r7988501 r9087214  
    424424        self.Bind(wx.EVT_RADIOBUTTON, self.onSlitSmear, 
    425425                  id=self.slit_smearer.GetId()) 
    426         self.disable_smearer.SetValue(True) 
     426        self.enable_smearer.SetValue(True) 
    427427 
    428428        sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10) 
     
    10581058            self.create_default_data() 
    10591059        """ 
    1060         flag = self._update_paramv_on_fit() 
    1061  
    1062         wx.CallAfter(self._onparamEnter_helper) 
     1060        flag,is_modified = self._update_paramv_on_fit() 
     1061 
     1062        wx.CallAfter(self._onparamEnter_helper,is_modified) 
    10631063        if not flag: 
    10641064            msg = "The parameters are invalid" 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    rff3f5821 rec72ceb  
    221221        self.id_edit = wx.NewId() 
    222222        editmodel_help = "Edit customized model sample file" 
    223         self.menu1.AppendMenu(self.id_edit, "Edit Custom Model", 
     223        self.menu1.AppendMenu(self.id_edit, "Plugin Model Operations", 
    224224                              self.edit_model_menu, editmodel_help) 
    225225        #create  menubar items 
     
    236236        frame = PyConsole(parent=self.parent, manager=self, 
    237237                          panel=self.fit_panel, 
    238                           title='Advanced Custom Model Editor', 
     238                          title='Advanced Plugin Model Editor', 
    239239                          filename=filename) 
    240240        self.put_icon(frame) 
     
    302302            event_id = event.GetId() 
    303303            dir_path = models.find_plugins_dir() 
    304             title = "New Custom Model Function" 
     304            title = "New Plugin Model Function" 
    305305            self.new_model_frame = EditorWindow(parent=self, base=self, 
    306306                                                path=dir_path, title=title) 
     
    319319        Update custom model list in the fitpage combo box 
    320320        """ 
    321         custom_model = 'Customized Models' 
     321        custom_model = 'Plugin Models' 
    322322        try: 
    323323            # Update edit menus 
     
    350350        wx_id = wx.NewId() 
    351351        #new_model_menu = wx.Menu() 
    352         self.edit_model_menu.Append(wx_id, 'New', 
     352        self.edit_model_menu.Append(wx_id, 'New Plugin Model', 
    353353                                   'Add a new model function') 
    354354        wx.EVT_MENU(owner, wx_id, self.make_new_model) 
     
    362362        self.edit_menu = wx.Menu() 
    363363        self.edit_model_menu.AppendMenu(e_id, 
    364                                     'Advanced', self.edit_menu) 
     364                                    'Advanced Plugin Editor', self.edit_menu) 
    365365        self.set_edit_menu_helper(owner, self.edit_custom_model) 
    366366 
     
    368368        self.delete_menu = wx.Menu() 
    369369        self.edit_model_menu.AppendMenu(d_id, 
    370                                         'Delete', self.delete_menu) 
     370                                        'Delete Plugin Models', self.delete_menu) 
    371371        self.set_edit_menu_helper(owner, self.delete_custom_model) 
    372372 
    373373        wx_id = wx.NewId() 
    374         self.edit_model_menu.Append(wx_id, 'Load Models', 
     374        self.edit_model_menu.Append(wx_id, 'Load Plugin Models', 
    375375          '(Re)Load all models present in user plugin_models folder') 
    376376        wx.EVT_MENU(owner, wx_id, self.load_plugin_models) 
    377  
     377                 
    378378    def set_edit_menu_helper(self, owner=None, menu=None): 
    379379        """ 
  • src/sas/sasgui/perspectives/fitting/media/fitting.rst

    r05829fb r46dfee9  
    33Fitting Documentation 
    44===================== 
     5 
     6.. note:: In Windows use [Alt]-[Cursor left] to return to the previous page 
    57 
    68.. toctree:: 
     
    1820 
    1921   Information on the SasView Optimisers <optimizer.rst> 
    20  
    21    Writing a Plugin <plugin.rst> 
     22       
     23   Converting SANS to SESANS for Fitting <../../../sans_to_sesans> 
     24    
     25   Fitting SESANS Data <../../../sesans_fitting.rst> 
     26    
     27   Writing a Plugin Model <plugin.rst> 
     28       
     29   Computations with a GPU <../../../gpu_computations> 
     30    
  • src/sas/sasgui/perspectives/fitting/media/fitting_help.rst

    r05829fb r3e1c9e5  
    1818======= 
    1919 
     20.. note:: If some code blocks are not readable, expand the documentation window 
     21 
    2022.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    2123 
     
    116118--------------- 
    117119 
    118 For a complete list of all the library models available in SasView, see the Model Documentation. 
     120For a complete list of all the library models available in SasView, see the `Model Documentation <../../../index.html>`_ . 
    119121 
    120122It is also possible to add your own models. 
     
    124126.. _Adding_your_own_models: 
    125127 
    126 Adding your own models 
     128Adding your own Models 
    127129---------------------- 
    128130 
    129 There are currently two ways to add your own models to SasView: 
    130  
    131 * Using the :ref:`Custom_Model_Editor` 
    132 * By :ref:`Writing_a_Plugin` 
    133  
    134 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    135  
    136 .. _Custom_Model_Editor: 
    137  
    138 Custom Model Editor 
    139 ------------------- 
    140  
    141 From the *Fitting* option in the menu bar, select *Edit Custom Model*. 
    142  
    143 .. image:: edit_model_menu.bmp 
    144  
    145 and then one of the options 
    146  
    147 *  *New* - to create a new custom model template 
    148 *  *Sum|Multi(p1,p2)* - to create a new model by summing/multiplying existing models in the model library 
    149 *  *Advanced* - to edit a new custom model 
    150 *  *Delete* - to delete a custom model 
    151  
    152 New 
    153 ^^^^ 
     131There are essentially three ways to generate new fitting models for SasView: 
     132 
     133* Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners and/or relatively simple models) 
     134* By copying/editing an existing model (this can include models generated by the *New Plugin Model* dialog) in the :ref:`Python_shell` or :ref:`Advanced_Plugin_Editor` (suitable for all use cases) 
     135* By writing a model from scratch outside of SasView (only recommended for code monkeys!) 
     136 
     137Please read the guidance on :ref:`Writing_a_Plugin` before proceeding. 
     138 
     139**To be found by SasView your model must reside in the *~\\.sasview\\plugin_models* folder.** 
     140 
     141.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     142 
     143.. _Plugin_Model_Operations: 
     144 
     145Plugin Model Operations 
     146----------------------- 
     147 
     148From the *Fitting* option in the menu bar, select *Plugin Model Operations* 
     149 
     150.. image:: edit_model_menu.png 
     151 
     152and then one of the sub-options 
     153 
     154*  *New Plugin Model* - to create a plugin model template with a helper dialog 
     155*  *Sum|Multi(p1,p2)* - to create a plugin model by summing/multiplying *existing models* in the model library 
     156*  *Advanced Plugin Editor* - to create/edit a plugin model in a Python shell 
     157*  *Delete Plugin Models* - to delete a plugin model 
     158*  *Load Plugin Models* - to (re-)load plugin models 
     159 
     160.. _New_Plugin_Model: 
     161 
     162New Plugin Model 
     163^^^^^^^^^^^^^^^^ 
    154164 
    155165.. image:: new_model.bmp 
    156166 
    157167A model template generated by this option can be viewed and further modified using 
    158 the :ref:`Advanced` option. 
     168the :ref:`Advanced_Plugin_Editor` . 
    159169 
    160170*NB: "Fit Parameters" has been split into two sections, those which can be 
     
    167177.. image:: sum_model.bmp 
    168178 
    169 This option creates a custom model of the form 
    170  
    171 Custom Model = scale_factor \* (model1 +/\* model2) 
    172  
    173 In the *Easy Sum/Multi Editor* give the new custom model a function name and brief 
    174 description (to appear under the *Details* button on the *Fit Page*). Then select 
     179This option creates a custom model of the form:: 
     180 
     181     Custom Model = scale_factor \* {(scale_1 \* model_1) \+ (scale_2 \* model_2)} \+ background 
     182 
     183or:: 
     184 
     185     Custom Model = scale_factor \* model_1 \* model_2 \+ background 
     186 
     187In the *Easy Sum/Multi Editor* give the new model a function name and brief 
     188description (to appear under the *Details* button on the *FitPage*). Then select 
    175189two existing models, as p1 and p2, and the required operator, '+' or '*' between 
    176190them. Finally, click the *Apply* button to generate the model and then click *Close*. 
    177191 
    178 *NB: Any changes to a custom model generated in this way only become effective after* 
    179 *it is re-selected from the model drop-down menu on the Fit Page.* 
    180  
    181 .. _Advanced: 
    182  
    183 Advanced 
    184 ^^^^^^^^ 
    185  
    186 Selecting this option shows all the custom models in the plugin model folder 
    187  
    188   *C:\\Users\\[username]\\.sasview\\plugin_models* - (on Windows) 
     192Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage. 
     193 
     194.. _Advanced_Plugin_Editor: 
     195 
     196Advanced Plugin Editor 
     197^^^^^^^^^^^^^^^^^^^^^^ 
     198 
     199Selecting this option shows all the plugin models in the plugin model folder, on Windows this is 
     200 
     201  *C:\\Users\\{username}\\.sasview\\plugin_models* 
    189202 
    190203You can edit, modify, and save the Python code in any of these models using the 
    191 *Advanced Custom Model Editor*. 
    192  
    193 See :ref:`Writing_a_Plugin` for details on the plugin format. 
    194  
    195 *NB: Sum/Product models are still using the SasView 3.x model format.  Unless 
    196 you are confident about what you are doing, it is recommended that you 
    197 only modify lines denoted with the ## <----- comments!* 
    198  
    199 When editing is complete, select *Run -> Compile* from the *Model Editor* menu bar. An 
    200 *Info* box will appear with the results of the compilation and model unit tests. The 
    201 model will only be usable if the tests 'pass'. 
    202  
    203 To use the model, go to the relevant *Fit Page*, select the *Customized Models* 
     204*Advanced Plugin Model Editor*. Note that this is actually the same tool as the :ref:`Python_shell` . 
     205 
     206For details of the SasView plugin model format see :ref:`Writing_a_Plugin` . 
     207 
     208.. note:: Model files generated with the Sum/Multi option are still using the SasView 3.x model format. Unless you are confident about what you are doing, it is recommended that you only modify lines denoted with the ## <----- comments! 
     209 
     210When editing is complete, select *Run* > *Check Model* from the *Advanced Plugin Model Editor* menu bar. An *Info* box will appear with the results of the compilation and model unit tests. The model will only be usable if the tests 'pass'. 
     211 
     212.. image:: ../calculator/new_pycrust_example_2.png 
     213 
     214To use the model, go to the relevant *Fit Page*, select the *Plugin Models* 
    204215category and then select the model from the drop-down menu. 
    205216 
    206 *NB: Any changes to a custom model generated in this way only become effective after* 
    207 *it is re-selected from the model drop-down menu on the Fit Page.* 
    208  
    209 Delete 
    210 ^^^^^^ 
    211  
    212 Simply highlight the custom model to be removed. This operation is final! 
    213  
    214 *NB: Custom models shipped with SasView cannot be removed in this way.* 
     217Any changes to a plugin model generated in this way only become effective *after* it is re-selected from the model drop-down menu on the FitPage. 
     218 
     219Delete Plugin Models 
     220^^^^^^^^^^^^^^^^^^^^ 
     221 
     222Simply highlight the plugin model to be removed. The operation is final!!! 
     223 
     224*NB: Plugin models shipped with SasView cannot be removed in this way.* 
     225 
     226Load Plugin Models 
     227^^^^^^^^^^^^^^^^^^ 
     228 
     229This option loads (or re-loads) all models present in the *~\\.sasview\\plugin_models* folder. 
    215230 
    216231.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    600615.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    601616 
    602 .. note::  This help document was last changed by Steve King, 04Jun2015 
     617.. note::  This help document was last changed by Steve King, 10Oct2016 
  • src/sas/sasgui/perspectives/fitting/media/plugin.rst

    rb2a3814 r3e1c9e5  
    66.. note:: If some code blocks are not readable, expand the documentation window 
    77 
     8Introduction 
     9^^^^^^^^^^^^ 
     10 
     11There are essentially three ways to generate new fitting models for SasView: 
     12 
     13* Using the SasView :ref:`New_Plugin_Model` helper dialog (best for beginners and/or relatively simple models) 
     14* By copying/editing an existing model (this can include models generated by the *New Plugin Model* dialog) in the :ref:`Python_shell` or :ref:`Advanced_Plugin_Editor` as described below (suitable for all use cases) 
     15* By writing a model from scratch outside of SasView (only recommended for code monkeys!) 
     16 
    817Overview 
    918^^^^^^^^ 
    1019 
    11 You can write your own model and save it to the the SasView 
    12 *plugin_models* folder 
    13  
    14   *C:\\Users\\[username]\\.sasview\\plugin_models* (on Windows) 
    15  
    16 The next time SasView is started it will compile the plugin and add 
    17 it to the list of *Customized Models* in a FitPage.  It is recommended that an 
    18 existing model be used as a template. 
    19  
    20 SasView has three ways of writing models: 
    21  
    22 - As a pure python model : Example - 
     20If you write your own model and save it to the the SasView *plugin_models* folder 
     21 
     22  *C:\\Users\\{username}\\.sasview\\plugin_models* (on Windows) 
     23 
     24the next time SasView is started it will compile the plugin and add 
     25it to the list of *Plugin Models* in a FitPage. 
     26 
     27SasView models can be of three types: 
     28 
     29- A pure python model : Example - 
    2330  `broadpeak.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/broad_peak.py>`_ 
    24 - As a python model with embedded C : Example - 
     31- A python model with embedded C : Example - 
    2532  `sphere.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/sphere.py>`_ 
    26 - As a python wrapper with separate C code : Example - 
     33- A python wrapper with separate C code : Example - 
    2734  `cylinder.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.py>`_, 
    2835  `cylinder.c <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/cylinder.c>`_ 
     
    4249 
    4350In the *~\\.sasview\\plugin_models* directory, copy the appropriate files 
    44 (using the examples above as templates) to mymodel.py (and mymodel.c, etc) 
     51(we recommend using the examples above as templates) to mymodel.py (and mymodel.c, etc) 
    4552as required, where "mymodel" is the name for the model you are creating. 
    4653 
     
    662669^^^^^^^^^^^^^^^^^^^ 
    663670 
    664 Installed SasView 
    665 ................. 
    666  
    667 If you are editing your model from the SasView GUI, you can test it 
    668 by selecting *Run > Check Model* from the *Model Editor* menu bar. An 
    669 *Info* box will appear with the results of the compilation and a 
    670 check that the model runs. 
    671  
    672  
    673 Built SasView 
    674 ............. 
     671Minimal Testing 
     672............... 
     673 
     674Either open the :ref:`Python_shell` (*Tools* > *Python Shell/Editor*) or the :ref:`Advanced_Plugin_Editor` (*Fitting* > *Plugin Model Operations* > *Advanced  
     675Plugin Editor*), load your model, and then select *Run > Check Model* from the  
     676menu bar. 
     677 
     678An *Info* box will appear with the results of the compilation and a check that  
     679the model runs. 
     680 
     681Recommended Testing 
     682................... 
    675683 
    676684If the model compiles and runs, you can next run the unit tests that 
     
    793801consider adding your model to the 
    794802`Model Marketplace <http://marketplace.sasview.org/>`_ so that others may use it! 
     803 
     804.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     805 
     806.. note::  This help document was last changed by Steve King, 10Oct2016 
  • src/sas/sasgui/perspectives/fitting/models.py

    r212bfc2 r5de7f69  
    181181            try: 
    182182                model = load_custom_model(path) 
     183                model.name = "[plug-in] "+model.name 
    183184                plugins[model.name] = model 
    184185            except Exception: 
  • src/sas/sasgui/perspectives/fitting/pagestate.py

    re6de6b8 r467202f  
    17531753 
    17541754        return doc 
     1755 
     1756# Simple html report templet 
     1757HEADER = "<html>\n" 
     1758HEADER += "<head>\n" 
     1759HEADER += "<meta http-equiv=Content-Type content='text/html; " 
     1760HEADER += "charset=windows-1252'> \n" 
     1761HEADER += "<meta name=Generator >\n" 
     1762HEADER += "</head>\n" 
     1763HEADER += "<body lang=EN-US>\n" 
     1764HEADER += "<div class=WordSection1>\n" 
     1765HEADER += "<p class=MsoNormal><b><span ><center><font size='4' >" 
     1766HEADER += "%s</font></center></span></center></b></p>" 
     1767HEADER += "<p class=MsoNormal>&nbsp;</p>" 
     1768PARA = "<p class=MsoNormal><font size='4' > %s \n" 
     1769PARA += "</font></p>" 
     1770CENTRE = "<p class=MsoNormal><center><font size='4' > %s \n" 
     1771CENTRE += "</font></center></p>" 
     1772FEET_1 = \ 
     1773""" 
     1774<p class=MsoNormal>&nbsp;</p> 
     1775<br> 
     1776<p class=MsoNormal><b><span ><center> <font size='4' > Graph 
     1777</font></span></center></b></p> 
     1778<p class=MsoNormal>&nbsp;</p> 
     1779<center> 
     1780<br><font size='4' >Model Computation</font> 
     1781<br><font size='4' >Data: "%s"</font><br> 
     1782""" 
     1783FEET_2 = \ 
     1784""" 
     1785<img src="%s" > 
     1786</img> 
     1787""" 
     1788FEET_3 = \ 
     1789""" 
     1790</center> 
     1791</div> 
     1792</body> 
     1793</html> 
     1794""" 
     1795ELINE = "<p class=MsoNormal>&nbsp;</p>" 
  • src/sas/sasgui/perspectives/fitting/simfitpage.py

    r998ca90 ra28e52b  
    10931093                sim_page.constraints_list[index][3].SetValue(constraint_value) 
    10941094                sim_page._on_add_constraint(None) 
     1095                sim_page._manager.sim_page = sim_page 
    10951096 
    10961097    def _format_id(self, original_id): 
Note: See TracChangeset for help on using the changeset viewer.