[Wannier] kslice Matplotlib griddata error

Bhargab Kakati bhrgabkakati at iasst.res.in
Thu Nov 9 13:13:08 CET 2023


On 2023-11-09 17:30, Vahid Askarpour wrote:
> Dear Wannier90 community,
> 
> I am using Wannier90/3.1.0 to plot a slice of my data. The postw90.x 
> creates the necessary python code but I get the following error when 
> running this python script:
> 
>  File 
> "/gpfs/scratch/vaskarpo/Mn3Ge_hex/kslice/wannier90-kslice-curv_x+fermi_lines.py", 
> line 64, in <module>
>     valint = ml.griddata(points_x,points_y, val_log, xint,yint)
> AttributeError: module 'matplotlib.mlab' has no attribute ‘griddata'
> 
> Does any one know how to remedy this? I tried replacing the ml.griddata 
> with scipy.interpolate.griddata but then I get the following error:
> 
>   File 
> "/gpfs/scratch/vaskarpo/Mn3Ge_hex/kslice/wannier90-kslice-curv_x+fermi_lines.py", 
> line 64, in <module>
>     valint = interpolate.griddata(points_x,points_y, val_log, grid_x, 
> grid_y)
>   File 
> "/cvmfs/soft.computecanada.ca/easybuild/software/2020/avx512/Core/scipy-stack/2023b/lib/python3.10/site-packages/scipy/interpolate/_ndgriddata.py", 
> line 253, in griddata
>     if ndim == 1 and method in ('nearest', 'linear', 'cubic'):
> ValueError: The truth value of an array with more than one element is 
> ambiguous. Use a.any() or a.all()
> 
> I am attaching the python script.
> 
> Any suggestion is appreciated.
> 
> Thanks,
> Vahid
> 
> 
> _______________________________________________
> Wannier mailing list
> Wannier at lists.quantum-espresso.org
> https://lists.quantum-espresso.org/mailman/listinfo/wannier

Hello,

I encountered a similar issue a while back and was able to tackle it by 
commenting out the line "valint = ml.griddata(points_x,points_y, 
val_log, xint,yint)" and replacing it with "valint = 
interpolate.griddata((points_x,points_y), val_log, (grid_x, grid_y), 
method='nearest')  # or 'cubic' or 'nearest', as requiredS". Hope it 
helps.

Regards,

Bhargab Kakati,
Research Scholar,
Computational Materials Science lab,
Institute of Advanced Study in Science and Technology,
Guwahati-781035, Assam, India


More information about the Wannier mailing list