Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Oleksii Turkot
CrystFEL
Commits
c6af54b9
Commit
c6af54b9
authored
Jul 14, 2011
by
Thomas White
Browse files
partial_sim: Use flat noise in cell parameters
parent
812bce99
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/partial_sim.c
View file @
c6af54b9
...
...
@@ -44,15 +44,15 @@ static void mess_up_cell(UnitCell *cell)
//cell_print(cell);
cell_get_reciprocal
(
cell
,
&
ax
,
&
ay
,
&
az
,
&
bx
,
&
by
,
&
bz
,
&
cx
,
&
cy
,
&
cz
);
ax
=
gaussian
_noise
(
ax
,
cnoise
*
fabs
(
ax
)
/
100
.
0
);
ay
=
gaussian
_noise
(
ay
,
cnoise
*
fabs
(
ay
)
/
100
.
0
);
az
=
gaussian
_noise
(
az
,
cnoise
*
fabs
(
az
)
/
100
.
0
);
bx
=
gaussian
_noise
(
bx
,
cnoise
*
fabs
(
bx
)
/
100
.
0
);
by
=
gaussian
_noise
(
by
,
cnoise
*
fabs
(
by
)
/
100
.
0
);
bz
=
gaussian
_noise
(
bz
,
cnoise
*
fabs
(
bz
)
/
100
.
0
);
cx
=
gaussian
_noise
(
cx
,
cnoise
*
fabs
(
cx
)
/
100
.
0
);
cy
=
gaussian
_noise
(
cy
,
cnoise
*
fabs
(
cy
)
/
100
.
0
);
cz
=
gaussian
_noise
(
cz
,
cnoise
*
fabs
(
cz
)
/
100
.
0
);
ax
=
flat
_noise
(
ax
,
cnoise
*
fabs
(
ax
)
/
100
.
0
);
ay
=
flat
_noise
(
ay
,
cnoise
*
fabs
(
ay
)
/
100
.
0
);
az
=
flat
_noise
(
az
,
cnoise
*
fabs
(
az
)
/
100
.
0
);
bx
=
flat
_noise
(
bx
,
cnoise
*
fabs
(
bx
)
/
100
.
0
);
by
=
flat
_noise
(
by
,
cnoise
*
fabs
(
by
)
/
100
.
0
);
bz
=
flat
_noise
(
bz
,
cnoise
*
fabs
(
bz
)
/
100
.
0
);
cx
=
flat
_noise
(
cx
,
cnoise
*
fabs
(
cx
)
/
100
.
0
);
cy
=
flat
_noise
(
cy
,
cnoise
*
fabs
(
cy
)
/
100
.
0
);
cz
=
flat
_noise
(
cz
,
cnoise
*
fabs
(
cz
)
/
100
.
0
);
cell_set_reciprocal
(
cell
,
ax
,
ay
,
az
,
bx
,
by
,
bz
,
cx
,
cy
,
cz
);
//STATUS("Changed:\n");
...
...
src/utils.c
View file @
c6af54b9
...
...
@@ -121,6 +121,19 @@ void progress_bar(int val, int total, const char *text)
}
double
random_flat
(
double
max
)
{
return
max
*
(
double
)
random
()
/
RAND_MAX
;
}
double
flat_noise
(
double
expected
,
double
width
)
{
double
noise
=
random_flat
(
2
.
0
*
width
);
return
expected
+
noise
-
width
;
}
double
gaussian_noise
(
double
expected
,
double
stddev
)
{
double
x1
,
x2
,
noise
;
...
...
src/utils.h
View file @
c6af54b9
...
...
@@ -91,6 +91,8 @@ extern int assplode(const char *a, const char *delims, char ***pbits,
AssplodeFlag
flags
);
extern
void
progress_bar
(
int
val
,
int
total
,
const
char
*
text
);
extern
double
random_flat
(
double
max
);
extern
double
flat_noise
(
double
expected
,
double
width
);
extern
double
gaussian_noise
(
double
expected
,
double
stddev
);
extern
int
poisson_noise
(
double
expected
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment