ratt-ru / pfb-imaging

Preconditioned forward/backward clean algorithm
MIT License
6 stars 5 forks source link

AttributeError: 'UnicodeType' object has no attribute 'literal_value' #109

Open bngcebetsha opened 1 week ago

bngcebetsha commented 1 week ago

I was running:

 pfb init --ms ../1556467257_sdp_l0.f0.2nd_avg.1k_8s.ms -ipi -1 -cpi 128 -o output --data-column 'CORRECTED_DATA-MODEL_DATA' --weight-column WEIGHT_SPECTRUM -nw 1 --bda-decorr 0.98 -ldir pfb-logs

This ran for almost 2 minutes and then threw this exception:

  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/numba/core/types/functions.py", line 308, in get_call_type
    sig = temp.apply(nolitargs, nolitkws)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/numba/core/typing/templates.py", line 350, in apply
    sig = generic(args, kws)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/numba/core/typing/templates.py", line 613, in generic
    disp, new_args = self._get_impl(args, kws)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/numba/core/typing/templates.py", line 712, in _get_impl
    impl, args = self._build_impl(cache_key, args, kws)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/numba/core/typing/templates.py", line 785, in _build_impl
    ovf_result = self._overload_func(*args, **kws)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/pfb/utils/weighting.py", line 271, in nb_weight_data_impl
    vis_func, wgt_func = stokes_funcs(data, jones, product, pol, nc)
  File "/home/bngcebetsha/cal_quartical/pfb/pfb-env/lib/python3.10/site-packages/pfb/utils/stokes.py", line 41, in stokes_funcs
    if pol.literal_value == 'linear':
AttributeError: 'UnicodeType' object has no attribute 'literal_value'
landmanbester commented 1 week ago

Post the output of pip freeze here please

bngcebetsha commented 1 week ago

when I print out the value of pol I get: unicode_type. Output of pip freeze attached pip_freeze.txt

landmanbester commented 1 week ago

Ah, I can reproduce. Triggered in numba==0.60. I'll try get a fix in asap. You can downgrade numba to 0.59.1 for a workaround

bngcebetsha commented 1 week ago

Looks like this issue can be closed too

landmanbester commented 1 week ago

Please leave it open. Something subtle has changed when using overload with literals. I'm using literally (liberally) but still running into issues with numba==0.60.0. I've pinned numba for the time being, will take a closer look tomorrow

landmanbester commented 6 days ago

Adding prefer_literal=True to the overload function fixes the problem thanks @sjperkins. I've unpinned numba and will close this once I've merged the latest dev branch