Open vj-1988 opened 7 years ago
I found that generating a gaussian map (in[12]) consumes around 0.5 seconds. So I did something like this
gaussian_map=np.fromfunction(lambda x_p,y_p: np.exp(-1*((x_p - model['boxsize']/2) * (x_p - model['boxsize']/2) +(y_p - model['boxsize']/2) * (y_p - model['boxsize']/2))/2.0 / model['sigma'] /model['sigma']), (model['boxsize'], model['boxsize']), dtype=int)
This one takes 0.0035 seconds since it avoids nested loops.
I found that generating a gaussian map (in[12]) consumes around 0.5 seconds. So I did something like this
gaussian_map=np.fromfunction(lambda x_p,y_p: np.exp(-1*((x_p - model['boxsize']/2) * (x_p - model['boxsize']/2) +(y_p - model['boxsize']/2) * (y_p - model['boxsize']/2))/2.0 / model['sigma'] /model['sigma']), (model['boxsize'], model['boxsize']), dtype=int)
This one takes 0.0035 seconds since it avoids nested loops.