From 484d34585f0c3e6127d302884f2c6c1d4efabfbe Mon Sep 17 00:00:00 2001 From: tgalvin Date: Fri, 26 Jan 2024 13:52:06 +0800 Subject: [PATCH 1/3] added logger message --- flint/validation.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flint/validation.py b/flint/validation.py index 6634e848..b20d95de 100644 --- a/flint/validation.py +++ b/flint/validation.py @@ -1213,10 +1213,11 @@ def create_validation_tables( if survey == "askap": continue - # The initial attempts to do something like - # tables[tables.index(survey)] - # was returning a `tuple.index(x): x not in tuple` error - # Do this once here and reuse + logger.info(f"Processing {survey=}") + + # The index method of a named tuple is the same as tuple[i], where + # i is an int. This is a round about way of getting the key name + # from a named attributed stored in a parameter survey_catalogue = catalogues.__getattribute__(survey) survey_table = tables.__getattribute__(survey) From 582d8301ea3841393bc2c882324db721c31d7ff9 Mon Sep 17 00:00:00 2001 From: Tim Galvin Date: Fri, 26 Jan 2024 17:44:51 +1100 Subject: [PATCH 2/3] fixed issue with scalar not having len() --- flint/validation.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/flint/validation.py b/flint/validation.py index b20d95de..b3e0c250 100644 --- a/flint/validation.py +++ b/flint/validation.py @@ -736,7 +736,7 @@ def match_nearest_neighbour( pos2=pos2[idx], freq1=catalogue1.freq, freq2=catalogue2.freq, - idx1=np.squeeze(np.argwhere(mask)), + idx1=np.argwhere(mask)[:,0], idx2=idx, flux1=table1[catalogue1.flux_col].value[mask] if catalogue1.flux_col != "None" @@ -1213,23 +1213,24 @@ def create_validation_tables( if survey == "askap": continue - logger.info(f"Processing {survey=}") - # The index method of a named tuple is the same as tuple[i], where # i is an int. This is a round about way of getting the key name # from a named attributed stored in a parameter survey_catalogue = catalogues.__getattribute__(survey) survey_table = tables.__getattribute__(survey) - if survey_catalogue is None or survey_table is None: + if survey_catalogue is None: continue + logger.info(f"Processing {survey=}") + match_result = match_nearest_neighbour( table1=tables.askap, table2=survey_table, catalogue1=catalogues.askap, catalogue2=survey_catalogue, ) + xmatch_table, xmatch_file = make_xmatch_table( table1=tables.askap, table2=survey_table, @@ -1460,13 +1461,13 @@ def cli() -> None: parser = get_parser() args = parser.parse_args() - create_validation_plot( - processed_ms_paths=args.processed_ms_paths, - rms_image_path=args.rms_image_path, - source_catalogue_path=args.source_catalogue_path, - output_path=args.output_path, - reference_catalogue_directory=args.reference_catalogue_directory, - ) + # create_validation_plot( + # processed_ms_paths=args.processed_ms_paths, + # rms_image_path=args.rms_image_path, + # source_catalogue_path=args.source_catalogue_path, + # output_path=args.output_path, + # reference_catalogue_directory=args.reference_catalogue_directory, + # ) validation_tables = create_validation_tables( processed_ms_paths=args.processed_ms_paths, From 43b6f11a537d67085dc15995a13a92d95310d755 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 26 Jan 2024 14:13:07 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- flint/validation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flint/validation.py b/flint/validation.py index b3e0c250..65054012 100644 --- a/flint/validation.py +++ b/flint/validation.py @@ -736,7 +736,7 @@ def match_nearest_neighbour( pos2=pos2[idx], freq1=catalogue1.freq, freq2=catalogue2.freq, - idx1=np.argwhere(mask)[:,0], + idx1=np.argwhere(mask)[:, 0], idx2=idx, flux1=table1[catalogue1.flux_col].value[mask] if catalogue1.flux_col != "None" @@ -1230,7 +1230,7 @@ def create_validation_tables( catalogue1=catalogues.askap, catalogue2=survey_catalogue, ) - + xmatch_table, xmatch_file = make_xmatch_table( table1=tables.askap, table2=survey_table,