aboutsummaryrefslogtreecommitdiff
path: root/src/list_events.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-20 17:32:46 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commit302de26924528b31a2320c90fd944224674bd835 (patch)
tree5238dd56b43d71f0821d46e32633f70d4ce77428 /src/list_events.c
parent8e30641ba8fe37575794adef60c340e6116e0e7b (diff)
list_events: Convert to DataTemplate
Diffstat (limited to 'src/list_events.c')
-rw-r--r--src/list_events.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/list_events.c b/src/list_events.c
index 095cc715..fc3d3411 100644
--- a/src/list_events.c
+++ b/src/list_events.c
@@ -7,7 +7,7 @@
* a research centre of the Helmholtz Association.
*
* Authors:
- * 2015 Thomas White <taw@physics.org>
+ * 2015-2020 Thomas White <taw@physics.org>
*
* This file is part of CrystFEL.
*
@@ -39,8 +39,8 @@
#include <getopt.h>
#include "utils.h"
-#include "detector.h"
-#include "hdf5-file.h"
+#include "image.h"
+#include "datatemplate.h"
static void show_help(const char *s)
@@ -69,7 +69,7 @@ int main(int argc, char *argv[])
char *rval;
FILE *ifh;
FILE *ofh;
- struct detector *det;
+ DataTemplate *dtempl;
/* Long options */
const struct option longopts[] = {
@@ -140,19 +140,12 @@ int main(int argc, char *argv[])
return 1;
}
- det = get_detector_geometry(geom, NULL);
- if ( det == NULL ) {
+ dtempl = data_template_new_from_file(geom);
+ if ( dtempl == NULL ) {
ERROR("Failed to read '%s'\n", geom);
return 1;
}
- if ( !multi_event_geometry(det) ) {
- ERROR("This does not look like a multi-event geometry file.\n");
- ERROR("Are you sure you need to use list_events instead of "
- "just 'find' or 'ls'?\n");
- return 1;
- }
-
do {
char filename[1024];
@@ -162,22 +155,12 @@ int main(int argc, char *argv[])
if ( rval != NULL ) {
struct event_list *evlist;
- struct hdfile *hdfile;
chomp(filename);
- hdfile = hdfile_open(filename);
- if ( hdfile == NULL ) {
- ERROR("Failed to open '%s'\n", filename);
- ERROR("Aborting creation of event list.\n");
- return 1;
- }
-
- evlist = fill_event_list(hdfile, det);
+ evlist = image_expand_frames(dtempl, filename);
if ( evlist == NULL ) {
ERROR("Failed to read %s\n", filename);
- hdfile_close(hdfile);
- ERROR("Aborting creation of event list.\n");
return 1;
}
@@ -191,10 +174,12 @@ int main(int argc, char *argv[])
filename);
free_event_list(evlist);
- hdfile_close(hdfile);
+
}
} while ( rval != NULL );
+ data_template_free(dtempl);
+
return 0;
}