From 1dd787f48192d37a957efcddf588be7aceddaa92 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 17 Dec 2010 16:35:30 -0800 Subject: Remove --write-drx option and simplify code --- src/dirax.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/dirax.c') diff --git a/src/dirax.c b/src/dirax.c index 0930f8f9..ebb53f25 100644 --- a/src/dirax.c +++ b/src/dirax.c @@ -385,12 +385,45 @@ static int dirax_readable(struct image *image) } +static void write_drx(struct image *image) +{ + FILE *fh; + int i; + char filename[1024]; + + snprintf(filename, 1023, "xfel-%i.drx", image->id); + + fh = fopen(filename, "w"); + if ( !fh ) { + ERROR("Couldn't open temporary file xfel.drx\n"); + return; + } + fprintf(fh, "%f\n", 0.5); /* Lie about the wavelength. */ + + for ( i=0; ifeatures); i++ ) { + + struct imagefeature *f; + + f = image_get_feature(image->features, i); + if ( f == NULL ) continue; + + fprintf(fh, "%10f %10f %10f %8f\n", + f->rx/1e10, f->ry/1e10, f->rz/1e10, 1.0); + + } + fclose(fh); +} + + + void run_dirax(struct image *image) { unsigned int opts; int status; int rval; + write_drx(image); + image->dirax_pid = forkpty(&image->dirax_pty, NULL, NULL, NULL); if ( image->dirax_pid == -1 ) { ERROR("Failed to fork for DirAx\n"); -- cgit v1.2.3