From 0e52cd61aecb0ccc51d800fffe7d98551c17ee2e Mon Sep 17 00:00:00 2001 From: Deepak Mallubhotla Date: Sun, 29 Dec 2024 21:08:42 -0600 Subject: [PATCH] feat: adds real spectrum correction, which might cause problems with older stuff --- tantri/dipoles/time_series.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tantri/dipoles/time_series.py b/tantri/dipoles/time_series.py index 79dcfbb..f2d6dd5 100644 --- a/tantri/dipoles/time_series.py +++ b/tantri/dipoles/time_series.py @@ -32,7 +32,8 @@ class TimeSeriesResult: return numpy.real(a * numpy.conjugate(a)) def psd(v): - return sq(scipy.fft.rfft(v)[1:]) * self.delta_t / self.num_points + _logger.debug("Using real part correction and multiplying PSD by 2") + return 2 * sq(scipy.fft.rfft(v)[1:]) * self.delta_t / self.num_points fft_dict = {k: psd(v) for k, v in self.series_dict.items()} freqs = scipy.fft.rfftfreq(self.num_points, self.delta_t)[1:]