ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change
on this file since 077207b was
f8644dd,
checked in by Kieran Campbell <kieranrcampbell@…>, 12 years ago
|
Fixed calculation functions to pass unit tests
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | |
---|
2 | /** |
---|
3 | This software was developed by Institut Laue-Langevin as part of |
---|
4 | Distributed Data Analysis of Neutron Scattering Experiments (DANSE). |
---|
5 | |
---|
6 | Copyright 2012 Institut Laue-Langevin |
---|
7 | |
---|
8 | **/ |
---|
9 | |
---|
10 | /** |
---|
11 | |
---|
12 | Scattering model class for the DAB (Debye Anderson Brumberger) Model |
---|
13 | |
---|
14 | **/ |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | #include <math.h> |
---|
19 | #include "parameters.hh" |
---|
20 | #include "dabmodel.h" |
---|
21 | |
---|
22 | DABModel::DABModel() { |
---|
23 | length = Parameter(50.0); |
---|
24 | scale = Parameter(1.0); |
---|
25 | background = Parameter(0.0); |
---|
26 | |
---|
27 | } |
---|
28 | |
---|
29 | double DABModel::operator()(double q) { |
---|
30 | double d_length = length(); |
---|
31 | double d_scale = scale(); |
---|
32 | double d_background = background(); |
---|
33 | |
---|
34 | double numerator = d_scale*pow(d_length,3); |
---|
35 | double denominator = pow(1 + pow(q*d_length,2),2); |
---|
36 | |
---|
37 | return numerator / denominator + d_background; |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | } |
---|
42 | |
---|
43 | double DABModel::operator()(double qx,double qy) { |
---|
44 | double q = sqrt(qx*qx + qy*qy); |
---|
45 | return this->operator()(q); |
---|
46 | } |
---|
47 | |
---|
48 | double DABModel::calculate_ER() { |
---|
49 | // not implemented yet |
---|
50 | return 0.0; |
---|
51 | } |
---|
52 | |
---|
53 | double DABModel::calculate_VR() { |
---|
54 | return 1.0; |
---|
55 | } |
---|
56 | |
---|
57 | double DABModel::evaluate_rphi(double q,double phi) { |
---|
58 | double qx = q * cos(phi); |
---|
59 | double qy = q * sin(phi); |
---|
60 | return this->operator()(qx,qy); |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.