From 302de26924528b31a2320c90fd944224674bd835 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 20 May 2020 17:32:46 +0200 Subject: list_events: Convert to DataTemplate --- src/list_events.c | 35 ++++++++++------------------------- 1 file 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 + * 2015-2020 Thomas White * * This file is part of CrystFEL. * @@ -39,8 +39,8 @@ #include #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; } -- cgit v1.2.3