Skip to content

Commit edb2dab

Browse files
committed
Fixed own basis sources locations in oKCSD2D and oKCSD3D
1 parent f78746a commit edb2dab

1 file changed

Lines changed: 48 additions & 3 deletions

File tree

kcsd/KCSD.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,6 @@ def estimate_at(self):
11951195
11961196
"""
11971197
self.estm_x = self.own_est
1198-
self.src_x = self.own_src
11991198
self.n_estm = self.estm_x.size
12001199

12011200
def place_basis(self):
@@ -1290,9 +1289,32 @@ def estimate_at(self):
12901289
12911290
"""
12921291
self.estm_x, self.estm_y = self.own_est
1293-
self.src_x, self.src_y = self.own_src
12941292
self.n_estm = self.estm_x.size
12951293

1294+
def place_basis(self):
1295+
"""Places basis sources of the defined type.
1296+
1297+
Checks if a given source_type is defined, if so then defines it
1298+
self.basis, This function gives locations of the basis sources,
1299+
Defines
1300+
source_type : basis_fuctions.basis_2D.keys()
1301+
self.R based on R_init
1302+
self.nsx, self.nsy = self.src_x.shape
1303+
self.src_x, self.src_y : Locations at which basis sources are placed.
1304+
1305+
"""
1306+
source_type = self.src_type
1307+
try:
1308+
self.basis = basis.basis_2D[source_type]
1309+
except KeyError:
1310+
raise KeyError('Invalid source_type for basis! available are:',
1311+
basis.basis_2D.keys())
1312+
1313+
self.R = self.R_init
1314+
self.src_x, self.src_y = self.own_src
1315+
self.n_src = self.src_x.size
1316+
self.nsx, self.nsy = self.src_x.shape
1317+
12961318
class oKCSD3D(KCSD3D):
12971319
"""oKCSD - The variant for the Kernel Current Source Density method that
12981320
allows to reconstruct potential and CSD in given 3D space points.
@@ -1360,9 +1382,32 @@ def estimate_at(self):
13601382
13611383
"""
13621384
self.estm_x, self.estm_y, self.estm_z = self.own_est
1363-
self.src_x, self.src_y, self.src_z = self.own_src
13641385
self.n_estm = self.estm_x.size
13651386

1387+
def place_basis(self):
1388+
"""Places basis sources of the defined type.
1389+
1390+
Checks if a given source_type is defined, if so then defines it
1391+
self.basis, This function gives locations of the basis sources,
1392+
Defines
1393+
source_type : basis_fuctions.basis_3D.keys()
1394+
self.R based on R_init
1395+
self.nsx, self.nsy, self.nsz = self.src_x.shape
1396+
self.src_x, self.src_y, self.src_z : Locations at which basis sources are placed.
1397+
1398+
"""
1399+
source_type = self.src_type
1400+
try:
1401+
self.basis = basis.basis_3D[source_type]
1402+
except KeyError:
1403+
raise KeyError('Invalid source_type for basis! available are:',
1404+
basis.basis_3D.keys())
1405+
1406+
self.R = self.R_init
1407+
self.src_x, self.src_y, self.src_z = self.own_src
1408+
self.n_src = self.src_x.size
1409+
self.nsx, self.nsy, self.nsz = self.src_x.shape
1410+
13661411
if __name__ == '__main__':
13671412
print('Checking 1D')
13681413
ele_pos = np.array(([-0.1], [0], [0.5], [1.], [1.4], [2.], [2.3]))

0 commit comments

Comments
 (0)