ansys / ansys/pymapdl-reader

Cyclic analysis: complex results always use mode pair

Open
#108 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
60
Forks
32
Avg merge
5h 50m
Merged PRs (30d)
8

Description

It looks like the results always use the paired mode (instead of the duplicate sector, if available) when a complex result is requested.

In cyclic_reader.py line 520:
`result_r = self._get_complex_result(func, rnum, result)`

I believe this should be:
`result_r = self._get_complex_result(func, rnum, full_result)`

So that the entire result is passed to _get_complex_result

And farther down the file, starting line 572:
```
if self._is_repeated_mode[rnum]: # get mode pair result
_, result_r = func(self._repeated_index[rnum])
if result_r.shape[0] != self._mas_ind.size:
result_r = result_r[self._mas_ind]
elif has_dup_result: # use the duplicate sector
result_r = full_result[self._dup_ind]
else: # otherwise, a standing wave (no complex component)
result_r = np.zeros((self._mas_ind.size, full_result.shape[1]),
dtype=full_result.dtype)
```

The current logic is:
If there's a paired mode, return the real part of the paired mode.
If there's a duplicate sector, use the duplicate sector
Otherwise, return zeros

I believe the duplicate sector result should be used first if available, to prevent any indexing problems since the matching mode pairs are not defined in the results file (they are determined in cyclic_reader based on frequency).

Contributor guide

Open the contributing guide

Research direction

Start in cyclic_reader.py around lines 520 and 572, tracing how full_result, duplicate sectors, and paired modes reach _get_complex_result. Verify that an available duplicate sector takes precedence and that the complex-result path avoids invalid indexing; done means the requested result follows that precedence without breaking the other fallback cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.