source: sasview/src/sas/sasgui/plottools/PropertyDialog.py @ ba0dc71

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since ba0dc71 was e3ae090, checked in by Piotr Rozyczko <piotr.rozyczko@…>, 8 years ago

Merge master

see issue #590. fix error in q.rg and uncertainties in Rg and I0.
Uncertainty calculation for slope and intercept are still wrong I
believe.

references #205 - Removed Kratky plot choice from linearized plots for
now since it doesn't currently work.

close #590. A lot of problems were caused by LineModel? and LinerFit?
having different equations (ax+b vs a+bx). Further errors in
calculations, particularly of uncertainties were fixed. The fact that
the fits to not account for smearing was verified and a warning added.
Code was also modified to update the qmin and qmax to match changes in
the transformed xmin xmax. Lots of documentation was added and the
fitdialog layout was cleaned up considerably. This is now usable though
the design of the user interface (and the whole design of linear fits)
could use a rethink.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1"""
2"""
3import wx
4
5class Properties(wx.Dialog):
6    """
7    """
8    def __init__(self, parent, id=-1, title="Select the scale of the graph"):
9        wx.Dialog.__init__(self, parent, id, title)
10        self.parent = parent
11        vbox = wx.BoxSizer(wx.VERTICAL)
12        sizer = wx.GridBagSizer(5, 5)
13
14        x_size = 70
15
16        ix = 1
17        iy = 1
18        sizer.Add(wx.StaticText(self, -1, 'X'), (iy, ix))
19        ix += 2
20        sizer.Add(wx.StaticText(self, -1, 'Y'), (iy, ix))
21        ix += 2
22        sizer.Add(wx.StaticText(self, -1, 'View'), (iy, ix))
23        iy += 1
24        ix = 1
25        self.xvalue = wx.ComboBox(self, -1)
26        x_size += self.xvalue.GetSize()[0]
27        sizer.Add(self.xvalue, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
28
29        ix += 2
30        self.yvalue = wx.ComboBox(self, -1)
31        x_size += self.yvalue.GetSize()[0]
32        sizer.Add(self.yvalue, (iy, ix), (1, 1), wx.EXPAND | wx.ADJUST_MINSIZE, 0)
33
34        ix += 2
35        self.view = wx.ComboBox(self, -1)
36        x_size += self.view.GetSize()[0]
37        self.view.SetMinSize((160, 30))
38        sizer.Add(self.view, (iy, ix), (1, 1),
39                  wx.EXPAND | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
40        self.SetMinSize((x_size, 50))
41        vbox.Add(sizer, 0, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
42
43        cancel_button = wx.Button(self, wx.ID_CANCEL, 'Cancel')
44        ok_button = wx.Button(self, wx.ID_OK, "OK")
45        sizer_button = wx.BoxSizer(wx.HORIZONTAL)
46        sizer_button.Add((20, 20), 1, wx.EXPAND | wx.ADJUST_MINSIZE, 0)
47        sizer_button.Add(ok_button, 0, wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
48        sizer_button.Add(cancel_button, 0, wx.LEFT | wx.RIGHT | wx.ADJUST_MINSIZE, 10)
49        vbox.Add(sizer_button, 0,
50                 wx.EXPAND | wx.TOP | wx.BOTTOM | wx.ADJUST_MINSIZE, 10)
51        # scale value for x
52        self.xvalue.SetValue("ln(x)")
53        self.xvalue.Insert("x", 0)
54        self.xvalue.Insert("x^(2)", 1)
55        self.xvalue.Insert("x^(4)", 2)
56        self.xvalue.Insert("ln(x)", 3)
57        self.xvalue.Insert("log10(x)", 4)
58        self.xvalue.Insert("log10(x^(4))", 5)
59
60        # scale value for y
61        self.yvalue.SetValue("ln(y)")
62        self.yvalue.Insert("y", 0)
63        self.yvalue.Insert("1/y", 1)
64        self.yvalue.Insert("ln(y)", 2)
65        self.yvalue.Insert("y^(2)", 3)
66        self.yvalue.Insert("y*x^(4)", 4)
67        self.yvalue.Insert("1/sqrt(y)", 5)
68        self.yvalue.Insert("log10(y)", 6)
69        self.yvalue.Insert("ln(y*x)", 7)
70        self.yvalue.Insert("ln(y*x^(2))", 8)
71        self.yvalue.Insert("ln(y*x^(4))", 9)
72        self.yvalue.Insert("log10(y*x^(4))", 10)
73        # type of view or model used
74        self.view.SetValue("--")
75        self.view.Insert("--", 0)
76        self.view.Insert("Linear y vs x", 1)
77        self.view.Insert("Guinier lny vs x^(2)", 2)
78        self.view.Insert("XS Guinier ln(y*x) vs x^(2)", 3)
79        self.view.Insert("Porod y*x^(4) vs x^(4)", 4)
80        # This did not work in 3.1.2 and does not work now.
81        # prefer to fix (should not be too hard) but for the moment
82        # am removing as an option the user sees so they don't get
83        # disappointed.    PDB 7/10/2016
84        # self.view.Insert("Kratky y*x^(2) vs x", 5)
85        self.SetSizer(vbox)
86        self.Fit()
87        self.Centre()
88
89    def setValues(self, x, y, view):
90        """
91        """
92        return  self.xvalue.SetValue(x), self.yvalue.SetValue(y), \
93                    self.view.SetValue(view)
94
95    def getValues(self):
96        """
97        """
98        return self.xvalue.GetValue(), self.yvalue.GetValue(), \
99                            self.view.GetValue()
Note: See TracBrowser for help on using the repository browser.