TriangleDataCenter / TriangleDataCenter/Triangle-Simulator
Mind the boundary elements handling in `fill_fftseries` array of `TDIFlyGB`
Nobody has claimed this yet.
- Dominant language
- Jupyter Notebook
- Stars
- 34
- Forks
- 9
- PR merge metrics
- No merged PRs in 30d
Description
The waveform generated by TDIFlyGB often needs to be placed into an array representing the analyzed frequency band. This is handled by fill_fftseries()
This involves repeated assignments of the boundary elements. Unfortunately, the numpy standard states:
For advanced assignments, there is in general no guarantee for the iteration order. This means that if an element is set more than once, it is not possible to predict the final result.
On my machine, the repeated assigned element in template_filled ends up taking the last corresponding element of data. This does not cause problem for the first element, but if the last element of data falls to the right side of template_filled, then last element of template_filled is incorrectly assigned that value (Causing a sharp drop in figure below).
This phenomenon may not lead to catastrophic errors in parameter estimation because the waveform at the boundary is weak enough. However, the user had better pay attention to this point, especially when the peak lies on the boundary of the analyzed band.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Triangle/TDIFly.py at fill_fftseries() around line 435 and inspect how boundary indices are assigned with NumPy advanced indexing. Reproduce a case where data extends beyond template_filled, then verify that each boundary element receives the intended value without relying on repeated assignment order. Done means the sharp boundary drop is no longer produced for the reported case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100