Failure to find user created skymodel during LINC calibration pipeline - with suggested solution
While trying to use LINC to calibrate using my own skymodel of a field, I stumbled across an error where my skymodel could not be found by the algorithms.
I dug into the script find_skymodel_cal.py and tried a few things out using the function check_skymodel(skymodel, ra, dec, max_separation_arcmin = 1.0). I discovered the following:
patch_name = s.getPatchNames()
Returns a list containing only 1 value as all the patch names are identical in the skymodels. It only returns the unique patch names.
Thus patch_name = s.getPatchNames()[patch_position]
(row 41 in find_skymodel_cal.py) only works if the source closest to the target centre is in the first row of the skymodel. For some sky models, particularly user made sky models, this is not necessarily the case.
A more general solution would be to replace patch_name = s.getPatchNames()[patch_position]
with this: patch_name = s.table[patch_position][2]
In this case, the full row of the skymodel at patch_position
is returned and then select the 3rd column to output the patch name. Then the pipeline finds the correct skymodel and should complete as normal.