Changeset 6060a86 in sasview for src/sas


Ignore:
Timestamp:
Oct 26, 2017 5:11:00 AM (7 years ago)
Author:
Adam Washington <adam.washington@…>
Branches:
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
Children:
3e20577
Parents:
60bf0db
Message:

Plot propper values

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/PrInversion/dmax.py

    r60bf0db r6060a86  
    1010import sys 
    1111import os 
     12import logging 
     13import numpy as np 
    1214from PyQt4 import QtCore 
    1315from PyQt4 import QtGui 
     
    2527# from InvariantDetails import DetailsDialog 
    2628# from InvariantUtils import WIDGETS 
     29 
     30logger = logging.getLogger(__name__) 
    2731 
    2832def enum(*sequential, **named): 
     
    5660        # Let's choose the Standard Item Model. 
    5761        self.model = QtGui.QStandardItemModel(self) 
     62        self.mapper = None 
    5863 
    5964        # # Connect buttons to slots. 
     
    9499 
    95100    def modelChanged(self, item): 
    96         pass 
     101        if not self.mapper: 
     102            return 
     103 
     104        iq0 = [] 
     105        rg = [] 
     106        pos = [] 
     107        pos_err = [] 
     108        osc = [] 
     109        xs = np.linspace(float(self.model.item(W.DMIN).text()), 
     110                         float(self.model.item(W.DMAX).text()), 
     111                         float(self.model.item(W.NPTS).text())) 
     112 
     113        for x in xs: 
     114            self.pr_state.d_max = x 
     115            try: 
     116                out, cov = self.pr_state.invert(self.nfunc) 
     117 
     118                iq0.append(self.pr_state.iq0(out)) 
     119                rg.append(self.pr_state.rg(out)) 
     120                pos.append(self.pr_state.get_positive(out)) 
     121                pos_err.append(self.pr_state.get_pos_err(out, cov)) 
     122                osc.append(self.pr_state.oscillations(out)) 
     123            except: 
     124                # This inversion failed, skip this D_max value 
     125                msg = "ExploreDialog: inversion failed " 
     126                msg += "for D_max=%s\n%s" % (str(x), sys.exc_value) 
     127                print(msg) 
     128                # logger.error(msg) 
     129        self.plot.plot(data=Data1D(xs, rg), marker="-") 
    97130 
    98131 
Note: See TracChangeset for help on using the changeset viewer.