Skip to content

Commit

Permalink
fix: wrong SI units assigend to fit results parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 29, 2020
1 parent fedd55a commit 39e1bb5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
0.7.1
- fix: wrong SI units assigend to fit results parameters
- setup: bump afmformats from 0.9.0 to 0.10.0
(new formats: JPK (.jpk-qi-data), AFM workshop (.csv),
NT-MDT (.txt exported by Nova))
Expand Down
12 changes: 6 additions & 6 deletions pyjibe/fd/tab_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,10 @@ def fit_approach_retract(self, fdist, update_ui=True):
read_only=True)
for ii, p in enumerate(varps):
# Get the human readable name of the parameter
name = self.fit_model.parameter_keys.index(p.name)
hrname = self.fit_model.parameter_names[name]
idp = self.fit_model.parameter_keys.index(p.name)
hrname = self.fit_model.parameter_names[idp]
# SI unit
si_unit = self.fit_model.parameter_units[ii]
si_unit = self.fit_model.parameter_units[idp]
# Determine unit scale, e.g. 1e6 [sic] for µm
scale = units.hrscale(hrname, si_unit=si_unit)
label = units.hrscname(hrname, si_unit=si_unit)
Expand All @@ -237,9 +237,9 @@ def fit_approach_retract(self, fdist, update_ui=True):
read_only=True)
for ii, p in enumerate(varps):
# Get the human readable name of the parameter
name = self.fit_model.parameter_keys.index(p.name)
hrname = self.fit_model.parameter_names[name]
si_unit = self.fit_model.parameter_units[ii]
idp = self.fit_model.parameter_keys.index(p.name)
hrname = self.fit_model.parameter_names[idp]
si_unit = self.fit_model.parameter_units[idp]
label = units.hrscname(hrname, si_unit=si_unit)
ftab.verticalHeaderItem(ii).setText(label)
ftab.item(ii, 0).setText("nan")
Expand Down
4 changes: 4 additions & 0 deletions pyjibe/units.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def hrunit(name, si_unit=None):
if name in human_units:
scalename, unit = human_units[name]
scaleunit = scalename + unit
if si_unit is not None and si_unit != unit:
raise ValueError(
"Bad `si_unit` '{}' given for '{}', expected '{}'! ".format(
si_unit, name, unit))
elif si_unit in default_scales:
scaleunit = default_scales[si_unit] + si_unit
elif si_unit is not None:
Expand Down

0 comments on commit 39e1bb5

Please sign in to comment.