diff options
author | Thomas White <taw@bitwiz.org.uk> | 2010-12-17 16:35:30 -0800 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:10 +0100 |
commit | 1dd787f48192d37a957efcddf588be7aceddaa92 (patch) | |
tree | b98ba583f67f42cff02ff748bb37528be2c45d48 /src/dirax.c | |
parent | fb3b1df9b9f261f9cea5f27d67e8fd17dd638a70 (diff) |
Remove --write-drx option and simplify code
Diffstat (limited to 'src/dirax.c')
-rw-r--r-- | src/dirax.c | 33 |
1 files changed, 33 insertions, 0 deletions
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; i<image_feature_count(image->features); 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"); |