aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-04-05 15:59:56 +0800
committerAaron LI <aaronly.me@outlook.com>2016-04-05 15:59:56 +0800
commite7faf7f1c7f04149627a2d3dd77edb23dc17a561 (patch)
tree52b573ea125520bb5eefad9a5d154e5e9c2f3d3e /python
parentc7b96a8712c91c0d00b4facaaf52554d267d5f51 (diff)
downloadatoolbox-e7faf7f1c7f04149627a2d3dd77edb23dc17a561.tar.bz2
sbp_fit.py: allow fix parameter
Diffstat (limited to 'python')
-rw-r--r--python/sbp_fit.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/python/sbp_fit.py b/python/sbp_fit.py
index 0ce8d4d..c9a67a5 100644
--- a/python/sbp_fit.py
+++ b/python/sbp_fit.py
@@ -3,9 +3,11 @@
#
# Aaron LI
# Created: 2016-03-13
-# Updated: 2016-03-31
+# Updated: 2016-04-05
#
# Changelogs:
+# 2016-04-05:
+# * Allow fix parameters
# 2016-03-31:
# * Remove `ci_report()'
# * Add `make_results()' to orgnize all results as s Python dictionary
@@ -21,6 +23,9 @@
# * Add `ignore_data()' and `notice_data()' support
# * Add classes `FitModelSBetaNorm' and `FitModelDBetaNorm'
#
+# TODO:
+# * to allow fit the outer beta component, then fix it, and fit the inner one
+#
"""
Fit the surface brightness profile (SBP) with the single-beta model:
@@ -66,8 +71,9 @@ bkg = 1.0e-9, 0.0, 1.0e-7
-------------------------------------------------
"""
-__version__ = "0.5.0"
-__date__ = "2016-03-31"
+__version__ = "0.5.1"
+__date__ = "2016-04-05"
+
import numpy as np
import lmfit
@@ -581,8 +587,11 @@ def make_model(config):
# set initial values and bounds for the model parameters
params = config.get(modelname)
for p, value in params.items():
+ variable = True
+ if len(value) == 4 and value[3].upper() in ["FIXED", "FALSE"]:
+ variable = False
model.set_param(name=p, value=float(value[0]),
- min=float(value[1]), max=float(value[2]))
+ min=float(value[1]), max=float(value[2]), vary=variable)
return model