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

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	pyramid/tests/test_phasemapper.py
parents 6eaa81c0 71612458
No related branches found
No related tags found
No related merge requests found
Pipeline #21714 failed
.DS_Store 0 → 100644
File added
.idea .idea
desktop.ini desktop.ini
.DS_Store
File deleted
File deleted
File added
...@@ -437,7 +437,7 @@ class PhaseMapperCharge(PhaseMapper): ...@@ -437,7 +437,7 @@ class PhaseMapperCharge(PhaseMapper):
(self.a, self.dim_uv, self.v_acc) (self.a, self.dim_uv, self.v_acc)
def __call__(self, elec_data): 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 homogeneously-distributed charged metallic sphere.
The elec_data includes the amount of charge in every grid, unit:electron. 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 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): ...@@ -451,7 +451,10 @@ class PhaseMapperCharge(PhaseMapper):
elec_n = elec_a ** 2 + elec_b ** 2 elec_n = elec_a ** 2 + elec_b ** 2
dim_v, dim_u = field.shape 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: # Find list of charge locations and charge values:
vq, uq = np.nonzero(field) vq, uq = np.nonzero(field)
q = field[vq, uq] q = field[vq, uq]
......
File added
...@@ -180,8 +180,8 @@ class TestCasePhaseMapperMIP(unittest.TestCase): ...@@ -180,8 +180,8 @@ class TestCasePhaseMapperMIP(unittest.TestCase):
class TestCasePhaseMapperCharge(unittest.TestCase): class TestCasePhaseMapperCharge(unittest.TestCase):
def setUp(self): def setUp(self):
self.path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'test_phasemapper') 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.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): def tearDown(self):
self.path = None 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