caracal-pipeline / caracal

Containerized Automated Radio Astronomy Calibration (CARACal) pipeline
GNU General Public License v2.0
28 stars 6 forks source link

Error of polcal, Unable to determine a polarization calibration strategy. #1575

Closed harukasakemi closed 4 months ago

harukasakemi commented 4 months ago

Hi. We would like to do polcal with the following calibrators, 1934-638 (unpolarized, also used as bpcal and fcal), 1827-360 (unknown polarization, also used as gcal). However, we got the following error message. `ERROR: Unable to determine a polarization calibration strategy. Supported strategies are:

  1. Calibrate leakage using an unpolarized source (PKS1934-63, J1939-6342, J1938-6341, PKS 1934-638, PKS 1934-63, PKS1934-638, PKS0408-65, J0408-6545, J0408-6544, PKS 0408-65, 0407-658, 0408-658, PKS 0408-658, 0408-65), and polarization angle using a known polarized source (3C138, 3C286, J1130-1449, J1331+3030, J0521+1638). This is usually achieved by setting leakage_cal=bpcal, pol_cal=xcal.
  2. Calibrate both leakage and polarized angle with a (known or unknown) polarized source observed at different parallactic angles. This is usually achieved by setting leakage_cal=xcal, pol_cal=xcal. If the polarized source is unknown at least three scans are required. [RuntimeError]`

Could anyone tell us how to fix it? I attached the logfile and the yml file. Thanks.

log-caracal.txt meerkat-fullStokes-continuum-defaults.txt

AstroRipples commented 4 months ago

Hi @harukasakemi 👋 The helper text has printed out the information you need here:

  1. Calibrate both leakage and polarized angle with a (known or unknown) polarized source observed at different parallactic angles. This is usually achieved by setting leakage_cal=xcal, pol_cal=xcal. If the polarized source is unknown at least three scans are required.

In your yml config file, if you look under the polcal worker you can find the definitions:

polcal:
  enable: true
  label_in: cal
  label_cal: 1pcal
  otfcal:
    enable: true
    label_cal: 1kgb
  extendflags: true
  feed_angle_rotation: '-90'
  uvrange: '>150'
  reuse_existing_tables: false
  pol_calib: xcal
  leakage_calib: fcal
  gain_solint: '60s'
  time_solint: 'inf'
  plotgains: true
  apply_pcal: true
  applyto:
    - gcal
    - bpcal
    - xcal

or , specifically, you can see that the default is to use :

  pol_calib: xcal
  leakage_calib: fcal

Try changing this as recommended in the helper text, i.e.:

  pol_calib: xcal
  leakage_calib: xcal
harukasakemi commented 4 months ago

Hi @AstroRipples ! Thank you for your comment. We tried,

pol_calib: xcal
leakage_calib: xcal

but we got the following KeyError, 2024-02-08 13:40:34 CARACal ERROR: '1827-360' [KeyError].

I attached another log file. Do we need to change the source name or anything?? log-caracal_error.txt

AstroRipples commented 4 months ago

Okay, I think I've found the issue. Looking at the CARACal documentation for the polcal worker (here: https://caracal.readthedocs.io/en/latest/manual/workers/polcal/index.html) the default behaviour is for polcal to try and set the model for the polarisation calibrator:

set_model_pol bool, optional, default = True Fill in the MODEL column of the .MS file(s) for the polarized calibrator in preparation for polcalibration. This can be done only for 3C138 and 3C286 using the CASA setjy for point-source models. If False it will derive the model by fitting the PA coverage. This can be done only if more than 3 scans have been acquired. Not recommended for small PAs coverage.

In this case, as 1827-360 is not a known calibrator source, this is not the behaviour you want, so adding set_model_pol: False somewhere in the polcal worker ought to fix your issue. However, I strongly suggest you look at the documentation and try to understand exactly what's going on and what the tasks are doing in case there are other changes you may want/need to make.

As a final curiosity, I looked at the observing details for the particular dataset you're trying to process and I noticed that 3C286 was observed during the course of the observing run. That's one of the gold-standard polarisation calibrators. Is there a good reason you're not using that source to calibrate the polarisation angle?

harukasakemi commented 4 months ago

@AstroRipples I'm sorry for my late response and appreciate your comment! We tried to use 3C286 and got same error... log-caracal.txt meerkat-fullStokes-continuum-240302.txt

harukasakemi commented 4 months ago

@AstroRipples I think we need to change the source name '1934-638' to the one listed in the error cord, such as 'PKS1934-63' and 'PKS 1934-638'. We tried to change the calibrator name referencing the casa guide page. However, it seems not enough. Could you tell us how we edit the target name?

harukasakemi commented 4 months ago

We resolved this problem! We succeeded in changing the source name using the method shown on the Casa Guide page. Before running workers, we need to remove the old obsinfo file since Caracal refers to it, not to update it.

Thank you for your cooperation! I will close this ticket.