ptiede / Comrade.jl

MIT License
43 stars 8 forks source link

Error while trying the Imaging a Black Hole using only Closure Quantities example #313

Closed aburousan closed 8 months ago

aburousan commented 10 months ago

I was trying out the code given here : https://ptiede.github.io/Comrade.jl/stable/examples/imaging_closures/ But the line obs = scan_average(obs).add_fractional_noise(0.01).flag_uvdist(uv_min=0.1e9) gives me the following error.

ERROR: Python: TypeError: must be real number, not complex
Python stacktrace:
 [1] pandas._libs.lib.maybe_convert_objects
   @ pandas/_libs/lib.pyx:2466
 [2] agg_series
   @ pandas.core.groupby.ops ~/.local/lib/python3.10/site-packages/pandas/core/groupby/ops.py:996
 [3] _python_agg_general
   @ pandas.core.groupby.generic ~/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py:288
 [4] aggregate
   @ pandas.core.groupby.generic ~/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py:266
 [5] <dictcomp>
   @ pandas.core.apply ~/.local/lib/python3.10/site-packages/pandas/core/apply.py:421
 [6] agg_dict_like
   @ pandas.core.apply ~/.local/lib/python3.10/site-packages/pandas/core/apply.py:420
 [7] agg
   @ pandas.core.apply ~/.local/lib/python3.10/site-packages/pandas/core/apply.py:163
 [8] aggregate
   @ pandas.core.groupby.generic ~/.local/lib/python3.10/site-packages/pandas/core/groupby/generic.py:1269
 [9] coh_avg_vis
   @ ehtim.statistics.dataframes ~/Code/Julia/Projects/cosmology/.CondaPkg/env/lib/python3.10/site-packages/ehtim/statistics/dataframes.py:198
 [10] avg_coherent
   @ ehtim.obsdata ~/Code/Julia/Projects/cosmology/.CondaPkg/env/lib/python3.10/site-packages/ehtim/obsdata.py:1143
Stacktrace:
 [1] pythrow()
   @ PythonCall ~/.julia/packages/PythonCall/qTEA1/src/err.jl:94
 [2] errcheck
   @ ~/.julia/packages/PythonCall/qTEA1/src/err.jl:10 [inlined]
 [3] pycallargs
   @ ~/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:211 [inlined]
 [4] pycall(f::Py, args::Float64; kwargs::Base.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:scan_avg,), Tuple{Bool}}})
   @ PythonCall ~/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:222
 [5] pycall
   @ ~/.julia/packages/PythonCall/qTEA1/src/abstract/object.jl:218 [inlined]
 [6] #_#11
   @ ~/.julia/packages/PythonCall/qTEA1/src/Py.jl:341 [inlined]
 [7] Py
   @ ~/.julia/packages/PythonCall/qTEA1/src/Py.jl:341 [inlined]
 [8] scan_average(obs::Py)
   @ Pyehtim ~/.julia/packages/Pyehtim/YyZzM/src/Pyehtim.jl:63
 [9] top-level scope
   @ REPL[15]:1

Information on the packages: [deps] Comrade = "99d987ce-9a1e-4df8-bc0b-1ea019aa547b" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Pyehtim = "3d61700d-6e5b-419a-8e22-9c066cf00468" and using julia 1.9.2

ptiede commented 10 months ago

This is a pandas v2 issue with eht-imaging. How did you install Pyehtim and pandas?

aburousan commented 10 months ago

Just using conda for both pandas and for pyehtim i have used pkg

ptiede commented 10 months ago

So Pyehtim should've forced a pandas downgrade but it is probably using your system version for some reason. This is likely an issue with CondaPkg. The simplest solution is to downgrade your pandas version to be < 2 since eht-imaging doesn't work pandas V2.