diff options
author | Thomas White <taw@physics.org> | 2024-05-02 09:31:31 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-05-02 09:31:31 +0200 |
commit | 16f4ffd1445c09d9e22e941930686243d1214105 (patch) | |
tree | b9aa70fed33d51d2e4c0f2219cb972d4132293ec /libcrystfel | |
parent | dc02fa26c21346ab4b1d6588fa32c307553a6949 (diff) |
data_template_write_to_fh: Fix bad region output
Two problems:
1. Didn't take into account that bad->name already includes the prefix
"bad".
2. Didn't convert the panel-relative coordinates back to slab-relative.
Fixes: https://github.com/taw10/crystfel/issues/11
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index 573a4795..2f5763a8 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -2527,17 +2527,19 @@ int data_template_write_to_fh(const DataTemplate *dtempl, FILE *fh) /* Bad regions */ for ( i=0; i<dtempl->n_bad; i++ ) { const struct dt_badregion *bad = &dtempl->bad[i]; + assert(strncmp(bad->name, "bad", 3) == 0); if ( bad->is_fsss ) { - fprintf(fh, "bad_%s/panel = %s\n", bad->name, bad->panel_name); - fprintf(fh, "bad_%s/min_fs = %i\n", bad->name, bad->min_fs); - fprintf(fh, "bad_%s/max_fs = %i\n", bad->name, bad->max_fs); - fprintf(fh, "bad_%s/min_ss = %i\n", bad->name, bad->min_ss); - fprintf(fh, "bad_%s/max_ss = %i\n", bad->name, bad->max_ss); + const struct panel_template *p = &dtempl->panels[bad->panel_number]; + fprintf(fh, "%s/panel = %s\n", bad->name, p->name); + fprintf(fh, "%s/min_fs = %i\n", bad->name, bad->min_fs+p->orig_min_fs); + fprintf(fh, "%s/max_fs = %i\n", bad->name, bad->max_fs+p->orig_min_fs); + fprintf(fh, "%s/min_ss = %i\n", bad->name, bad->min_ss+p->orig_min_ss); + fprintf(fh, "%s/max_ss = %i\n", bad->name, bad->max_ss+p->orig_min_ss); } else { - fprintf(fh, "bad_%s/min_x = %f\n", bad->name, bad->min_x); - fprintf(fh, "bad_%s/max_x = %f\n", bad->name, bad->max_x); - fprintf(fh, "bad_%s/min_y = %f\n", bad->name, bad->min_y); - fprintf(fh, "bad_%s/max_y = %f\n", bad->name, bad->max_y); + fprintf(fh, "%s/min_x = %f\n", bad->name, bad->min_x); + fprintf(fh, "%s/max_x = %f\n", bad->name, bad->max_x); + fprintf(fh, "%s/min_y = %f\n", bad->name, bad->min_y); + fprintf(fh, "%s/max_y = %f\n", bad->name, bad->max_y); } fprintf(fh, "\n"); } |