Skip to content

Commit

Permalink
model: add start values and frozen values to the printed parameter ta…
Browse files Browse the repository at this point in the history
…ble (#369)
  • Loading branch information
luisfabib authored Aug 10, 2022
1 parent 2112615 commit d2dd2eb
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 113 deletions.
9 changes: 5 additions & 4 deletions deerlab/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,17 +620,18 @@ def _parameter_table(self):
""")
string += '\n'
table = []
table.append(['Name','Lower','Upper','Type','Frozen','Unit','Description'])
alignment = ['<','^','^','^','^','^','<']
table.append(['Name','Lower','Start','Upper','Type','Frozen','Unit','Description'])
alignment = ['<','^','^','^','^','^','^','<']
for n,paramname in enumerate(self._parameter_list(order='vector')):
param_str = paramname
lb_str = f'{np.atleast_1d(getattr(self,paramname).lb)[0]:5.3g}'
ub_str = f'{np.atleast_1d(getattr(self,paramname).ub)[0]:5.3g}'
par0_str = f'{np.atleast_1d(getattr(self,paramname).par0)[0]:5.3g}' if np.atleast_1d(getattr(self,paramname).par0)[0] is not None else "-"
linear_str = "linear" if np.all(getattr(self,paramname).linear) else "nonlin"
frozen_str = "Yes" if np.all(getattr(self,paramname).frozen) else "No"
frozen_str = f'{np.atleast_1d(getattr(self,paramname).value)[0]:5.3g}' if np.all(getattr(self,paramname).frozen) else "No"
unit_str = str(getattr(self,paramname).unit)
desc_str = str(getattr(self,paramname).description)
table.append([param_str,lb_str,ub_str,linear_str,frozen_str,unit_str,desc_str])
table.append([param_str,lb_str,par0_str,ub_str,linear_str,frozen_str,unit_str,desc_str])
string += formatted_table(table,alignment)
return string
#---------------------------------------------------------------------------------------
Expand Down
24 changes: 12 additions & 12 deletions docsrc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ Parametric distance distributions
Signature: (r, mean, std)
Constants: [r]
Parameter Table:
======= ======= ======= ======== ======== ======= ====================
Name Lower Upper Type Frozen Units Description
======= ======= ======= ======== ======== ======= ====================
mean 1 20 nonlin No nm Mean
std 0.05 2.5 nonlin No nm Standard deviation
======= ======= ======= ======== ======== ======= ====================
====== ======= ======= ======= ======== ======== ====== ====================
Name Lower Start Upper Type Frozen Unit Description
====== ======= ======= ======= ======== ======== ====== ====================
mean 1 3.5 20 nonlin No nm Mean
std 0.05 0.2 2.5 nonlin No nm Standard deviation
====== ======= ======= ======= ======== ======== ====== ====================

In least-squares fitting, non-parametric distance distributions make fewer assumptions about the distribution than parametric distance distributions. They are more flexible and introduce less bias.
Expand All @@ -57,12 +57,12 @@ In DeerLab, all inter-molecular contributions to the dipolar modulation (i.e. th
Signature: (t, conc, lam)
Constants: [t]
Parameter Table:
====== ======= ======= ======== ======== ======= ====================
Name Lower Upper Type Frozen Units Description
====== ======= ======= ======== ======== ======= ====================
conc 0.01 5e+03 nonlin No μM Spin concentration
lam 0 1 nonlin No Pathway amplitude
====== ======= ======= ======== ======== ======= ====================
====== ======= ======= ======= ======== ======== ====== ====================
Name Lower Start Upper Type Frozen Unit Description
====== ======= ======= ======= ======== ======== ====== ====================
conc 0.01 50 5e+03 nonlin No μM Spin concentration
lam 0 1 1 nonlin No Pathway amplitude
====== ======= ======= ======= ======== ======== ====== ====================


DeerLab's :ref:`background models<modelsref_bg>` fall into two categories, physical and phenomenological:
Expand Down
16 changes: 8 additions & 8 deletions docsrc/source/dipolar_guide_modelling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ A full summary of the constructed model(s) can be inspected by printing the mode
Signature: (mod, reftime, conc, P)
Constants: []
Parameter Table:
========= ======= ======= ======== ======== ======= ======================================
Name Lower Upper Type Frozen Units Description
========= ======= ======= ======== ======== ======= ======================================
mod 0 1 nonlin No Modulation depth
reftime 0.4 0.6 nonlin No μs Refocusing time
conc 0.01 5e+03 nonlin No μM Spin concentration
P 0 inf linear No None Non-parametric distance distribution
========= ======= ======= ======== ======== ======= ======================================
========= ======= ======= ======= ======== ======== ====== ======================================
Name Lower Start Upper Type Frozen Unit Description
========= ======= ======= ======= ======== ======== ====== ======================================
mod 0 0.01 1 nonlin No Modulation depth
reftime -inf 0 inf nonlin No μs Refocusing time
conc 0.01 50 5e+03 nonlin No μM Spin concentration
P 0 0 inf linear No nm⁻¹ Non-parametric distance distribution
========= ======= ======= ======= ======== ======== ====== ======================================


From this point on, the model can be modified, manipulated and expanded freely as any other DeerLab model. Check out the :ref:`modelling guide <modelling_guide>` for more details and instructions on model manipulation.
Expand Down
Loading

0 comments on commit d2dd2eb

Please sign in to comment.