Skip to content
GitLab
Menu
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
f7d612eb
Commit
f7d612eb
authored
Oct 21, 2010
by
Thomas White
Committed by
Thomas White
Feb 22, 2012
Browse files
s/hit/cpeak/
Avoid confusion over the use of the word 'hit'.
parent
66d003e0
Changes
11
Hide whitespace changes
Inline
Side-by-side
src/calibrate_detector.c
View file @
f7d612eb
...
...
@@ -168,8 +168,8 @@ static void add_image(void *args, int cookie)
image
.
flags
=
NULL
;
image
.
indexed_cell
=
NULL
;
image
.
filename
=
pargs
->
filename
;
image
.
hit
s
=
NULL
;
image
.
n_
hit
s
=
0
;
image
.
cpeak
s
=
NULL
;
image
.
n_
cpeak
s
=
0
;
image
.
det
=
NULL
;
/* View head-on (unit cell is tilted) */
...
...
src/cubeit.c
View file @
f7d612eb
...
...
@@ -216,8 +216,8 @@ static void sum_image(void *pg, int cookie)
image
.
flags
=
NULL
;
image
.
indexed_cell
=
NULL
;
image
.
filename
=
apargs
->
filename
;
image
.
hit
s
=
NULL
;
image
.
n_
hit
s
=
0
;
image
.
cpeak
s
=
NULL
;
image
.
n_
cpeak
s
=
0
;
image
.
det
=
pargs
->
det
;
/* View head-on (unit cell is tilted) */
...
...
src/facetron.c
View file @
f7d612eb
...
...
@@ -87,7 +87,7 @@ static void integrate_image(int mytask, void *tasks)
{
struct
integrate_args
*
all_args
=
tasks
;
struct
integrate_args
*
pargs
=
&
all_args
[
mytask
];
struct
reflhit
*
spots
;
struct
cpeak
*
spots
;
int
j
,
n
;
struct
hdfile
*
hdfile
;
struct
image
*
image
=
pargs
->
image
;
...
...
src/geometry.c
View file @
f7d612eb
...
...
@@ -22,24 +22,24 @@
#include
"peaks.h"
#define MAX_
HIT
S (1024)
#define MAX_
CPEAK
S (1024)
struct
reflhit
*
find_intersections
(
struct
image
*
image
,
UnitCell
*
cell
,
double
divergence
,
double
bandwidth
,
int
*
n
,
int
output
)
struct
cpeak
*
find_intersections
(
struct
image
*
image
,
UnitCell
*
cell
,
double
divergence
,
double
bandwidth
,
int
*
n
,
int
output
)
{
double
asx
,
asy
,
asz
;
double
bsx
,
bsy
,
bsz
;
double
csx
,
csy
,
csz
;
struct
reflhit
*
hit
s
;
struct
cpeak
*
cpeak
s
;
int
np
=
0
;
int
hmax
,
kmax
,
lmax
;
double
mres
;
signed
int
h
,
k
,
l
;
hit
s
=
malloc
(
sizeof
(
struct
reflhit
)
*
MAX_
HIT
S
);
if
(
hit
s
==
NULL
)
{
cpeak
s
=
malloc
(
sizeof
(
struct
cpeak
)
*
MAX_
CPEAK
S
);
if
(
cpeak
s
==
NULL
)
{
*
n
=
0
;
return
NULL
;
}
...
...
@@ -118,11 +118,11 @@ struct reflhit *find_intersections(struct image *image, UnitCell *cell,
if
(
!
found
)
continue
;
hit
s
[
np
].
h
=
h
;
hit
s
[
np
].
k
=
k
;
hit
s
[
np
].
l
=
l
;
hit
s
[
np
].
x
=
xda
;
hit
s
[
np
].
y
=
yda
;
cpeak
s
[
np
].
h
=
h
;
cpeak
s
[
np
].
k
=
k
;
cpeak
s
[
np
].
l
=
l
;
cpeak
s
[
np
].
x
=
xda
;
cpeak
s
[
np
].
y
=
yda
;
np
++
;
if
(
output
)
{
...
...
@@ -134,7 +134,7 @@ struct reflhit *find_intersections(struct image *image, UnitCell *cell,
}
*
n
=
np
;
return
hit
s
;
return
cpeak
s
;
}
...
...
@@ -145,7 +145,7 @@ double partiality(struct image *image, signed int h, signed int k, signed int l)
}
double
integrate_all
(
struct
image
*
image
,
struct
reflhit
*
hit
s
,
int
n
)
double
integrate_all
(
struct
image
*
image
,
struct
cpeak
*
cpeak
s
,
int
n
)
{
double
itot
=
0
.
0
;
int
i
;
...
...
@@ -154,7 +154,7 @@ double integrate_all(struct image *image, struct reflhit *hits, int n)
float
x
,
y
,
intensity
;
if
(
integrate_peak
(
image
,
hit
s
[
i
].
x
,
hit
s
[
i
].
y
,
&
x
,
&
y
,
if
(
integrate_peak
(
image
,
cpeak
s
[
i
].
x
,
cpeak
s
[
i
].
y
,
&
x
,
&
y
,
&
intensity
,
NULL
,
NULL
,
0
,
0
)
)
continue
;
itot
+=
intensity
;
...
...
src/geometry.h
View file @
f7d612eb
...
...
@@ -17,13 +17,13 @@
#include
<config.h>
#endif
extern
struct
reflhit
*
find_intersections
(
struct
image
*
image
,
UnitCell
*
cell
,
double
divergence
,
double
bandwidth
,
int
*
n
,
int
output
);
extern
struct
cpeak
*
find_intersections
(
struct
image
*
image
,
UnitCell
*
cell
,
double
divergence
,
double
bandwidth
,
int
*
n
,
int
output
);
extern
double
partiality
(
struct
image
*
image
,
signed
int
h
,
signed
int
k
,
signed
int
l
);
extern
double
integrate_all
(
struct
image
*
image
,
struct
reflhit
*
hit
s
,
int
n
);
extern
double
integrate_all
(
struct
image
*
image
,
struct
cpeak
*
cpeak
s
,
int
n
);
#endif
/* GEOMETRY_H */
src/image.h
View file @
f7d612eb
...
...
@@ -58,7 +58,8 @@ struct imagefeature {
typedef
struct
_imagefeaturelist
ImageFeatureList
;
struct
reflhit
{
/* This structure represents a predicted peak in an image */
struct
cpeak
{
signed
int
h
;
signed
int
k
;
signed
int
l
;
...
...
@@ -79,8 +80,8 @@ struct image {
int
ncells
;
struct
detector
*
det
;
char
*
filename
;
struct
reflhit
*
hit
s
;
int
n_
hit
s
;
struct
cpeak
*
cpeak
s
;
int
n_
cpeak
s
;
int
id
;
/* ID number of the thread
* handling this image */
...
...
src/indexamajig.c
View file @
f7d612eb
/*
* indexamajig.c
*
*
Find hits, i
ndex patterns, output hkl+intensity etc.
*
I
ndex patterns, output hkl+intensity etc.
*
* (c) 2006-2010 Thomas White <taw@physics.org>
*
...
...
@@ -258,8 +258,8 @@ static struct image *get_simage(struct image *template, int alternate)
image
->
f0
=
template
->
f0
;
/* Prevent muppetry */
image
->
hit
s
=
NULL
;
image
->
n_
hit
s
=
0
;
image
->
cpeak
s
=
NULL
;
image
->
n_
cpeak
s
=
0
;
return
image
;
}
...
...
@@ -317,8 +317,8 @@ static void process_image(void *pp, int cookie)
image
.
indexed_cell
=
NULL
;
image
.
id
=
cookie
;
image
.
filename
=
filename
;
image
.
hit
s
=
NULL
;
image
.
n_
hit
s
=
0
;
image
.
cpeak
s
=
NULL
;
image
.
n_
cpeak
s
=
0
;
image
.
det
=
pargs
->
static_args
.
det
;
/* View head-on (unit cell is tilted) */
...
...
@@ -442,7 +442,7 @@ done:
free
(
image
.
data
);
free
(
image
.
flags
);
image_feature_list_free
(
image
.
features
);
free
(
image
.
hit
s
);
free
(
image
.
cpeak
s
);
hdfile_close
(
hdfile
);
}
...
...
src/peaks.c
View file @
f7d612eb
...
...
@@ -33,7 +33,7 @@
/* Maximum number of peaks which may be predicted by find_projected_peaks() */
#define MAX_
HIT
S (1024)
#define MAX_
CPEAK
S (1024)
/* How close a peak must be to an indexed position to be considered "close"
* for the purposes of double hit detection and sanity checking. */
...
...
@@ -495,12 +495,12 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
double
ax
,
ay
,
az
;
double
bx
,
by
,
bz
;
double
cx
,
cy
,
cz
;
struct
reflhit
*
hit
s
;
int
n_
hit
s
=
0
;
struct
cpeak
*
cpeak
s
;
int
n_
cpeak
s
=
0
;
double
alen
,
blen
,
clen
;
hit
s
=
malloc
(
sizeof
(
struct
reflhit
)
*
MAX_
HIT
S
);
if
(
hit
s
==
NULL
)
return
0
;
cpeak
s
=
malloc
(
sizeof
(
struct
cpeak
)
*
MAX_
CPEAK
S
);
if
(
cpeak
s
==
NULL
)
return
0
;
/* "Borrow" direction values to get reciprocal lengths */
cell_get_reciprocal
(
cell
,
&
ax
,
&
ay
,
&
az
,
&
bx
,
&
by
,
&
bz
,
&
cx
,
&
cy
,
&
cz
);
...
...
@@ -547,14 +547,14 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
if
(
dist
>
domain_r
)
continue
;
}
for
(
j
=
0
;
j
<
n_
hit
s
;
j
++
)
{
if
(
(
hit
s
[
j
].
h
==
h
)
&&
(
hit
s
[
j
].
k
==
k
)
&&
(
hit
s
[
j
].
l
==
l
)
)
{
for
(
j
=
0
;
j
<
n_
cpeak
s
;
j
++
)
{
if
(
(
cpeak
s
[
j
].
h
==
h
)
&&
(
cpeak
s
[
j
].
k
==
k
)
&&
(
cpeak
s
[
j
].
l
==
l
)
)
{
if
(
dist
<
hit
s
[
j
].
min_distance
)
{
hit
s
[
j
].
min_distance
=
dist
;
hit
s
[
j
].
x
=
x
;
hit
s
[
j
].
y
=
y
;
if
(
dist
<
cpeak
s
[
j
].
min_distance
)
{
cpeak
s
[
j
].
min_distance
=
dist
;
cpeak
s
[
j
].
x
=
x
;
cpeak
s
[
j
].
y
=
y
;
}
found
=
1
;
...
...
@@ -563,14 +563,14 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
}
if
(
!
found
)
{
hits
[
n_hit
s
].
min_distance
=
dist
;
hits
[
n_hit
s
].
x
=
x
;
hits
[
n_hit
s
].
y
=
y
;
hits
[
n_hit
s
].
h
=
h
;
hits
[
n_hit
s
].
k
=
k
;
hits
[
n_hit
s
].
l
=
l
;
n_
hit
s
++
;
if
(
n_
hit
s
==
MAX_
HIT
S
)
{
cpeaks
[
n_cpeak
s
].
min_distance
=
dist
;
cpeaks
[
n_cpeak
s
].
x
=
x
;
cpeaks
[
n_cpeak
s
].
y
=
y
;
cpeaks
[
n_cpeak
s
].
h
=
h
;
cpeaks
[
n_cpeak
s
].
k
=
k
;
cpeaks
[
n_cpeak
s
].
l
=
l
;
n_
cpeak
s
++
;
if
(
n_
cpeak
s
==
MAX_
CPEAK
S
)
{
ERROR
(
"Unit cell is insanely large!
\n
"
);
goto
out
;
}
...
...
@@ -580,11 +580,11 @@ int find_projected_peaks(struct image *image, UnitCell *cell,
}
out:
STATUS
(
"Found %i reflections
\n
"
,
n_
hit
s
);
image
->
hits
=
hit
s
;
image
->
n_
hit
s
=
n_
hit
s
;
STATUS
(
"Found %i reflections
\n
"
,
n_
cpeak
s
);
image
->
cpeaks
=
cpeak
s
;
image
->
n_
cpeak
s
=
n_
cpeak
s
;
return
n_
hit
s
;
return
n_
cpeak
s
;
}
...
...
@@ -710,10 +710,10 @@ void output_intensities(struct image *image, UnitCell *cell,
double
bsx
,
bsy
,
bsz
;
double
csx
,
csy
,
csz
;
if
(
image
->
n_
hit
s
==
0
)
{
if
(
image
->
n_
cpeak
s
==
0
)
{
find_projected_peaks
(
image
,
cell
,
circular_domain
,
domain_r
);
}
if
(
image
->
n_
hit
s
==
0
)
return
;
if
(
image
->
n_
cpeak
s
==
0
)
return
;
/* Get exclusive access to the output stream if necessary */
if
(
mutex
!=
NULL
)
pthread_mutex_lock
(
mutex
);
...
...
@@ -724,7 +724,7 @@ void output_intensities(struct image *image, UnitCell *cell,
&
bsx
,
&
bsy
,
&
bsz
,
&
csx
,
&
csy
,
&
csz
);
for
(
i
=
0
;
i
<
image
->
n_
hit
s
;
i
++
)
{
for
(
i
=
0
;
i
<
image
->
n_
cpeak
s
;
i
++
)
{
float
x
,
y
,
intensity
;
double
d
;
...
...
@@ -738,8 +738,8 @@ void output_intensities(struct image *image, UnitCell *cell,
if
(
image
->
features
!=
NULL
)
{
f
=
image_feature_closest
(
image
->
features
,
image
->
hit
s
[
i
].
x
,
image
->
hit
s
[
i
].
y
,
image
->
cpeak
s
[
i
].
x
,
image
->
cpeak
s
[
i
].
y
,
&
d
,
&
idx
);
}
else
{
f
=
NULL
;
...
...
@@ -773,8 +773,8 @@ void output_intensities(struct image *image, UnitCell *cell,
int
r
;
r
=
integrate_peak
(
image
,
image
->
hit
s
[
i
].
x
,
image
->
hit
s
[
i
].
y
,
image
->
cpeak
s
[
i
].
x
,
image
->
cpeak
s
[
i
].
y
,
&
x
,
&
y
,
&
intensity
,
&
bg
,
&
max
,
polar
,
sa
);
if
(
r
)
{
...
...
@@ -794,8 +794,8 @@ void output_intensities(struct image *image, UnitCell *cell,
int
r
;
r
=
integrate_peak
(
image
,
image
->
hit
s
[
i
].
x
,
image
->
hit
s
[
i
].
y
,
image
->
cpeak
s
[
i
].
x
,
image
->
cpeak
s
[
i
].
y
,
&
x
,
&
y
,
&
intensity
,
&
bg
,
&
max
,
polar
,
sa
);
if
(
r
)
{
...
...
@@ -808,11 +808,11 @@ void output_intensities(struct image *image, UnitCell *cell,
/* Write h,k,l, integrated intensity and centroid coordinates */
fprintf
(
ofh
,
"%3i %3i %3i %6f (at %5.2f,%5.2f) max=%6f bg=%6f
\n
"
,
image
->
hit
s
[
i
].
h
,
image
->
hit
s
[
i
].
k
,
image
->
hit
s
[
i
].
l
,
image
->
cpeak
s
[
i
].
h
,
image
->
cpeak
s
[
i
].
k
,
image
->
cpeak
s
[
i
].
l
,
intensity
,
x
,
y
,
max
,
bg
);
image
->
hit
s
[
i
].
x
=
x
;
image
->
hit
s
[
i
].
y
=
y
;
image
->
cpeak
s
[
i
].
x
=
x
;
image
->
cpeak
s
[
i
].
y
=
y
;
}
...
...
@@ -826,12 +826,12 @@ void output_intensities(struct image *image, UnitCell *cell,
if
(
f
==
NULL
)
continue
;
for
(
j
=
0
;
j
<
image
->
n_
hit
s
;
j
++
)
{
for
(
j
=
0
;
j
<
image
->
n_
cpeak
s
;
j
++
)
{
double
d
;
d
=
pow
(
image
->
hit
s
[
j
].
x
-
f
->
x
,
2
.
0
)
+
pow
(
image
->
hit
s
[
j
].
y
-
f
->
y
,
2
.
0
);
d
=
pow
(
image
->
cpeak
s
[
j
].
x
-
f
->
x
,
2
.
0
)
+
pow
(
image
->
cpeak
s
[
j
].
y
-
f
->
y
,
2
.
0
);
if
(
d
<
PEAK_CLOSE
)
n_foundclose
++
;
...
...
@@ -842,7 +842,7 @@ void output_intensities(struct image *image, UnitCell *cell,
fprintf
(
ofh
,
"Peak statistics: %i peaks found by the peak search out of "
"%i were close to indexed positions. "
"%i indexed positions out of %i were close to detected peaks.
\n
"
,
n_foundclose
,
n_found
,
n_indclose
,
image
->
n_
hit
s
);
n_foundclose
,
n_found
,
n_indclose
,
image
->
n_
cpeak
s
);
fprintf
(
ofh
,
"%i integrations using indexed locations were aborted because "
"they hit one or more bad pixels.
\n
"
,
n_veto
);
fprintf
(
ofh
,
"%i integrations using peak search locations were aborted "
...
...
src/reintegrate.c
View file @
f7d612eb
...
...
@@ -108,8 +108,8 @@ static void process_image(void *pg, int cookie)
image
.
flags
=
NULL
;
image
.
indexed_cell
=
NULL
;
image
.
filename
=
apargs
->
filename
;
image
.
hit
s
=
NULL
;
image
.
n_
hit
s
=
0
;
image
.
cpeak
s
=
NULL
;
image
.
n_
cpeak
s
=
0
;
image
.
det
=
pargs
->
det
;
/* View head-on (unit cell is tilted) */
...
...
src/render_hkl.c
View file @
f7d612eb
...
...
@@ -63,9 +63,9 @@ static void show_help(const char *s)
" according to:
\n
"
" I : the intensity of the reflection.
\n
"
" sqrtI : the square root of the intensity.
\n
"
" count : the number of
hi
ts for the reflection.
\n
"
" count : the number of
measuremen
ts for the reflection.
\n
"
" (after correcting for 'epsilon')
\n
"
" rawcts : the raw number of
hi
ts for the
\n
"
" rawcts : the raw number of
measuremen
ts for the
\n
"
" reflection (no 'epsilon' correction).
\n
"
"
\n
"
" --colour-key Draw (only) the key for the current colour scale.
\n
"
...
...
src/templates.c
View file @
f7d612eb
...
...
@@ -43,7 +43,7 @@ struct template {
double
omega
;
double
phi
;
int
n
;
struct
reflhit
*
spots
;
struct
cpeak
*
spots
;
};
...
...
@@ -165,16 +165,16 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename,
for
(
phi
=
0
.
0
;
phi
<
phi_max
-
phi_step
;
phi
+=
phi_step
)
{
int
n
;
struct
reflhit
*
hit
s
;
struct
cpeak
*
cpeak
s
;
UnitCell
*
cell_rot
;
assert
(
i
<
n_templates
);
cell_rot
=
rotate_cell
(
cell
,
omega
,
phi
,
0
.
0
);
hit
s
=
find_intersections
(
&
image
,
cell_rot
,
5.0e-3
,
cpeak
s
=
find_intersections
(
&
image
,
cell_rot
,
5.0e-3
,
3
.
0
/
100
.
0
,
&
n
,
0
);
if
(
hit
s
==
NULL
)
{
if
(
cpeak
s
==
NULL
)
{
ERROR
(
"Template calculation failed.
\n
"
);
return
NULL
;
}
...
...
@@ -182,7 +182,7 @@ IndexingPrivate *generate_templates(UnitCell *cell, const char *filename,
priv
->
templates
[
i
].
omega
=
omega
;
priv
->
templates
[
i
].
phi
=
phi
;
priv
->
templates
[
i
].
n
=
n
;
priv
->
templates
[
i
].
spots
=
hit
s
;
priv
->
templates
[
i
].
spots
=
cpeak
s
;
i
++
;
free
(
cell_rot
);
...
...
@@ -228,7 +228,7 @@ static int fast_integrate_peak(struct image *image, int xp, int yp)
}
static
double
integrate_all_rot
(
struct
image
*
image
,
struct
reflhit
*
hit
s
,
static
double
integrate_all_rot
(
struct
image
*
image
,
struct
cpeak
*
cpeak
s
,
int
n
,
double
rot
)
{
double
itot
=
0
.
0
;
...
...
@@ -243,8 +243,8 @@ static double integrate_all_rot(struct image *image, struct reflhit *hits,
float
xp
,
yp
;
xp
=
cosr
*
hit
s
[
i
].
x
+
sinr
*
hit
s
[
i
].
y
;
yp
=
-
sinr
*
hit
s
[
i
].
x
+
cosr
*
hit
s
[
i
].
y
;
xp
=
cosr
*
cpeak
s
[
i
].
x
+
sinr
*
cpeak
s
[
i
].
y
;
yp
=
-
sinr
*
cpeak
s
[
i
].
x
+
cosr
*
cpeak
s
[
i
].
y
;
itot
+=
fast_integrate_peak
(
image
,
rint
(
xp
),
rint
(
yp
));
num_int
++
;
...
...
@@ -257,7 +257,7 @@ static double integrate_all_rot(struct image *image, struct reflhit *hits,
/* Return the mean of the distances between peaks in the image and peaks from
* the given template. */
static
double
mean_distance
(
struct
image
*
image
,
struct
reflhit
*
hit
s
,
static
double
mean_distance
(
struct
image
*
image
,
struct
cpeak
*
cpeak
s
,
int
n
,
double
rot
)
{
double
dtot
=
0
.
0
;
...
...
@@ -275,8 +275,8 @@ static double mean_distance(struct image *image, struct reflhit *hits,
int
j
;
double
min_dsq
;
xp
=
cosr
*
hit
s
[
i
].
x
+
sinr
*
hit
s
[
i
].
y
;
yp
=
-
sinr
*
hit
s
[
i
].
x
+
cosr
*
hit
s
[
i
].
y
;
xp
=
cosr
*
cpeak
s
[
i
].
x
+
sinr
*
cpeak
s
[
i
].
y
;
yp
=
-
sinr
*
cpeak
s
[
i
].
x
+
cosr
*
cpeak
s
[
i
].
y
;
/* Compare to every real peak */
min_dsq
=
+
INFINITY
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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