Skip to content

Mind the boundary elements handling in fill_fftseries array of TDIFlyGB #12

@DrizzleatDusk

Description

@DrizzleatDusk

The waveform generated by TDIFlyGB often needs to be placed into an array representing the analyzed frequency band. This is handled by fill_fftseries()

self.xp.clip(start_idx[None, :, None] + self.xp.arange(self.Nsparse)[None, None, :], StartBound, EndBound) - StartBound

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).

Image

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions