aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2013-06-02 14:11:39 -0700
committerThomas White <taw@physics.org>2013-06-02 14:11:39 -0700
commit8fb45911249c244a721d1bbea2eb5852f0a50b60 (patch)
tree7dac6d7b487d867cbba544888c476f88a70b2c62 /libcrystfel
parent8a44164cfd5013687a0eb5cb10dc39c44db399c0 (diff)
Fix RG delta output, and write only if actually calibrated
Diffstat (limited to 'libcrystfel')
-rw-r--r--libcrystfel/src/detector.c1
-rw-r--r--libcrystfel/src/detector.h1
-rw-r--r--libcrystfel/src/integration.c2
-rw-r--r--libcrystfel/src/stream.c8
4 files changed, 9 insertions, 3 deletions
diff --git a/libcrystfel/src/detector.c b/libcrystfel/src/detector.c
index 2fdd63f1..5cd0ce0f 100644
--- a/libcrystfel/src/detector.c
+++ b/libcrystfel/src/detector.c
@@ -567,6 +567,7 @@ static struct rigid_group *find_or_add_rg(struct detector *det,
rg->name = strdup(name);
rg->panels = NULL;
rg->n_panels = 0;
+ rg->have_deltas = 0;
return rg;
}
diff --git a/libcrystfel/src/detector.h b/libcrystfel/src/detector.h
index 8ff8db2f..cfe0808a 100644
--- a/libcrystfel/src/detector.h
+++ b/libcrystfel/src/detector.h
@@ -60,6 +60,7 @@ struct rigid_group
double d_fsy;
double d_ssy;
double d_cny;
+ int have_deltas;
};
diff --git a/libcrystfel/src/integration.c b/libcrystfel/src/integration.c
index c264f671..0e174139 100644
--- a/libcrystfel/src/integration.c
+++ b/libcrystfel/src/integration.c
@@ -1199,6 +1199,7 @@ static void refine_rigid_groups(struct intcontext *ic)
rg->d_fsy = gsl_vector_get(dq2, 0);
rg->d_ssy = gsl_vector_get(dq2, 1);
rg->d_cny = gsl_vector_get(dq2, 2);
+ rg->have_deltas = 1;
gsl_vector_free(dq1);
gsl_vector_free(dq2);
@@ -1211,6 +1212,7 @@ static void refine_rigid_groups(struct intcontext *ic)
rg->d_fsy = 0.0;
rg->d_ssy = 0.0;
rg->d_cny = 0.0;
+ rg->have_deltas = 0;
}
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 8c12aa3b..c4ded787 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -226,6 +226,8 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile,
struct rigid_group *rg = i->det->rigid_groups[j];
+ if ( !rg->have_deltas ) continue;
+
fprintf(st->fh, "rg_delta_%s_fsx = %f\n",
rg->name, rg->d_fsx);
fprintf(st->fh, "rg_delta_%s_ssx = %f\n",
@@ -234,11 +236,11 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile,
rg->name, rg->d_cnx);
fprintf(st->fh, "rg_delta_%s_fsy = %f\n",
- rg->name, rg->d_fsx);
+ rg->name, rg->d_fsy);
fprintf(st->fh, "rg_delta_%s_ssy = %f\n",
- rg->name, rg->d_ssx);
+ rg->name, rg->d_ssy);
fprintf(st->fh, "rg_delta_%s_cny = %f\n",
- rg->name, rg->d_cnx);
+ rg->name, rg->d_cny);
}