aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/grainspotter.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-01-09 17:06:40 +0100
committerThomas White <taw@physics.org>2013-01-09 17:06:40 +0100
commit60726ebd9b939a17778f785206c9eb00d5e6c800 (patch)
tree5e4281f717443494664f6c5e974678b398af994b /libcrystfel/src/grainspotter.c
parent6c970262e0d41252b0ada1a80a6c6293ddcdfec9 (diff)
Matrix reading stuff
Diffstat (limited to 'libcrystfel/src/grainspotter.c')
-rw-r--r--libcrystfel/src/grainspotter.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libcrystfel/src/grainspotter.c b/libcrystfel/src/grainspotter.c
index b7e5ce0a..6217b810 100644
--- a/libcrystfel/src/grainspotter.c
+++ b/libcrystfel/src/grainspotter.c
@@ -71,7 +71,7 @@ struct grainspotter_data {
};
-static int read_matrix(struct image *image)
+static int read_matrix(struct image *image, char *filename)
{
FILE *fh;
int d1;
@@ -79,12 +79,9 @@ static int read_matrix(struct image *image)
float ubi11, ubi12, ubi13;
float ubi21, ubi22, ubi23;
float ubi31, ubi32, ubi33;
- char filename[1024];
char line[1024];
int r;
- snprintf(filename, 1023, "xfel-%i.gff", image->id);
-
fh = fopen(filename, "r");
if ( fh == NULL ) {
ERROR("Can't open '%s'\n", filename);
@@ -252,6 +249,7 @@ void run_grainspotter(struct image *image, UnitCell *cell)
int rval;
struct grainspotter_data *grainspotter;
char *ini_filename;
+ char gff_filename[1024];
write_gve(image, cell);
ini_filename = write_ini(image);
@@ -267,6 +265,9 @@ void run_grainspotter(struct image *image, UnitCell *cell)
return;
}
+ snprintf(gff_filename, 1023, "xfel-%i.gff", image->id);
+ remove(gff_filename);
+
grainspotter->pid = forkpty(&grainspotter->pty, NULL, NULL, NULL);
if ( grainspotter->pid == -1 ) {
ERROR("Failed to fork for GrainSpotter: %s\n", strerror(errno));
@@ -345,7 +346,7 @@ void run_grainspotter(struct image *image, UnitCell *cell)
ERROR("GrainSpotter doesn't seem to be working properly.\n");
}
- if ( read_matrix(image) != 0 ) {
+ if ( read_matrix(image, gff_filename) != 0 ) {
ERROR("Failed to read matrix\n");
}