Skip to content

Commit

Permalink
style: remove unnecessary dict call
Browse files Browse the repository at this point in the history
  • Loading branch information
kmnhan committed Apr 2, 2024
1 parent b86c995 commit ea0e0e8
Showing 1 changed file with 41 additions and 38 deletions.
79 changes: 41 additions & 38 deletions src/erlab/interactive/curvefittingtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,43 +447,46 @@ def __init__(self, data, n_bands: int = 1, parameters=None, *args, **kwargs):
self._options = QtWidgets.QWidget(self)
self._options_layout = QtWidgets.QVBoxLayout(self._options)
self._params_init = ParameterGroup(
n_bands=dict(
showlabel="# Bands",
qwtype="btspin",
integer=True,
value=n_bands,
minimum=1,
fixedWidth=60,
notrack=True,
valueChanged=self.refresh_n_peaks,
),
lin_bkg=dict(
qwtype="fitparam",
showlabel="Linear Background",
name="lin_bkg",
spin_kw=dict(value=0.0, minimumWidth=200),
),
const_bkg=dict(
qwtype="fitparam",
showlabel="Constant Background",
name="const_bkg",
spin_kw=dict(value=0.0, minimumWidth=200),
),
resolution=dict(
qwtype="fitparam",
showlabel="Total Resolution",
name="resolution",
spin_kw=dict(
value=0.01, singleStep=0.0001, decimals=4, minimumWidth=200
),
),
Method=dict(qwtype="combobox", items=LMFIT_METHODS),
go=dict(
qwtype="pushbtn",
showlabel=False,
text="Go",
clicked=self.do_fit,
),
n_bands={
"showlabel": "# Bands",
"qwtype": "btspin",
"integer": True,
"value": n_bands,
"minimum": 1,
"fixedWidth": 60,
"notrack": True,
"valueChanged": self.refresh_n_peaks,
},
lin_bkg={
"qwtype": "fitparam",
"showlabel": "Linear Background",
"name": "lin_bkg",
"spin_kw": {"value": 0.0, "minimumWidth": 200},
},
const_bkg={
"qwtype": "fitparam",
"showlabel": "Constant Background",
"name": "const_bkg",
"spin_kw": {"value": 0.0, "minimumWidth": 200},
},
resolution={
"qwtype": "fitparam",
"showlabel": "Total Resolution",
"name": "resolution",
"spin_kw": {
"value": 0.01,
"singleStep": 0.0001,
"decimals": 4,
"minimumWidth": 200,
},
},
Method={"qwtype": "combobox", "items": LMFIT_METHODS},
go={
"qwtype": "pushbtn",
"showlabel": False,
"text": "Go",
"clicked": self.do_fit,
},
)
#

Expand Down Expand Up @@ -544,7 +547,7 @@ def n_bands(self):

@property
def params_dict(self):
out = dict()
out = {}
for k in ("lin_bkg", "const_bkg", "resolution"):
out = out | self._params_init.widgets[k].param_dict
for i in range(self.n_bands):
Expand Down

0 comments on commit ea0e0e8

Please sign in to comment.