Changeset db24ec1 in sasview for src/sas/sasgui


Ignore:
Timestamp:
Oct 3, 2018 8:21:44 AM (6 years ago)
Author:
GitHub <noreply@…>
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
e66f9c1, 0863065, cf1be88, b9cc210, 5ae083b
Parents:
9849f8a (diff), aba4559 (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.
git-author:
Tim Snow <tim.snow@…> (10/03/18 08:21:44)
git-committer:
GitHub <noreply@…> (10/03/18 08:21:44)
Message:

Merge pull request #185 from SasView?/ticket-1183-parameter-reset

Ticket 1183: Don't clear parameters on structure box content reset

Location:
src/sas/sasgui
Files:
7 edited

Legend:

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

    rdabcaf7 rba1c145  
    33    fitting  a model and one data 
    44""" 
     5from __future__ import print_function 
     6 
    57import sys 
    68import wx 
     
    12551257        if saved_pars: 
    12561258            self.get_paste_params(saved_pars) 
     1259 
     1260        # Make sure the model parameters correspond to the fit parameters 
     1261        self._update_paramv_on_fit() 
    12571262 
    12581263        if event is not None: 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    raf7d2e5 raba4559  
    339339        Update custom model list in the fitpage combo box 
    340340        """ 
    341         custom_model = 'Plugin Models' 
    342341        try: 
    343342            # Update edit menus 
     
    347346            if not new_pmodel_list: 
    348347                return 
    349             # Set the new plugin model list for all fit pages 
     348 
     349            # Redraws to a page not in focus are showing up as if they are 
     350            # in the current page tab. 
     351            current_page_index = self.fit_panel.GetSelection() 
     352            current_page = self.fit_panel.GetCurrentPage() 
     353            last_drawn_page = current_page 
     354 
     355            # Set the new plugin model list for all fit pages; anticipating 
     356            # categories, the updated plugin may be in either the form factor 
     357            # or the structure factor combo boxes 
    350358            for uid, page in self.fit_panel.opened_pages.iteritems(): 
    351                 if hasattr(page, "formfactorbox"): 
    352                     page.model_list_box = new_pmodel_list 
    353                     mod_cat = page.categorybox.GetStringSelection() 
    354                     if mod_cat == custom_model: 
    355                         box = page.formfactorbox 
    356                         model_name = box.GetValue() 
    357                         model = (box.GetClientData(box.GetCurrentSelection()) 
    358                                  if model_name else None) 
    359                         page._show_combox_helper() 
    360                         new_index = box.FindString(model_name) 
    361                         new_model = (box.GetClientData(new_index) 
    362                                      if new_index >= 0 else None) 
    363                         if new_index >= 0: 
    364                             box.SetStringSelection(model_name) 
    365                         else: 
    366                             box.SetStringSelection('') 
    367                         if model and new_model != model: 
    368                             page._on_select_model(keep_pars=True) 
    369                     if hasattr(page, "structurebox"): 
    370                         selected_name = page.structurebox.GetStringSelection() 
    371  
    372                         page.structurebox.Clear() 
    373                         page.initialize_combox() 
    374  
    375                         index = page.structurebox.FindString(selected_name) 
    376                         if index == -1: 
    377                             index = 0 
    378                         page.structurebox.SetSelection(index) 
    379                         page._on_select_model() 
     359                pbox = getattr(page, "formfactorbox", None) 
     360                sbox = getattr(page, "structurebox", None) 
     361                if pbox is None: 
     362                    continue 
     363 
     364                # Set the new model list for the page 
     365                page.model_list_box = new_pmodel_list 
     366 
     367                # Grab names of the P and S models from the page.  Need to do 
     368                # this before resetting the form factor box since that clears 
     369                # the structure factor box. 
     370                old_struct = old_form = None 
     371                form_name = pbox.GetValue() 
     372                struct_name = sbox.GetStringSelection() 
     373                if form_name: 
     374                    old_form = pbox.GetClientData(pbox.GetCurrentSelection()) 
     375                if struct_name: 
     376                    old_struct = sbox.GetClientData(sbox.GetCurrentSelection()) 
     377 
     378                # Reset form factor combo box.  We are doing this for all 
     379                # categories not just plugins since eventually the category 
     380                # manager will allow plugin models to be anywhere. 
     381                page._show_combox_helper() 
     382                form_index = pbox.FindString(form_name) 
     383                pbox.SetSelection(form_index) 
     384                new_form = (pbox.GetClientData(form_index) 
     385                            if form_index != wx.NOT_FOUND else None) 
     386                #print("form: %r"%form_name, old_form, new_form) 
     387 
     388                # Reset structure factor combo box; even if the model list 
     389                # hasn't changed, the model may have.  Show the structure 
     390                # factor combobox if the selected model is a form factor. 
     391                sbox.Clear() 
     392                page.initialize_combox() 
     393                if new_form is not None and getattr(new_form, 'is_form_factor', False): 
     394                    sbox.Show() 
     395                    sbox.Enable() 
     396                    page.text2.Show() 
     397                    page.text2.Enable() 
     398                struct_index = sbox.FindString(struct_name) 
     399                sbox.SetSelection(struct_index) 
     400                new_struct = (sbox.GetClientData(struct_index) 
     401                              if struct_index != wx.NOT_FOUND else None) 
     402                #print("struct: %r"%struct_name, old_struct, new_struct) 
     403 
     404                # Update the page if P or S has changed 
     405                if old_form != new_form or old_struct != new_struct: 
     406                    #print("triggering model update") 
     407                    page._on_select_model(keep_pars=True) 
     408                    last_drawn_page = page 
     409 
     410            # If last drawn is not the current, then switch the current to the 
     411            # last drawn then switch back.  Very ugly. 
     412            if last_drawn_page != current_page: 
     413                for page_index in range(self.fit_panel.PageCount): 
     414                    if self.fit_panel.GetPage(page_index) == last_drawn_page: 
     415                        self.fit_panel.SetSelection(page_index) 
     416                        break 
     417                self.fit_panel.SetSelection(current_page_index) 
     418 
    380419        except Exception: 
    381420            logger.error("update_custom_combo: %s", sys.exc_value) 
  • src/sas/sasgui/guiframe/aboutbox.py

    rb963b20 r1b4cb41  
    108108        self.bitmap_button_tudelft = wx.BitmapButton(self, -1, wx.NullBitmap) 
    109109        self.bitmap_button_dls = wx.BitmapButton(self, -1, wx.NullBitmap) 
     110        self.bitmap_button_bam = wx.BitmapButton(self, -1, wx.NullBitmap) 
    110111 
    111112        self.static_line_3 = wx.StaticLine(self, -1) 
     
    128129        self.Bind(wx.EVT_BUTTON, self.onTudelftLogo, self.bitmap_button_tudelft) 
    129130        self.Bind(wx.EVT_BUTTON, self.onDlsLogo, self.bitmap_button_dls) 
     131        self.Bind(wx.EVT_BUTTON, self.onBamLogo, self.bitmap_button_bam) 
    130132        # end wxGlade 
    131133        # fill in acknowledgements 
     
    226228        logo = wx.Bitmap(image) 
    227229        self.bitmap_button_dls.SetBitmapLabel(logo) 
     230 
     231        image = file_dir + "/images/bam_logo.png" 
     232        if os.path.isfile(config._bam_logo): 
     233            image = config._bam_logo 
     234        logo = wx.Bitmap(image) 
     235        self.bitmap_button_bam.SetBitmapLabel(logo) 
    228236 
    229237        # resize dialog window to fit version number nicely 
     
    258266        self.bitmap_button_tudelft.SetSize(self.bitmap_button_tudelft.GetBestSize()) 
    259267        self.bitmap_button_dls.SetSize(self.bitmap_button_dls.GetBestSize()) 
     268        self.bitmap_button_bam.SetSize(self.bitmap_button_bam.GetBestSize()) 
    260269        # end wxGlade 
    261270 
     
    325334        sizer_logos.Add(self.bitmap_button_dls, 0, 
    326335                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
     336        sizer_logos.Add(self.bitmap_button_bam, 0, 
     337                        wx.LEFT|wx.ADJUST_MINSIZE, 2) 
    327338 
    328339        sizer_logos.Add((10, 50), 0, wx.ADJUST_MINSIZE, 0) 
     
    430441        event.Skip() 
    431442 
     443    def onBamLogo(self, event): 
     444        """ 
     445        """ 
     446        # wxGlade: DialogAbout.<event_handler> 
     447        launchBrowser(config._bam_url) 
     448        event.Skip() 
     449 
    432450# end of class DialogAbout 
    433451 
  • src/sas/sasgui/guiframe/config.py

    r8ac05a5 r1b4cb41  
    5151'''M. Doucet et al. SasView Version 4.1.2, Zenodo, 10.5281/zenodo.825675''' 
    5252_acknowledgement =  \ 
    53 '''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: http://www.sasview.org/contact.html 
     53'''This work was originally developed as part of the DANSE project funded by the US NSF under Award DMR-0520547,\n but is currently maintained by a collaboration between UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS, BAM and the scattering community.\n\n SasView also contains code developed with funding from the EU Horizon 2020 programme under the SINE2020 project (Grant No 654000).\nA list of individual contributors can be found at: http://www.sasview.org/contact.html 
    5454''' 
    5555 
     
    9090_tudelft_url = "http://www.tnw.tudelft.nl/en/cooperation/facilities/reactor-instituut-delft/" 
    9191_dls_url = "http://www.diamond.ac.uk/" 
     92_bam_url = "http://www.bam.de/" 
    9293_danse_url = "http://www.cacr.caltech.edu/projects/danse/release/index.html" 
    9394_inst_url = "http://www.utk.edu" 
    9495_corner_image = os.path.join(icon_path, "angles_flat.png") 
    9596_welcome_image = os.path.join(icon_path, "SVwelcome.png") 
    96 _copyright = "(c) 2009 - 2018, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, and DLS" 
     97_copyright = "(c) 2009 - 2018, UTK, UMD, NIST, ORNL, ISIS, ESS, ILL, ANSTO, TU Delft, DLS and BAM" 
    9798marketplace_url = "http://marketplace.sasview.org/" 
    9899 
  • src/sas/sasgui/guiframe/local_perspectives/data_loader/data_loader.py

    r2924532 r9c7e2b8  
    182182                file_errors[basename] = [log_msg] 
    183183                continue 
    184  
    185184            try: 
    186185                message = "Loading {}...\n".format(p_file) 
     
    204203                self.load_update(message="Loaded {}\n".format(p_file), 
    205204                                 info="info") 
    206  
    207205            except NoKnownLoaderException as e: 
    208206                exception_occurred = True 
    209                 error_message = "Loading data failed!\n" + e.message 
    210                 self.load_complete(output=None, 
    211                                    message=error_message, 
    212                                    info="warning") 
    213  
     207                error_message = "Loading data failed!" + e.message 
     208                file_errors[basename] = [error_message] 
    214209            except Exception as e: 
    215210                exception_occurred = True 
     
    220215                file_err += " following:\n" 
    221216                file_err += e.message 
    222                 self.load_complete(output=None, 
    223                                    message=file_err, 
    224                                    info="error") 
     217                file_errors[basename] = [file_err] 
    225218 
    226219        if len(file_errors) > 0: 
     
    231224                for message in error_array: 
    232225                    error_message += message + "\n" 
    233                 error_message = error_message[:-1] 
    234226            self.load_complete(output=output, 
    235227                               message=error_message, 
  • src/sas/sasgui/perspectives/corfunc/media/corfunc_help.rst

    r501712f r490f790  
    3333Both analyses are performed in 3 stages: 
    3434 
    35 *  Extrapolation of the scattering curve to :math:`Q = 0` and toward  
    36    :math:`Q = \infty` 
     35*  Extrapolation of the scattering curve to :math:`q = 0` and toward  
     36   :math:`q = \infty` 
    3737*  Smoothed merging of the two extrapolations into the original data 
    3838*  Fourier / Hilbert Transform of the smoothed data to give the correlation 
     
    4747------------- 
    4848 
    49 To :math:`Q = 0` 
     49To :math:`q = 0` 
    5050................ 
    5151 
     
    6767the impact on any extrapolated parameters will be least significant. 
    6868 
    69 To :math:`Q = \infty` 
     69To :math:`q = \infty` 
    7070..................... 
    7171 
     
    145145        - do they smoothly curve onto the ordinate at x = 0? (if not check the value  
    146146          of :math:`\sigma` is sensible) 
    147         - are there ripples at x values corresponding to (2 :math:`pi` over) the two  
     147        - are there ripples at x values corresponding to (2 :math:`\pi` over) the two  
    148148          q values at which the extrapolated and experimental data are merged? 
    149         - are there any artefacts at x values corresponding to 2 :math:`pi` / q\ :sub:`max` in  
     149        - are there any artefacts at x values corresponding to 2 :math:`\pi` / q\ :sub:`max` in  
    150150          the experimental data?  
    151151        - and lastly, do the significant features/peaks in the correlation functions  
     
    158158    -q^{4} I(q) 
    159159 
    160 The IDF is proportional to the second derivative of Γ\ :sub:`1`\ (x). 
     160The IDF is proportional to the second derivative of Γ\ :sub:`1`\ (x) and represents a  
     161superposition of thickness distributions from all the contributing lamellae.  
    161162 
    162163Hilbert 
     
    192193*   Local Crystallinity :math:`= L_c/L_p` 
    193194 
     195.. warning:: If the sample does not possess lamellar morphology then "Compute  
     196    Parameters" will return garbage! 
     197         
     198 
    194199Volume Fraction Profile 
    195200....................... 
     
    213218 
    214219The reader is directed to the references for information on these parameters. 
     220 
    215221 
    216222References 
     
    263269Once the Q ranges have been set, click the "Calculate Bg" button to determine the  
    264270background level. Alternatively, enter your own value into the box. If the box turns  
    265 yellow this indicates that background subtraction has created some negative intensities. 
     271yellow this indicates that background subtraction has created some negative intensities.  
     272This may still be fine provided the peak intensity is very much greater than the  
     273background level. The important point is that the extrapolated dataset must approach  
     274zero at high-q. 
    266275 
    267276Now click the "Extrapolate" button to extrapolate the data. The graph window will update  
     
    296305 
    297306.. note:: 
    298     This help document was last changed by Steve King, 26Sep2017 
     307    This help document was last changed by Steve King, 28Sep2017 
  • src/sas/sasgui/perspectives/invariant/invariant_state.py

    rfa412df re9920cd  
    130130        my_time, date = self.timestamp 
    131131        file_name = self.file 
     132        from sas.sasview.__init__ import __version__ as sasview_version 
    132133 
    133134        state_num = int(self.saved_state['state_num']) 
    134135        state = "\n[Invariant computation for %s: " % file_name 
    135         state += "performed at %s on %s] \n" % (my_time, date) 
     136        state += "performed at %s on %s] " % (my_time, date) 
     137        state += "[SasView v%s]\n" % (sasview_version) 
    136138        state += "State No.: %d \n" % state_num 
    137139        state += "\n=== Inputs ===\n" 
Note: See TracChangeset for help on using the changeset viewer.