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
27da7fc3
Commit
27da7fc3
authored
Dec 13, 2012
by
Chun Hong Yoon
Browse files
more user options for beam photon energy
parent
7e704453
Changes
4
Hide whitespace changes
Inline
Side-by-side
libcrystfel/src/beam-parameters.c
View file @
27da7fc3
...
...
@@ -8,6 +8,7 @@
*
* Authors:
* 2010,2012 Thomas White <taw@physics.org>
* 2012 Chunhong Yoon
*
* This file is part of CrystFEL.
*
...
...
@@ -35,6 +36,7 @@
#include
"beam-parameters.h"
#include
"utils.h"
#include
"hdf5-file.h"
struct
beam_params
*
get_beam_parameters
(
const
char
*
filename
)
...
...
@@ -86,7 +88,12 @@ struct beam_params *get_beam_parameters(const char *filename)
}
else
if
(
strcmp
(
bits
[
0
],
"beam/radius"
)
==
0
)
{
b
->
beam_radius
=
atof
(
bits
[
2
]);
}
else
if
(
strcmp
(
bits
[
0
],
"beam/photon_energy"
)
==
0
)
{
b
->
photon_energy
=
atof
(
bits
[
2
]);
if
(
strncmp
(
bits
[
2
],
"/"
,
1
)
==
0
)
{
b
->
photon_energy
=
0
;
// 0 means special case
b
->
photon_energy_from
=
strdup
(
bits
[
2
]);
}
else
{
b
->
photon_energy
=
atof
(
bits
[
2
]);
}
}
else
if
(
strcmp
(
bits
[
0
],
"beam/bandwidth"
)
==
0
)
{
b
->
bandwidth
=
atof
(
bits
[
2
]);
}
else
if
(
strcmp
(
bits
[
0
],
"beam/divergence"
)
==
0
)
{
...
...
@@ -113,7 +120,7 @@ struct beam_params *get_beam_parameters(const char *filename)
ERROR
(
"Invalid or unspecified value for 'beam/radius'.
\n
"
);
reject
=
1
;
}
if
(
b
->
photon_energy
<
0
.
0
)
{
if
(
b
->
photon_energy
<
0
.
0
)
{
// 0 is ok
ERROR
(
"Invalid or unspecified value for"
" 'beam/photon_energy'.
\n
"
);
reject
=
1
;
...
...
@@ -141,3 +148,12 @@ struct beam_params *get_beam_parameters(const char *filename)
return
b
;
}
void
fill_in_beamParam
(
struct
beam_params
*
beam
,
struct
hdfile
*
f
)
{
if
(
beam
->
photon_energy_from
!=
NULL
)
{
beam
->
photon_energy
=
get_value
(
f
,
beam
->
photon_energy_from
);
free
(
beam
->
photon_energy_from
);
beam
->
photon_energy_from
=
NULL
;
}
}
libcrystfel/src/beam-parameters.h
View file @
27da7fc3
...
...
@@ -8,6 +8,7 @@
*
* Authors:
* 2010,2012 Thomas White <taw@physics.org>
* 2012 Chunhong Yoon
*
* This file is part of CrystFEL.
*
...
...
@@ -33,6 +34,7 @@
#include
<config.h>
#endif
#include
"hdf5-file.h"
struct
beam_params
{
...
...
@@ -46,10 +48,13 @@ struct beam_params
double
divergence
;
/* divergence (radians) */
double
profile_radius
;
/* Reciprocal space size of a reflection */
char
*
photon_energy_from
;
/* hdf5 group name */
};
extern
struct
beam_params
*
get_beam_parameters
(
const
char
*
filename
);
extern
void
fill_in_beamParam
(
struct
beam_params
*
beam
,
struct
hdfile
*
f
);
#endif
/* BEAM_PARAMETERS_H */
src/im-sandbox.c
View file @
27da7fc3
...
...
@@ -235,6 +235,11 @@ static void process_image(const struct index_args *iargs,
return
;
}
if
(
beam
->
photon_energy
==
0
)
{
// read from existing hdf5
fill_in_beamParam
(
beam
,
hdfile
);
}
image
.
lambda
=
ph_en_to_lambda
(
eV_to_J
(
beam
->
photon_energy
));
if
(
image
.
lambda
<
0
.
0
)
{
if
(
beam
!=
NULL
)
{
ERROR
(
"Using nominal photon energy of %.2f eV
\n
"
,
...
...
src/pattern_sim.c
View file @
27da7fc3
...
...
@@ -498,7 +498,12 @@ int main(int argc, char *argv[])
/* Define image parameters */
image
.
width
=
image
.
det
->
max_fs
+
1
;
image
.
height
=
image
.
det
->
max_ss
+
1
;
image
.
lambda
=
ph_en_to_lambda
(
eV_to_J
(
image
.
beam
->
photon_energy
));
if
(
image
.
beam
->
photon_energy
==
0
)
{
ERROR
(
"Invalid photon_energy format in beam file
\n
"
)
return
1
;
}
else
{
image
.
lambda
=
ph_en_to_lambda
(
eV_to_J
(
image
.
beam
->
photon_energy
));
}
image
.
bw
=
image
.
beam
->
bandwidth
;
image
.
div
=
image
.
beam
->
divergence
;
...
...
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