Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
refactor(propagate_DFT.py): move _adjust_sensitivity_matrix_iDFT to b…
Browse files Browse the repository at this point in the history
…elow its use
  • Loading branch information
BjoernLudwigPTB committed Mar 14, 2023
1 parent c241390 commit c30b0ad
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/PyDynamic/uncertainty/propagate_DFT.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,27 +329,6 @@ def _compute_sensitivity_matrix_wrt_sine_part(_k, _beta):
return -np.sin(_k * _beta)[np.newaxis, :]


def _adjust_sensitivity_matrix_iDFT(C, N_out, N_out_default):
# multiply by two because to compensate missing left side of spectrum
C[:, 1:] *= 2

# in case of undersampling, remove higher frequencies
highest_non_zero_entry = -1
if N_out < N_out_default:

# N_out corresponds only to the first l items of spectrum
highest_non_zero_entry = N_out // 2

# erase influence of spectrum above highest_non_zero_entry
C[:, highest_non_zero_entry + 1 :] = 0

# undo factor two for even signal lengths
if N_out % 2 == 0 and N_out <= N_out_default:
C[:, highest_non_zero_entry] *= 0.5

return C


def GUM_iDFT(
F: np.ndarray,
UF: np.ndarray,
Expand Down Expand Up @@ -454,6 +433,27 @@ def GUM_iDFT(
return x, Ux / N_out**2


def _adjust_sensitivity_matrix_iDFT(C, N_out, N_out_default):
# multiply by two because to compensate missing left side of spectrum
C[:, 1:] *= 2

# in case of undersampling, remove higher frequencies
highest_non_zero_entry = -1
if N_out < N_out_default:

# N_out corresponds only to the first l items of spectrum
highest_non_zero_entry = N_out // 2

# erase influence of spectrum above highest_non_zero_entry
C[:, highest_non_zero_entry + 1 :] = 0

# undo factor two for even signal lengths
if N_out % 2 == 0 and N_out <= N_out_default:
C[:, highest_non_zero_entry] *= 0.5

return C


def GUM_DFTfreq(N, dt=1):
"""Return the Discrete Fourier Transform sample frequencies
Expand Down

0 comments on commit c30b0ad

Please sign in to comment.