bwinkel / pycraf

pycraf is a package that provides functions and procedures for various tasks in spectrum-management compatibility studies.
35 stars 15 forks source link

pycraf error in scipy1.10 #62

Open mghorba opened 1 year ago

mghorba commented 1 year ago

I've tried running examples at (https://bwinkel.github.io/pycraf/latest/pathprof/index.html). When I try with and without "pathprof.SrtmConf.set(interp='spline', spline_opts=(3, 0))", as below, I get the following error at "pathprof.height_map_data(...". I installed pycraf via pycharm packages in addition to dependencies.

Error: result = evaluate_linear_2d(self.values, File "_rgi_cython.pyx", line 19, in scipy.interpolate._rgi_cython.__pyx_fused_cpdef TypeError: No matching signature found

The crash call chain is as follows. Linear: \utils\decorators.py", line 328 > pathprof\propagation.py", line 738 > pathprof\srtm.py", line 571>scipy\interpolate_rgi.py", line 336

Spline: utils\decorators.py", line 328 > pathprof\propagation.py", line 738 > pycraf\pathprof\helper.py", line 188 > scipy\interpolate_rgi.py", line 336

-----------------------

Code snippet from https://bwinkel.github.io/pycraf/latest/pathprof/index.html that generates error

pathprof.SrtmConf.set(download='missing') pathprof.SrtmConf.set(interp='spline', spline_opts=(3, 0)) #tried without this too

lon_tx, lat_tx = 6.88361 u.deg, 50.52483 u.deg map_size_lon, map_size_lat = 0.5 u.deg, 0.5 u.deg map_resolution = 10. * u.arcsec

freq = 1. u.GHz omega = 0. u.percent # fraction of path over sea temperature = 290. u.K pressure = 1013. u.hPa timepercent = 2 u.percent # see P.452 for explanation h_tg, h_rg = 50 u.m, 10 u.m G_t, G_r = 0 cnv.dBi, 0 cnv.dBi zone_t, zone_r = pathprof.CLUTTER.UNKNOWN, pathprof.CLUTTER.UNKNOWN hprof_step = 100 u.m

hprof_cache = pathprof.height_map_data(lon_tx, lat_tx, map_size_lon, map_size_lat, map_resolution=map_resolution, zone_t=zone_t, zone_r=zone_r,) # dict-like

results = pathprof.atten_map_fast(freq, temperature, pressure, h_tg, h_rg, timepercent, hprof_cache,)

bwinkel commented 1 year ago

Thank you very much for reporting this issue @mghorba! I just checked, the latest released pycraf version (which is not that old!) was tested only against scipy 1.9.3. I'm afraid this error might be owing to a backwards incompatible change in scipy. I was going to make a minor new release soon. Until then, the only possible solution might be to downgrade your scipy to version 1.9. Sorry for the inconvenience.

mghorba commented 1 year ago

Yes, correct @bwinkel. I changed downgraded scipy version from 1.10 to 1.9.3 and the code runs.