aboutsummaryrefslogtreecommitdiffstats
path: root/vmodels/beta1d.hpp
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2010-02-08 09:23:14 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2010-02-08 09:23:14 +0000
commitdb1d374b7a24b8f3f74e17d706704d93f1e66d90 (patch)
treef6043b9df2ebfca0b4fea721e14d861785e985a5 /vmodels/beta1d.hpp
parent435b4484e00b1ac3b6ee5e87b81f5b8af4f1e653 (diff)
downloadopt-utilities-db1d374b7a24b8f3f74e17d706704d93f1e66d90.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@110 ed2142bd-67ad-457f-ba7c-d818d4011675
Diffstat (limited to 'vmodels/beta1d.hpp')
-rw-r--r--vmodels/beta1d.hpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/vmodels/beta1d.hpp b/vmodels/beta1d.hpp
new file mode 100644
index 0000000..42be3fd
--- /dev/null
+++ b/vmodels/beta1d.hpp
@@ -0,0 +1,64 @@
+#ifndef VBETA_MODEL_H_
+#define VBETA_MODEL_H_
+#define OPT_HEADER
+#include <core/fitter.hpp>
+#include <misc/optvec.hpp>
+#include <cmath>
+
+namespace opt_utilities
+{
+ template <typename T>
+ class beta1d
+ :public model<optvec<T>,optvec<T>,optvec<T>,std::string>
+ {
+ typedef optvec<T> Tv;
+ private:
+ beta1d<T>* do_clone()const
+ {
+ return new beta1d<T>(*this);
+ }
+
+ const char* do_get_type_name()const
+ {
+ return "1d surface brightness beta model";
+ }
+ public:
+ beta1d()
+ {
+ this->push_param_info(param_info<Tv>("S0",1));
+ this->push_param_info(param_info<Tv>("rc",10));
+ this->push_param_info(param_info<Tv>("beta",2./3.));
+ this->push_param_info(param_info<Tv>("bkg",0));
+ }
+
+ public:
+ Tv do_eval(const Tv& x,const Tv& param)
+ {
+ Tv result(x.size());
+ T S0=get_element(param,0);
+ T r_c=get_element(param,1);
+ T beta=get_element(param,2);
+ T bkg=get_element(param,3);
+
+ //return x*get_element(param,0)+get_element(param,1);
+ for(size_t i=0;i!=x.size();++i)
+ {
+
+ result[i]=bkg+S0*pow(1+(x[i]*x[i])/(r_c*r_c),-3*beta+static_cast<T>(.5));
+
+ }
+ return result;
+ }
+
+ private:
+ std::string do_get_information()const
+ {
+ return "";
+ }
+ };
+}
+
+
+
+#endif
+//EOF