Question: I have a 2-dimensional lattice (L\*L) with fixed boundaries and considering N-S-W-E sites as 4 neighbours to each site. Each site is assigned an float value. For each site I am calculating average of values of its neighbouring sites added to its own value. I want to solve this using convolv2d from scipy.signal. Following is my code:

```
# xi_out = constant1*xi + constant2*(sum of xi's neighbours)/no_of_xi's_neighbours

import numpy as np
from scipy.signal import convolve2d

L = 6  # each side of 2D lattice
a, b = (0.1, 0.5) # two constants
arr = np.random.rand(L, L) # example 2D array
# (3,3) window representing 4 neighbours which slides over 'arr'
kernel = np.array([[0, b, 0],
                   [b, a, b],
                   [0, b, 0]])
neighbors_sum = convolve2d(arr, kernel, mode='same', boundary='fill', fillvalue=0)
print(neighbors_sum)

```

I can not find a way to divide sum of neighbouring values for each site by number of its neighbours. 

In following manner I can find number of neighbours for each site but do not know how to incorporate these values into 'result'. Can somebody suggest me how can I achieve that or is there a simpler in-built method in convolve2d to do that ?

```
arr = np.ones((L,L), dtype=np.int)
kernel = np.array([[0, 1, 0],
                   [1, 0, 1],
                   [0, 1, 0]])
neighbors_count = convolve2d(arr, kernel, mode='same', boundary='fill', fillvalue=0)
print(neighbors_count)

```

Answer: 
[jQuery.getJSON()](http://api.jquery.com/jquery.getjson/) load JSON-encoded data from the server using a GET HTTP request.

As you post in your JSON structure you can access to the array by calling `json.data`:

```
$.getJSON("/ajax/data/myjasonfile.json", function(json) {
     console.log(json.data); // Logs your array
});

```
you can try this:

```
$.getJSON("test.json", function(json) {
    console.log(json); // this will show the info it in firebug console
});

```

I think, Some issue is in your path to call json file. you need to check again of path.

You can check this link: [Loading local JSON file](https://stackoverflow.com/questions/7346563/loading-local-json-file)