Joe, Thank you very much, that was exactly what I needed. Interestingly enough, when kwant.plotter.map(sys, ldos_array) is called again, AFTER dictionary creation, the resulting picture is changed to a random patchwork of colourful rectangles. Regards, Jerzy
On 30/06/14 08:55, Jerzy Wrobel wrote:
Dear All, How to retrieve the actual grid position from a given site index? For example, how to get local_dos at (i,j) space position from 1d Numpy array, on a simple rectangular grid? I assume that it has something to do with pos method, but an simple example will be appreciated. Thanks in advance, Jerzy
Hi,
The ordering of the elements of the output from `local_dos` (as well as `wave_function`) is the same as the ordering of the sites in your finalized system. You can say
ldos_dict = {tuple(site.tag): ldos for site, ldos in zip(fsys.sites, ldos_array)}
where `fsys` is your finalized system and `ldos` is the numpy array returned by `local_dos`. You can then get the value for site `(i,j)` by saying
ldos_dict[i, j]
Note that this will only work in the case where you have 1 orbital per site (i.e. scalar values for your onsite matrix elements).
Hope that helps,
Joe