Skip to content

Commit

Permalink
fixes to xy data panel
Browse files Browse the repository at this point in the history
  • Loading branch information
newville committed Jul 5, 2024
1 parent eea7b1e commit f9dbc0d
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions larch/wxxas/xydata_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@

# Plot_EnergyRanges = {'full X range': None }

PlotOne_Choices = {'XY Data': 'yplot',
PlotOne_Choices = {'XY Data': 'y',
'Scaled Data': 'ynorm',
'Derivative ': 'dydx',
'XY Data + Derivative': 'yplot+dydx',
'XY Data + Derivative': 'y+dydx',
'Scaled Data + Derivative': 'ynorm+dydx',
}

PlotSel_Choices = {'XY Data': 'yplot',
PlotSel_Choices = {'XY Data': 'y',
'Scaled Data': 'ynorm',
'Derivative': 'dydx'}

Expand Down Expand Up @@ -82,7 +82,7 @@ def build_display(self):
voff_lab = wx.StaticText(parent=trow, label=' Y Offset:', size=(80, vxsize),
style=wx.RIGHT|wx.ALIGN_CENTRE_HORIZONTAL|wx.ST_NO_AUTORESIZE)

self.plotone_op.SetSelection(1)
self.plotone_op.SetSelection(0)
self.plotsel_op.SetSelection(1)

tsizer = wx.GridBagSizer(3, 3)
Expand All @@ -96,11 +96,11 @@ def build_display(self):
pack(trow, tsizer)

scale = self.add_floatspin('scale', action=self.onSet_Scale,
digits=3, increment=0.05, value=1,
digits=3, increment=0.05, value=1.0,
size=(FSIZEBIG, -1))

xshift = self.add_floatspin('xshift', action=self.onSet_XShift,
digits=3, increment=0.05, value=1,
digits=3, increment=0.05, value=0.0,
size=(FSIZEBIG, -1))

self.wids['is_frozen'] = Check(panel, default=False, label='Freeze Group',
Expand Down Expand Up @@ -130,7 +130,8 @@ def CopyBtn(name):

add_text('Scale Factor:')
panel.Add(scale)
panel.Add(CopyBtn('scale'), dcol=2, style=RIGHT)
panel.Add(SimpleText(panel, 'Scaled Data = Y /(Scale Factor)'))
panel.Add(CopyBtn('scale'), dcol=1, style=RIGHT)

add_text('Shift X scale:' )
panel.Add(xshift)
Expand Down Expand Up @@ -170,7 +171,8 @@ def get_config(self, dgroup=None):
fname =file2groupname('unknown_group',
symtable=self._larch.symtable)

conf['xshift'] = getattr(dgroup,'xshift', conf['xshift'])
for attr in ('scale', 'xshift'):
conf[attr] = getattr(dgroup, attr, conf[attr])

setattr(dgroup.config, self.configname, conf)
return conf
Expand All @@ -184,7 +186,7 @@ def fill_form(self, dgroup):
self.plotsel_op.SetChoices(list(PlotSel_Choices.keys()))

self.wids['scale'].SetValue(opts['scale'])
self.wids['scale'].Enable()
self.wids['xshift'].SetValue(opts['xshift'])

frozen = opts.get('is_frozen', False)
frozen = getattr(dgroup, 'is_frozen', frozen)
Expand All @@ -199,7 +201,6 @@ def unset_skip_process(self):
def read_form(self):
"read form, return dict of values"
form_opts = {}

form_opts['scale'] = self.wids['scale'].GetValue()
form_opts['xshift'] = self.wids['xshift'].GetValue()
return form_opts
Expand Down Expand Up @@ -448,6 +449,11 @@ def get_plot_arrays(self, dgroup):
lab = getattr(plotlabels, pchoice)
dgroup.plot_yarrays = [(pchoice, PLOTOPTS_1, lab)]

elif pchoice == 'y+dydx':
lab = plotlabels.y
dgroup.plot_y2label = lab2 = plotlabels.dydx
dgroup.plot_yarrays = [('y', PLOTOPTS_1, lab),
('dydx', PLOTOPTS_D, lab2)]
elif pchoice == 'ynorm+dydx':
lab = plotlabels.ynorm
dgroup.plot_y2label = lab2 = plotlabels.dydx
Expand Down

0 comments on commit f9dbc0d

Please sign in to comment.