Skip to content

Bugfix fix get bright sources

Chiara Salvoni requested to merge bugfix-fix-get-bright-sources into main

This MR fixes a bug in the get_bright_sources function. The sector_vertices should be a Python zip object, instead of a list to be used in the Polygon function.

This is the error which occurred after starting the operation calibrate_3

Traceback (most recent call last):
File "/var/scratch/scorda/low-self-cal/2393e2fc/src/ska_sdp_wflow_low_selfcal/pipeline/main.py", line 546, \in run_pipeline( File "/var/scratch/scorda/low-self-cal/2393e2fc/src/ska_sdp_wflow_low_selfcal/pipeline/main.py", line 367, \in run_pipeline (brights_sources_skymodel,) = get_bright_sources( File "/var/scratch/scorda/low-self-cal/2393e2fc/src/ska_sdp_wflow_low_selfcal/pipeline/support/skymodel_utils.py", line 499, \ in get_bright_sources poly = Polygon(sector_vertices)
File "/var/scratch/scorda/low-self-cal/python-low/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 230, in new shell = LinearRing(shell)
File "/var/scratch/scorda/low-self-cal/python-low/lib/python3.9/site-packages/shapely/geometry/polygon.py", line 104, in new geom = shapely.linearrings(coordinates)
File "/var/scratch/scorda/low-self-cal/python-low/lib/python3.9/site-packages/shapely/decorators.py", line 77, in wrapped return func(*args, **kwargs)
File "/var/scratch/scorda/low-self-cal/python-low/lib/python3.9/site-packages/shapely/creation.py", line 171, in linearrings return lib.linearrings(coords, out=out, **kwargs)
ValueError: The ordinate (last) dimension should be 2 or 3, got 5

This is a snippet of the main log file just before the error occurred:

Mon 27-11-2023 20:39:09:: INFO : run_pipeline:: Start calibrate_3
Mon 27-11-2023 20:39:09:: INFO : run_pipeline:: group sources in patches
Mon 27-11-2023 20:39:10:: INFO : Starting iteration 0
Mon 27-11-2023 20:39:10:: INFO : Starting iteration 1
Mon 27-11-2023 20:39:10:: INFO : Starting iteration 2
Mon 27-11-2023 20:39:10:: INFO : Starting iteration 3
Mon 27-11-2023 20:39:10:: INFO : Starting iteration 4
Mon 27-11-2023 20:39:10:: INFO : Creating 300 groups.
Mon 27-11-2023 20:39:22:: INFO : run_pipeline:: Create bright sources skymodel
Mon 27-11-2023 20:39:23:: INFO : Removed 1 source.
Mon 27-11-2023 20:39:24:: INFO : Removed 4 sources.
Mon 27-11-2023 20:39:24:: INFO : Removed 1 source.
Mon 27-11-2023 20:39:24:: INFO : Removed 4 sources.
[...a lot of similar lines...]
Mon 27-11-2023 20:39:40:: INFO : Removed 2 sources.
Mon 27-11-2023 20:39:41:: INFO : Removed 3 sources.
Mon 27-11-2023 20:39:41:: INFO : Removed 1 source.
Mon 27-11-2023 20:39:41:: INFO : Kept 370 sources.

I was able to reproduce the error if I deleted the file "sector_1_vertices.pkl" from my working directory.

Edited by Chiara Salvoni

Merge request reports