diff --git a/invisible_cities/cities/components.py b/invisible_cities/cities/components.py index 0626d242d..842c24ecd 100644 --- a/invisible_cities/cities/components.py +++ b/invisible_cities/cities/components.py @@ -117,7 +117,12 @@ def proxy(**kwds): conf.files_in = [conf.files_in] globbed_files = map(glob, map(expandvars, conf.files_in)) - conf.files_in = sorted(f for fs in globbed_files for f in fs) + globbed_files = sorted(f for fs in globbed_files for f in fs) + if len(set(globbed_files)) != len(globbed_files): + warnings.warn("files_in contains repeated values. Ignoring duplicate files.", UserWarning) + globbed_files = sorted(set(globbed_files)) + + conf.files_in = globbed_files conf.file_out = expandvars(conf.file_out) conf.event_range = event_range(conf) diff --git a/invisible_cities/cities/components_test.py b/invisible_cities/cities/components_test.py index 3d2e62ece..e81c94a83 100644 --- a/invisible_cities/cities/components_test.py +++ b/invisible_cities/cities/components_test.py @@ -110,6 +110,7 @@ def write_config_file(filename, **kwargs): , ["electrons_511keV_z250_RWF.h5" , "electrons_1250keV_z250_RWF.h5", "electrons_2500keV_z250_RWF.h5"] ) ) ) +@mark.filterwarnings("ignore:files_in contains repeated values") def test_city_files_in(case_, files_in, expected, config_tmpdir, ICDATADIR): """ Check that all possible files_in inputs are handled properly: