Skip to content
Snippets Groups Projects
Commit 71612458 authored by Jan Caron's avatar Jan Caron
Browse files

Merge branch 'PhaseChargeMapper' into 'master'

The PhaseMapperCharge was updated

See merge request !4
parents c4ce8508 f3a957a1
No related branches found
No related tags found
1 merge request!4The PhaseMapperCharge was updated
Pipeline #21712 failed
.DS_Store 0 → 100644
File added
.idea
desktop.ini
.DS_Store
File deleted
File deleted
File added
......@@ -437,7 +437,7 @@ class PhaseMapperCharge(PhaseMapper):
(self.a, self.dim_uv, self.v_acc)
def __call__(self, elec_data):
""" phase_dipoles() is to calculate the phase from many electric dipoles. The model used to avoid singularity is
""" This is to calculate the phase from many electric dipoles. The model used to avoid singularity is
the homogeneously-distributed charged metallic sphere.
The elec_data includes the amount of charge in every grid, unit:electron.
The electrode_vec is the normal vector of the electrode, (elec_a,elec_b), and the distance to the origin is
......@@ -451,7 +451,10 @@ class PhaseMapperCharge(PhaseMapper):
elec_n = elec_a ** 2 + elec_b ** 2
dim_v, dim_u = field.shape
v, u = np.meshgrid(dim_v, dim_u)
u_cor = range(0, dim_u, 1)
v_cor = range(0, dim_v, 1)
v, u = np.meshgrid(v_cor, u_cor)
# Find list of charge locations and charge values:
vq, uq = np.nonzero(field)
q = field[vq, uq]
......
File added
......@@ -181,7 +181,7 @@ class TestCasePhaseMapperCharge(unittest.TestCase):
def setUp(self):
self.path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_phasemapper')
self.charge_proj = load_scalardata(os.path.join(self.path, 'charge_proj.hdf5'))
self.mapper = PhaseMapperCharge(self.charge_proj.a, self.charge_proj.dim[1:])
self.mapper = PhaseMapperCharge(self.charge_proj.a, self.charge_proj.dim[1:], electrode_vec = [8, 8], v_acc = 300000)
def tearDown(self):
self.path = None
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment