source: sasview/sansmodels/src/sans/models/c_models/lamellar.cpp @ 42f193a

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 42f193a was 42f193a, checked in by Jae Cho <jhjcho@…>, 15 years ago

some corrections on dips-parameters and adding 2D cal

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/**
2        This software was developed by the University of Tennessee as part of the
3        Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4        project funded by the US National Science Foundation.
5
6        If you use DANSE applications to do scientific research that leads to
7        publication, we ask that you acknowledge the use of the software with the
8        following sentence:
9
10        "This work benefited from DANSE software developed under NSF award DMR-0520547."
11
12        copyright 2008, University of Tennessee
13 */
14
15/**
16 * Scattering model classes
17 * The classes use the IGOR library found in
18 *   sansmodels/src/libigor
19 *
20 *      TODO: refactor so that we pull in the old sansmodels.c_extensions
21 */
22
23#include <math.h>
24#include "models.hh"
25#include "parameters.hh"
26#include <stdio.h>
27using namespace std;
28
29extern "C" {
30        #include "libCylinder.h"
31        #include "lamellar.h"
32}
33
34LamellarModel :: LamellarModel() {
35        scale      = Parameter(1.0);
36        delta     = Parameter(50.0);
37        delta.set_min(0.0);
38        sigma    = Parameter(0.15);
39        sigma.set_min(0.0);
40        contrast   = Parameter(5.3e-6);
41        background = Parameter(0.0);
42
43}
44
45/**
46 * Function to evaluate 1D scattering function
47 * The NIST IGOR library is used for the actual calculation.
48 * @param q: q-value
49 * @return: function value
50 */
51double LamellarModel :: operator()(double q) {
52        double dp[5];
53
54        // Fill parameter array for IGOR library
55        // Add the background after averaging
56        dp[0] = scale();
57        dp[1] = delta();
58        dp[2] = sigma();
59        dp[3] = contrast();
60        dp[4] = background();
61
62        return LamellarFF(dp, q);
63}
64
65/**
66 * Function to evaluate 2D scattering function
67 * @param q_x: value of Q along x
68 * @param q_y: value of Q along y
69 * @return: function value
70 */
71
72double LamellarModel :: operator()(double qx, double qy) {
73        double q = sqrt(qx*qx + qy*qy);
74        return (*this).operator()(q);
75}
76
77/**
78 * Function to evaluate 2D scattering function
79 * @param pars: parameters of the lamellar
80 * @param q: q-value
81 * @param phi: angle phi
82 * @return: function value
83 */
84double LamellarModel :: evaluate_rphi(double q, double phi) {
85        return (*this).operator()(q);
86}
Note: See TracBrowser for help on using the repository browser.