aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/reflist-utils.c
diff options
context:
space:
mode:
authorValerio Mariani <valerio.mariani@desy.de>2014-03-25 17:35:07 +0100
committerThomas White <taw@physics.org>2014-09-05 18:01:52 +0200
commitc194bf7746e3635571808856f29434499eec55b7 (patch)
tree6e52ae148b10bf46c4ca97badb06b2cfd44a55ed /libcrystfel/src/reflist-utils.c
parentc7e4b7acbd624723c5973431c0101fe92bc3089d (diff)
Refactoring of peaks and reflections I/O
Diffstat (limited to 'libcrystfel/src/reflist-utils.c')
-rw-r--r--libcrystfel/src/reflist-utils.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/libcrystfel/src/reflist-utils.c b/libcrystfel/src/reflist-utils.c
index 5d52ec93..e033791b 100644
--- a/libcrystfel/src/reflist-utils.c
+++ b/libcrystfel/src/reflist-utils.c
@@ -286,6 +286,12 @@ int write_reflist(const char *filename, RefList *list)
RefList *read_reflections_from_file(FILE *fh)
{
+ return read_reflections_from_file2(fh, NULL);
+}
+
+
+RefList *read_reflections_from_file2(FILE *fh, struct detector *det)
+{
char *rval = NULL;
RefList *out;
int major_version; /* Minor version as well, but not used yet */
@@ -364,12 +370,15 @@ RefList *read_reflections_from_file(FILE *fh)
signed int h, k, l;
float intensity, sigma, fs, ss;
char phs[1024];
+ char pn[32];
int cts;
int r;
+ struct panel *p;
+ float read_fs, read_ss;
- r = sscanf(line, "%i %i %i %f %s %f %i %f %f",
+ r = sscanf(line, "%i %i %i %f %s %f %i %f %f %s",
&h, &k, &l, &intensity, phs, &sigma,
- &cts, &fs, &ss);
+ &cts, &fs, &ss, pn);
if ( r != 9 ) {
reflist_free(out);
@@ -378,7 +387,14 @@ RefList *read_reflections_from_file(FILE *fh)
refl = add_refl(out, h, k, l);
set_intensity(refl, intensity);
- set_detector_pos(refl, 0.0, fs, ss);
+
+ if ( det != NULL) {
+ p = find_panel_by_name(det, pn);
+ read_ss = ss-p->orig_min_ss+p->min_ss;
+ read_fs = fs-p->orig_min_fs+p->min_fs;
+ set_detector_pos(refl, 0.0, read_fs, read_ss);
+ }
+
set_esd_intensity(refl, sigma);
set_redundancy(refl, cts);
@@ -396,6 +412,12 @@ RefList *read_reflections_from_file(FILE *fh)
RefList *read_reflections(const char *filename)
{
+ return read_reflections2(filename, NULL);
+}
+
+
+RefList *read_reflections2(const char *filename, struct detector *det)
+{
FILE *fh;
RefList *out;
@@ -410,7 +432,7 @@ RefList *read_reflections(const char *filename)
return NULL;
}
- out = read_reflections_from_file(fh);
+ out = read_reflections_from_file2(fh, det);
fclose(fh);