Skip to content

Commit 8b183d9

Browse files
committed
Fixed problem with generation of estimation points
1 parent 69d362b commit 8b183d9

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

kcsd/KCSD.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,8 @@ def estimate_at(self):
500500
self.estm_x : Locations at which CSD is requested.
501501
502502
"""
503-
nx = (self.xmax - self.xmin)/self.gdx
504-
self.estm_x = np.mgrid[self.xmin:self.xmax:np.complex(0, nx)]
503+
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
504+
self.estm_x = np.linspace(self.xmin, self.xmax, nx)
505505
self.n_estm = self.estm_x.size
506506
self.ngx = self.estm_x.shape[0]
507507
self.estm_pos = self.estm_x.reshape(self.n_estm, 1)
@@ -672,10 +672,10 @@ def estimate_at(self):
672672
self.estm_x, self.estm_y : Locations at which CSD is requested.
673673
674674
"""
675-
nx = (self.xmax - self.xmin)/self.gdx
676-
ny = (self.ymax - self.ymin)/self.gdy
677-
self.estm_pos = np.mgrid[self.xmin:self.xmax:np.complex(0, nx),
678-
self.ymin:self.ymax:np.complex(0, ny)]
675+
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
676+
ny = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
677+
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, nx),
678+
np.linspace(self.ymin, self.ymax, ny))
679679
self.estm_x, self.estm_y = self.estm_pos
680680
self.n_estm = self.estm_x.size
681681
self.ngx, self.ngy = self.estm_x.shape
@@ -983,13 +983,12 @@ def estimate_at(self):
983983
self.estm_x, self.estm_y, self.estm_z : Pts. at which CSD is requested
984984
985985
"""
986-
nx = (self.xmax - self.xmin)/self.gdx
987-
ny = (self.ymax - self.ymin)/self.gdy
988-
nz = (self.zmax - self.zmin)/self.gdz
989-
990-
self.estm_pos = np.mgrid[self.xmin:self.xmax:np.complex(0, nx),
991-
self.ymin:self.ymax:np.complex(0, ny),
992-
self.zmin:self.zmax:np.complex(0, nz)]
986+
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
987+
ny = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
988+
nz = int(np.rint((self.zmax - self.zmin)/self.gdz)) + 1
989+
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, nx),
990+
np.linspace(self.ymin, self.ymax, ny),
991+
np.linspace(self.zmin, self.zmax, nz))
993992
self.estm_x, self.estm_y, self.estm_z = self.estm_pos
994993
self.n_estm = self.estm_x.size
995994
self.ngx, self.ngy, self.ngz = self.estm_x.shape

0 commit comments

Comments
 (0)