diff options
author | Thomas White <taw@physics.org> | 2020-09-17 13:06:41 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-09-17 13:06:41 +0200 |
commit | ac40ac2f2b6c7785d58a4c4f08ff1702de7cc4ee (patch) | |
tree | 069498f4a1e696462cdfa1cc2484ded0b54ed8be /libcrystfel/src | |
parent | 16097786b720a68ab1fe805f30b9049a2977ae9f (diff) |
Ensure that fs dimension has higher index than ss
Reading from HDF5 cannot rearrange dimensions, only select a chunk.
Therefore, the layout in memory needs to match the file.
Diffstat (limited to 'libcrystfel/src')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index 4c4f58fb..76a61893 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -841,6 +841,19 @@ static int dt_num_path_placeholders(const char *str) } +signed int find_dim(signed int *dims, int which) +{ + int i; + + for ( i=0; i<MAX_DIMS; i++ ) { + if ( dims[i] == DIM_UNDEFINED ) break; + if ( dims[i] == which ) return i; + } + + return -1; +} + + DataTemplate *data_template_new_from_string(const char *string_in) { DataTemplate *dt; @@ -1053,6 +1066,21 @@ DataTemplate *data_template_new_from_string(const char *string_in) for ( i=0; i<dt->n_panels; i++ ) { struct panel_template *p = &dt->panels[i]; + signed int dim_fs = find_dim(p->dims, DIM_FS); + signed int dim_ss = find_dim(p->dims, DIM_SS); + + if ( (dim_fs<0) || (dim_ss<0) ) { + ERROR("Panel %s does not have dimensions " + "assigned to both fs and ss.\n", + p->name); + reject = 1; + } + + if ( dim_ss > dim_fs ) { + ERROR("Fast scan dimension must be lower than " + "slow scan (panel %s)\n", p->name); + reject = 1; + } if ( p->orig_min_fs < 0 ) { ERROR("Please specify the minimum FS coordinate for" |