Changeset ae08f14 in sasview
- Timestamp:
- Sep 27, 2016 10:30:51 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6c382da
- Parents:
- e925f61 (diff), a0373d5 (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. - Location:
- src/sas/sasgui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/utils.py
rd85c194 ra0373d5 46 46 return flag 47 47 48 48 49 def check_int(item): 50 """ 51 :param item: txtcrtl containing a value 52 """ 53 flag = True 54 try: 55 mini = int(item.GetValue()) 56 item.SetBackgroundColour(wx.WHITE) 57 item.Refresh() 58 except: 59 flag = False 60 item.SetBackgroundColour("pink") 61 item.Refresh() 62 return flag 63 64 49 65 class PanelMenu(wx.Menu): 50 66 """ -
src/sas/sasgui/perspectives/fitting/basepage.py
ree4b3cb ra0373d5 17 17 from wx.lib.scrolledpanel import ScrolledPanel 18 18 19 import sasmodels.sasview_model 19 from sasmodels.weights import MODELS as POLYDISPERSITY_MODELS 20 20 21 from sas.sasgui.guiframe.panel_base import PanelBase 21 from sas.sasgui.guiframe.utils import format_number, check_float, IdList 22 from sas.sasgui.guiframe.utils import format_number, check_float, IdList, check_int 22 23 from sas.sasgui.guiframe.events import PanelOnFocusEvent 23 24 from sas.sasgui.guiframe.events import StatusEvent … … 626 627 self.disp_help_bt.Bind(wx.EVT_BUTTON, self.on_pd_help_clicked, 627 628 id=self.disp_help_bt.GetId()) 628 self.disp_help_bt.SetToolTipString("Help s for Polydispersion.")629 self.disp_help_bt.SetToolTipString("Help for polydispersion.") 629 630 630 631 self.Bind(wx.EVT_RADIOBUTTON, self._set_dipers_Param, … … 1123 1124 state.disp_cb_dict[item]) 1124 1125 # Create the dispersion objects 1125 from sas.models.dispersion_models import ArrayDispersion 1126 disp_model = ArrayDispersion() 1126 disp_model = POLYDISPERSITY_MODELS['array']() 1127 1127 if hasattr(state, "values") and \ 1128 1128 self.disp_cb_dict[item].GetValue() == True: … … 2281 2281 continue 2282 2282 2283 name = str(item[1]) 2284 if name.endswith(".npts") or name.endswith(".nsigmas"): 2283 value_ctrl = item[2] 2284 if not value_ctrl.IsEnabled(): 2285 # ArrayDispersion disables PD, Min, Max, Npts, Nsigs 2285 2286 continue 2286 2287 2287 # Check that min, max and value are floats 2288 value_ctrl, min_ctrl, max_ctrl = item[2], item[5], item[6] 2289 min_str = min_ctrl.GetValue().strip() 2290 max_str = max_ctrl.GetValue().strip() 2288 name = item[1] 2291 2289 value_str = value_ctrl.GetValue().strip() 2292 validity = check_float(value_ctrl) 2293 if min_str != "": 2294 validity = validity and check_float(min_ctrl) 2295 if max_str != "": 2296 validity = validity and check_float(max_ctrl) 2297 if not validity: 2298 continue 2299 2300 # Check that min is less than max 2301 low = -numpy.inf if min_str == "" else float(min_str) 2302 high = numpy.inf if max_str == "" else float(max_str) 2303 if high < low: 2304 min_ctrl.SetBackgroundColour("pink") 2305 min_ctrl.Refresh() 2306 max_ctrl.SetBackgroundColour("pink") 2307 max_ctrl.Refresh() 2308 #msg = "Invalid fit range for %s: min must be smaller than max"%name 2309 #wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2310 continue 2311 2312 # Force value between min and max 2313 value = float(value_str) 2314 if value < low: 2315 value = low 2316 value_ctrl.SetValue(format_number(value)) 2317 elif value > high: 2318 value = high 2319 value_ctrl.SetValue(format_number(value)) 2290 if name.endswith(".npts"): 2291 validity = check_int(value_ctrl) 2292 if not validity: 2293 continue 2294 value = int(value_str) 2295 2296 elif name.endswith(".nsigmas"): 2297 validity = check_float(value_ctrl) 2298 if not validity: 2299 continue 2300 value = float(value_str) 2301 2302 else: # value or polydispersity 2303 2304 # Check that min, max and value are floats 2305 min_ctrl, max_ctrl = item[5], item[6] 2306 min_str = min_ctrl.GetValue().strip() 2307 max_str = max_ctrl.GetValue().strip() 2308 validity = check_float(value_ctrl) 2309 if min_str != "": 2310 validity = validity and check_float(min_ctrl) 2311 if max_str != "": 2312 validity = validity and check_float(max_ctrl) 2313 if not validity: 2314 continue 2315 2316 # Check that min is less than max 2317 low = -numpy.inf if min_str == "" else float(min_str) 2318 high = numpy.inf if max_str == "" else float(max_str) 2319 if high < low: 2320 min_ctrl.SetBackgroundColour("pink") 2321 min_ctrl.Refresh() 2322 max_ctrl.SetBackgroundColour("pink") 2323 max_ctrl.Refresh() 2324 #msg = "Invalid fit range for %s: min must be smaller than max"%name 2325 #wx.PostEvent(self._manager.parent, StatusEvent(status=msg)) 2326 continue 2327 2328 # Force value between min and max 2329 value = float(value_str) 2330 if value < low: 2331 value = low 2332 value_ctrl.SetValue(format_number(value)) 2333 elif value > high: 2334 value = high 2335 value_ctrl.SetValue(format_number(value)) 2336 2337 if name not in self.model.details.keys(): 2338 self.model.details[name] = ["", None, None] 2339 old_low, old_high = self.model.details[name][1:3] 2340 if old_low != low or old_high != high: 2341 # The configuration has changed but it won't change the 2342 # computed curve so no need to set is_modified to True 2343 #is_modified = True 2344 self.model.details[name][1:3] = low, high 2320 2345 2321 2346 # Update value in model if it has changed … … 2323 2348 self.model.setParam(name, value) 2324 2349 is_modified = True 2325 2326 if name not in self.model.details.keys():2327 self.model.details[name] = ["", None, None]2328 old_low, old_high = self.model.details[name][1:3]2329 if old_low != low or old_high != high:2330 # The configuration has changed but it won't change the2331 # computed curve so no need to set is_modified to True2332 #is_modified = True2333 self.model.details[name][1:3] = low, high2334 2350 2335 2351 return is_modified … … 2687 2703 :param disp_function: dispersion distr. function 2688 2704 """ 2689 # List of the poly_model name in the combobox2690 list = ["RectangleDispersion", "ArrayDispersion",2691 "LogNormalDispersion", "GaussianDispersion",2692 "SchulzDispersion"]2693 2694 2705 # Find the selection 2695 try: 2696 selection = list.index(disp_func.__class__.__name__) 2697 return selection 2698 except: 2699 return 3 2706 if disp_func is not None: 2707 try: 2708 return POLYDISPERSITY_MODELS.values().index(disp_func.__class__) 2709 except ValueError: 2710 pass # Fall through to default class 2711 return POLYDISPERSITY_MODELS.keys().index('gaussian') 2700 2712 2701 2713 def on_reset_clicked(self, event): -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r31d7803 re925f61 660 660 ^^^^^^^^^^^^^^^^^^^ 661 661 662 Installed SasView 663 ................. 664 662 665 If you are editing your model from the SasView GUI, you can test it 663 666 by selecting *Run > Compile* from the *Model Editor* menu bar. An 664 667 *Info* box will appear with the results of the compilation and a 665 668 check that the model runs. 669 670 671 Built SasView 672 ............. 666 673 667 674 If the model compiles and runs, you can next run the unit tests that … … 721 728 722 729 723 Clean Lint 724 ^^^^^^^^^^ 725 726 **NB: For now we are not providing pylint with SasView; so unless you have a727 SasView developmentenvironment available, you can ignore this section!**730 Clean Lint - (Developer Version Only) 731 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 732 733 **NB: For now we are not providing pylint with the installer version of SasView; 734 so unless you have a SasView build environment available, you can ignore this section!** 728 735 729 736 Run the lint check with:: … … 758 765 Don't put in too many pylint statements, though, since they make the code ugly. 759 766 760 Check The Docs 761 ^^^^^^^^^^^^^^ 767 Check The Docs - (Developer Version Only) 768 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 762 769 763 770 You can get a rough idea of how the documentation will look using the … … 778 785 There is also a neat online WYSIWYG ReStructuredText editor at http://rst.ninjs.org\ . 779 786 780 Finally 781 ^^^^^^^ 787 Share Your Model! 788 ^^^^^^^^^^^^^^^^^ 782 789 783 790 Once compare and the unit test(s) pass properly and everything is done, 784 791 consider adding your model to the 785 `Model Marketplace <http://marketplace.sasview.org/>`_ .792 `Model Marketplace <http://marketplace.sasview.org/>`_ so that others may use it!
Note: See TracChangeset
for help on using the changeset viewer.