FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
libdiffpy/src/diffpy/srreal/GaussianProfile.cpp at develop · cfarrow/libdiffpy · GitHub
cfarrow
libdiffpy
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
libdiffpy
/
src
/
diffpy
/
srreal
/
GaussianProfile.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
98 lines (74 loc) · 2.43 KB
Breadcrumbs
libdiffpy
/
src
/
diffpy
/
srreal
/
GaussianProfile.cpp
Copy path
File metadata and controls
98 lines (74 loc) · 2.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
****************************************************************************
*
* diffpy.srreal by DANSE Diffraction group
* Simon J. L. Billinge
* (c) 2009 Trustees of the Columbia University
* in the City of New York. All rights reserved.
*
* File coded by: Pavol Juhas
*
* See AUTHORS.txt for a list of people who contributed.
* See LICENSE.txt for license information.
*
******************************************************************************
*
* class GaussianProfile -- concrete implementation of the PeakProfile class.
* GaussianProfile is registered as "gaussian".
*
****************************************************************************
*/
#
include
<
cmath
>
#
include
<
diffpy/srreal/GaussianProfile.hpp
>
#
include
<
diffpy/mathutils.hpp
>
using
namespace
std
;
namespace
diffpy
{
namespace
srreal
{
//
Constructors --------------------------------------------------------------
GaussianProfile::GaussianProfile
() : mhalfboundrel(
0.0
)
{ }
PeakProfilePtr
GaussianProfile::create
()
const
{
PeakProfilePtr
rv
(
new
GaussianProfile
());
return
rv;
}
PeakProfilePtr
GaussianProfile::clone
()
const
{
PeakProfilePtr
rv
(
new
GaussianProfile
(*
this
));
return
rv;
}
//
Public Methods ------------------------------------------------------------
const
string&
GaussianProfile::type
()
const
{
static
string rv =
"
gaussian
"
;
return
rv;
}
double
GaussianProfile::operator
()(
double
x,
double
fwhm)
const
{
if
( fwhm <=
0
)
return
0.0
;
double
xrel = x / fwhm;
double
rv =
2
*
sqrt
(
M_LN2
/
M_PI
) / fwhm *
exp
(-
4
*
M_LN2
* xrel * xrel);
return
rv;
}
double
GaussianProfile::xboundlo
(
double
fwhm)
const
{
return
-
1
*
this
->
GaussianProfile
::xboundhi
(fwhm);
}
double
GaussianProfile::xboundhi
(
double
fwhm)
const
{
double
rv = (fwhm <=
0.0
) ?
0.0
: (mhalfboundrel * fwhm);
return
rv;
}
void
GaussianProfile::setPrecision
(
double
eps)
{
using
diffpy::mathutils::
DOUBLE_EPS
;
using
diffpy::mathutils::
DOUBLE_MAX
;
//
correct any settings below DOUBLE_EPS
double
eps1 =
max
(eps,
DOUBLE_EPS
);
this
->
PeakProfile
::setPrecision
(eps1);
if
(eps1 <
1.0
) mhalfboundrel =
sqrt
(-
log
(eps1) / (
4
*
M_LN2
));
else
mhalfboundrel =
0.0
;
}
//
Registration --------------------------------------------------------------
bool
reg_GaussianProfile = GaussianProfile().registerThisType();
}
//
namespace srreal
}
//
namespace diffpy
//
End of file
Back
|
FazBrowse Home
|
New Git URL