aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/hdf5-file.c7
-rw-r--r--libcrystfel/src/stream.c15
-rw-r--r--src/indexamajig.c23
3 files changed, 35 insertions, 10 deletions
diff --git a/libcrystfel/src/hdf5-file.c b/libcrystfel/src/hdf5-file.c
index ed3b1e29..08e1c5e3 100644
--- a/libcrystfel/src/hdf5-file.c
+++ b/libcrystfel/src/hdf5-file.c
@@ -883,6 +883,13 @@ void free_copy_hdf5_field_list(struct copy_hdf5_field *n)
void add_copy_hdf5_field(struct copy_hdf5_field *copyme,
const char *name)
{
+ int i;
+
+ /* Already on the list? Don't re-add if so. */
+ for ( i=0; i<copyme->n_fields; i++ ) {
+ if ( strcmp(copyme->fields[i], name) == 0 ) return;
+ }
+
/* Need more space? */
if ( copyme->n_fields == copyme->max_fields ) {
diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c
index 04d2277f..4cf02414 100644
--- a/libcrystfel/src/stream.c
+++ b/libcrystfel/src/stream.c
@@ -213,15 +213,15 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile,
fprintf(st->fh, "indexed_by = %s\n", indexer);
free(indexer);
+ fprintf(st->fh, "photon_energy_eV = %f\n",
+ J_to_eV(ph_lambda_to_en(i->lambda)));
+
+ copy_hdf5_fields(hdfile, i->copyme, st->fh);
+
if ( i->det != NULL ) {
int j;
- for ( j=0; j<i->det->n_panels; j++ ) {
- fprintf(st->fh, "camera_length_%s = %f\n",
- i->det->panels[j].name, i->det->panels[j].clen);
- }
-
for ( j=0; j<i->det->n_rigid_groups; j++ ) {
struct rigid_group *rg = i->det->rigid_groups[j];
@@ -246,17 +246,12 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile,
}
- copy_hdf5_fields(hdfile, i->copyme, st->fh);
-
fprintf(st->fh, "num_peaks = %lli\n", i->num_peaks);
fprintf(st->fh, "num_saturated_peaks = %lli\n", i->num_saturated_peaks);
if ( include_peaks ) {
write_peaks(i, st->fh);
}
- fprintf(st->fh, "photon_energy_eV = %f\n",
- J_to_eV(ph_lambda_to_en(i->lambda)));
-
for ( j=0; j<i->n_crystals; j++ ) {
write_crystal(st, i->crystals[j], include_reflections);
}
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 40a3ecc8..3f010b12 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -149,6 +149,27 @@ static void show_help(const char *s)
}
+static void add_geom_beam_stuff_to_copy_hdf5(struct copy_hdf5_field *copyme,
+ struct detector *det,
+ struct beam_params *beam)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+
+ struct panel *p = &det->panels[i];
+
+ if ( p->clen_from != NULL ) {
+ add_copy_hdf5_field(copyme, p->clen_from);
+ }
+ }
+
+ if ( beam->photon_energy_from != NULL ) {
+ add_copy_hdf5_field(copyme, beam->photon_energy_from);
+ }
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -525,6 +546,8 @@ int main(int argc, char *argv[])
return 1;
}
+ add_geom_beam_stuff_to_copy_hdf5(iargs.copyme, iargs.det, iargs.beam);
+
if ( pdb != NULL ) {
iargs.cell = load_cell_from_pdb(pdb);
if ( iargs.cell == NULL ) {