aboutsummaryrefslogtreecommitdiff
path: root/src/dirax.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2010-12-17 16:35:30 -0800
committerThomas White <taw@physics.org>2012-02-22 15:27:10 +0100
commit1dd787f48192d37a957efcddf588be7aceddaa92 (patch)
treeb98ba583f67f42cff02ff748bb37528be2c45d48 /src/dirax.c
parentfb3b1df9b9f261f9cea5f27d67e8fd17dd638a70 (diff)
Remove --write-drx option and simplify code
Diffstat (limited to 'src/dirax.c')
-rw-r--r--src/dirax.c33
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");