Changeset 467068d in sasview


Ignore:
Timestamp:
Aug 22, 2017 4:22:17 AM (7 years ago)
Author:
lewis
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.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
62a6a78
Parents:
43345ab
Message:

Update P(Q) and S(Q) plots when parameters are changed

File:
1 edited

Legend:

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

    rd24e41d r467068d  
    17571757                                      data_id="Data  " + data.name + " unsmeared", 
    17581758                                      dy=unsmeared_error) 
    1759         # Comment this out until we can get P*S models with correctly populated parameters 
    17601759        if sq_model is not None and pq_model is not None: 
    1761             self.create_theory_1D(x, sq_model, page_id, model, data, state, 
     1760            # Store which data sets are plotted in which windows 
     1761            # plot_ids[data_id] = [group_id1, group_id2, ...] 
     1762            plot_ids = {} 
     1763            for plot_panel in self.parent.plot_panels.values(): 
     1764                for plot in plot_panel.plots.keys(): 
     1765                    if plot in plot_ids.keys(): 
     1766                        plot_ids[plot].append(plot_panel.group_id) 
     1767                    else: 
     1768                        plot_ids[plot] = [plot_panel.group_id] 
     1769            # Create/Update the theories 
     1770            sq_id = str(page_id) + " " + data.name + " S(q)" 
     1771            sq_plot = self.create_theory_1D(x, sq_model, page_id, model, data, state, 
    17621772                                  data_description=model.name + " S(q)", 
    1763                                   data_id=str(page_id) + " " + data.name + " S(q)") 
    1764             self.create_theory_1D(x, pq_model, page_id, model, data, state, 
     1773                                  data_id=sq_id) 
     1774            pq_id = str(page_id) + " " + data.name + " P(q)" 
     1775            pq_plot = self.create_theory_1D(x, pq_model, page_id, model, data, state, 
    17651776                                  data_description=model.name + " P(q)", 
    1766                                   data_id=str(page_id) + " " + data.name + " P(q)") 
     1777                                  data_id=pq_id) 
     1778            # Update the P(Q) and S(Q) plots if they exist 
     1779            if sq_id in plot_ids.keys(): 
     1780                # If the S(Q) theory has been plotted, update its plots 
     1781                for group_id in plot_ids[sq_id]: 
     1782                    sq_plot.group_id = group_id 
     1783                    wx.PostEvent(self.parent, NewPlotEvent(plot=sq_plot, 
     1784                        title=str(sq_plot.title))) 
     1785            if pq_id in plot_ids.keys(): 
     1786                # If the P(Q) theory has been plotted, update its plots 
     1787                for group_id in plot_ids[pq_id]: 
     1788                    pq_plot.group_id = group_id 
     1789                    wx.PostEvent(self.parent, NewPlotEvent(plot=pq_plot, 
     1790                        title=str(pq_plot.title))) 
    17671791 
    17681792        current_pg = self.fit_panel.get_page_by_id(page_id) 
Note: See TracChangeset for help on using the changeset viewer.