Skip to content

Commit

Permalink
Fixes pyWrapper case for frequency probes
Browse files Browse the repository at this point in the history
  • Loading branch information
lmdiazangulo committed Jan 1, 2025
1 parent 59bbc96 commit 88613ff
Show file tree
Hide file tree
Showing 3 changed files with 29,985 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src_pyWrapper/pyWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ def _getTagFromFilename(fn):
def _getPositionStrFromFilename(fn):
bn_no_ext = os.path.splitext(os.path.basename(fn))[0]
tag = Probe._getTagFromFilename(fn)
if '_df' in bn_no_ext:
bn_no_ext = bn_no_ext.replace('_df', '')
position_str = bn_no_ext.split(tag)[1]
return position_str

Expand Down
11 changes: 10 additions & 1 deletion test/pyWrapper/test_pyWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ def test_read_wire_probe():
assert p['current'][0] == 0.0
assert p['current'].iat[-1] == -0.513576742E-004

def test_read_probe_with_no_dot_fdtd_name():
def test_read_probe_from_NFDE():
p = Probe(OUTPUT_FOLDER + 'fakeCurrentProbe_mid_point_Wz_11_11_11_s2.dat')

assert p.type == 'wire'

def test_read_frequency_probe_from_NFDE():
p = Probe(OUTPUT_FOLDER + 'edelcadfixZ_COR2_log__Wz_21_21_28_s10_df.dat')

assert p.type == 'wire'
assert p.domainType == 'frequency'
assert np.all(p.cell == np.array([21, 21, 28]))
assert p.segment == 10


def test_read_point_probe():
p = Probe(OUTPUT_FOLDER + 'shieldingEffectiveness.fdtd_front_Ex_1_1_1.dat')
Expand Down
Loading

0 comments on commit 88613ff

Please sign in to comment.