Skip to content

Commit 6ff4459

Browse files
committed
Refactoring
1 parent 9272fbf commit 6ff4459

1 file changed

Lines changed: 12 additions & 15 deletions

File tree

kcsd/KCSD.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,9 @@ def estimate_at(self):
501501
self.estm_x : Locations at which CSD is requested.
502502
503503
"""
504-
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
505-
self.estm_x = np.linspace(self.xmin, self.xmax, nx)
504+
self.ngx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
505+
self.estm_x = np.linspace(self.xmin, self.xmax, self.ngx)
506506
self.n_estm = self.estm_x.size
507-
self.ngx = self.estm_x.shape[0]
508507
self.estm_pos = self.estm_x.reshape(self.n_estm, 1)
509508

510509
def place_basis(self):
@@ -674,14 +673,13 @@ def estimate_at(self):
674673
self.estm_x, self.estm_y : Locations at which CSD is requested.
675674
676675
"""
677-
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
678-
ny = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
679-
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, nx),
680-
np.linspace(self.ymin, self.ymax, ny),
676+
self.ngx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
677+
self.ngy = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
678+
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, self.ngx),
679+
np.linspace(self.ymin, self.ymax, self.ngy),
681680
indexing='ij')
682681
self.estm_x, self.estm_y = self.estm_pos
683682
self.n_estm = self.estm_x.size
684-
self.ngx, self.ngy = self.estm_x.shape
685683

686684
def place_basis(self):
687685
"""Places basis sources of the defined type.
@@ -986,16 +984,15 @@ def estimate_at(self):
986984
self.estm_x, self.estm_y, self.estm_z : Pts. at which CSD is requested
987985
988986
"""
989-
nx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
990-
ny = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
991-
nz = int(np.rint((self.zmax - self.zmin)/self.gdz)) + 1
992-
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, nx),
993-
np.linspace(self.ymin, self.ymax, ny),
994-
np.linspace(self.zmin, self.zmax, nz),
987+
self.ngx = int(np.rint((self.xmax - self.xmin)/self.gdx)) + 1
988+
self.ngy = int(np.rint((self.ymax - self.ymin)/self.gdy)) + 1
989+
self.ngz = int(np.rint((self.zmax - self.zmin)/self.gdz)) + 1
990+
self.estm_pos = np.meshgrid(np.linspace(self.xmin, self.xmax, self.ngx),
991+
np.linspace(self.ymin, self.ymax, self.ngy),
992+
np.linspace(self.zmin, self.zmax, self.ngz),
995993
indexing='ij')
996994
self.estm_x, self.estm_y, self.estm_z = self.estm_pos
997995
self.n_estm = self.estm_x.size
998-
self.ngx, self.ngy, self.ngz = self.estm_x.shape
999996

1000997
def place_basis(self):
1001998
"""Places basis sources of the defined type.

0 commit comments

Comments
 (0)