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
ce045961
Commit
ce045961
authored
Oct 01, 2010
by
Thomas White
Browse files
indexamajig: Take output stream as a command line parameter
parent
c5dc4b20
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/indexamajig.c
View file @
ce045961
...
...
@@ -44,7 +44,6 @@ struct process_args
/* Input */
char
*
filename
;
int
id
;
pthread_mutex_t
*
output_mutex
;
/* Protects stdout */
pthread_mutex_t
*
gpu_mutex
;
/* Protects "gctx" */
UnitCell
*
cell
;
int
config_cmfilter
;
...
...
@@ -76,6 +75,10 @@ struct process_args
int
done
;
int
indexable
;
int
sane
;
/* Output stream */
pthread_mutex_t
*
output_mutex
;
/* Protects the output stream */
FILE
*
ofh
;
};
...
...
@@ -365,7 +368,7 @@ static void process_image(struct process_args *pargs)
output_intensities
(
&
image
,
image
.
indexed_cell
,
pargs
->
output_mutex
,
config_polar
,
pargs
->
config_sa
,
pargs
->
config_closer
,
0
,
0
.
1
);
pargs
->
ofh
,
0
,
0
.
1
);
}
simage
=
get_simage
(
&
image
,
config_alternate
);
...
...
@@ -439,7 +442,9 @@ int main(int argc, char *argv[])
int
c
;
struct
gpu_context
*
gctx
=
NULL
;
char
*
filename
=
NULL
;
char
*
outfile
=
NULL
;
FILE
*
fh
;
FILE
*
ofh
;
char
*
rval
=
NULL
;
int
n_images
;
int
n_indexable
;
...
...
@@ -486,6 +491,7 @@ int main(int argc, char *argv[])
const
struct
option
longopts
[]
=
{
{
"help"
,
0
,
NULL
,
'h'
},
{
"input"
,
1
,
NULL
,
'i'
},
{
"output"
,
1
,
NULL
,
'o'
},
{
"gpu"
,
0
,
&
config_gpu
,
1
},
{
"no-index"
,
0
,
&
config_noindex
,
1
},
{
"dump-peaks"
,
0
,
&
config_dumpfound
,
1
},
...
...
@@ -514,7 +520,7 @@ int main(int argc, char *argv[])
};
/* Short options */
while
((
c
=
getopt_long
(
argc
,
argv
,
"hi:wp:j:x:g:t:"
,
while
((
c
=
getopt_long
(
argc
,
argv
,
"hi:wp:j:x:g:t:
o:
"
,
longopts
,
NULL
))
!=
-
1
)
{
switch
(
c
)
{
...
...
@@ -526,6 +532,10 @@ int main(int argc, char *argv[])
filename
=
strdup
(
optarg
);
break
;
case
'o'
:
outfile
=
strdup
(
optarg
);
break
;
case
'z'
:
indm_str
=
strdup
(
optarg
);
break
;
...
...
@@ -584,6 +594,20 @@ int main(int argc, char *argv[])
}
free
(
filename
);
if
(
outfile
==
NULL
)
{
outfile
=
strdup
(
"-"
);
}
if
(
strcmp
(
outfile
,
"-"
)
==
0
)
{
ofh
=
stdout
;
}
else
{
ofh
=
fopen
(
outfile
,
"w"
);
}
if
(
ofh
==
NULL
)
{
ERROR
(
"Failed to open output file '%s'
\n
"
,
outfile
);
return
1
;
}
free
(
outfile
);
if
(
intfile
!=
NULL
)
{
ReflItemList
*
items
;
items
=
read_reflections
(
intfile
,
intensities
,
...
...
@@ -674,6 +698,7 @@ int main(int argc, char *argv[])
for
(
i
=
0
;
i
<
nthreads
;
i
++
)
{
worker_args
[
i
]
=
malloc
(
sizeof
(
struct
process_args
));
worker_args
[
i
]
->
filename
=
malloc
(
1024
);
worker_args
[
i
]
->
ofh
=
ofh
;
worker_active
[
i
]
=
0
;
}
...
...
src/pattern_sim.c
View file @
ce045961
...
...
@@ -419,7 +419,8 @@ int main(int argc, char *argv[])
if
(
config_nearbragg
)
{
find_projected_peaks
(
&
image
,
cell
,
0
,
0
.
1
);
output_intensities
(
&
image
,
cell
,
NULL
,
0
,
1
,
0
,
0
,
0
.
1
);
output_intensities
(
&
image
,
cell
,
NULL
,
0
,
1
,
0
,
stdout
,
0
,
0
.
1
);
}
if
(
powder_fn
!=
NULL
)
{
...
...
src/peaks.c
View file @
ce045961
...
...
@@ -618,7 +618,8 @@ int peak_sanity_check(struct image *image, UnitCell *cell,
void
output_intensities
(
struct
image
*
image
,
UnitCell
*
cell
,
pthread_mutex_t
*
mutex
,
int
polar
,
int
sa
,
int
use_closer
,
int
circular_domain
,
double
domain_r
)
int
use_closer
,
FILE
*
ofh
,
int
circular_domain
,
double
domain_r
)
{
int
i
;
int
n_found
;
...
...
@@ -641,22 +642,22 @@ void output_intensities(struct image *image, UnitCell *cell,
/* Explicit printf() used here (not normally allowed) because
* we really want to output to stdout */
printf
(
"Reflections from indexing in %s
\n
"
,
image
->
filename
);
printf
(
"Orientation (wxyz): %7.5f %7.5f %7.5f %7.5f
\n
"
,
f
printf
(
ofh
,
"Reflections from indexing in %s
\n
"
,
image
->
filename
);
f
printf
(
ofh
,
"Orientation (wxyz): %7.5f %7.5f %7.5f %7.5f
\n
"
,
image
->
orientation
.
w
,
image
->
orientation
.
x
,
image
->
orientation
.
y
,
image
->
orientation
.
z
);
cell_get_parameters
(
cell
,
&
a
,
&
b
,
&
c
,
&
al
,
&
be
,
&
ga
);
printf
(
"Cell parameters %7.5f %7.5f %7.5f nm, %7.5f %7.5f %7.5f deg
\n
"
,
f
printf
(
ofh
,
"Cell parameters %7.5f %7.5f %7.5f nm, %7.5f %7.5f %7.5f deg
\n
"
,
a
*
1.0e9
,
b
*
1.0e9
,
c
*
1.0e9
,
rad2deg
(
al
),
rad2deg
(
be
),
rad2deg
(
ga
));
cell_get_reciprocal
(
cell
,
&
asx
,
&
asy
,
&
asz
,
&
bsx
,
&
bsy
,
&
bsz
,
&
csx
,
&
csy
,
&
csz
);
printf
(
"astar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
f
printf
(
ofh
,
"astar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
asx
/
1e9
,
asy
/
1e9
,
asz
/
1e9
);
printf
(
"bstar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
f
printf
(
ofh
,
"bstar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
bsx
/
1e9
,
bsy
/
1e9
,
bsz
/
1e9
);
printf
(
"cstar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
f
printf
(
ofh
,
"cstar = %+9.7f %+9.7f %+9.7f nm^-1
\n
"
,
csx
/
1e9
,
csy
/
1e9
,
csz
/
1e9
);
if
(
image
->
f0_available
)
{
...
...
@@ -747,7 +748,7 @@ void output_intensities(struct image *image, UnitCell *cell,
}
/* Write h,k,l, integrated intensity and centroid coordinates */
printf
(
"%3i %3i %3i %6f (at %5.2f,%5.2f)
\n
"
,
f
printf
(
ofh
,
"%3i %3i %3i %6f (at %5.2f,%5.2f)
\n
"
,
image
->
hits
[
i
].
h
,
image
->
hits
[
i
].
k
,
image
->
hits
[
i
].
l
,
intensity
,
x
,
y
);
...
...
@@ -779,16 +780,16 @@ void output_intensities(struct image *image, UnitCell *cell,
}
printf
(
"Peak statistics: %i peaks found by the peak search out of "
f
printf
(
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_hits
);
printf
(
"%i integrations using indexed locations were aborted because "
f
printf
(
ofh
,
"%i integrations using indexed locations were aborted because "
"they hit one or more bad pixels.
\n
"
,
n_veto
);
printf
(
"%i integrations using peak search locations were aborted "
f
printf
(
ofh
,
"%i integrations using peak search locations were aborted "
"because they hit one or more bad pixels.
\n
"
,
n_veto_second
);
/* Blank line at end */
printf
(
"
\n
"
);
f
printf
(
ofh
,
"
\n
"
);
if
(
mutex
!=
NULL
)
pthread_mutex_unlock
(
mutex
);
}
src/peaks.h
View file @
ce045961
...
...
@@ -23,7 +23,7 @@ extern void search_peaks(struct image *image, float threshold);
extern
void
dump_peaks
(
struct
image
*
image
,
pthread_mutex_t
*
mutex
);
extern
void
output_intensities
(
struct
image
*
image
,
UnitCell
*
cell
,
pthread_mutex_t
*
mutex
,
int
polar
,
int
sa
,
int
use_closer
,
int
circular_domain
,
int
use_closer
,
FILE
*
ofh
,
int
circular_domain
,
double
domain_r
);
extern
int
peak_sanity_check
(
struct
image
*
image
,
UnitCell
*
cell
,
int
circular_domain
,
double
domain_r
);
...
...
src/reintegrate.c
View file @
ce045961
...
...
@@ -135,7 +135,7 @@ static void process_image(struct process_args *pargs)
output_intensities
(
&
image
,
pargs
->
cell
,
pargs
->
output_mutex
,
pargs
->
config_polar
,
pargs
->
config_sa
,
pargs
->
config_closer
,
0
,
0
.
1
);
stdout
,
0
,
0
.
1
);
}
free
(
image
.
data
);
...
...
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