Skip to content

Commit

Permalink
Fix issue with computing PSD when data has NaNs or Infs
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Feb 7, 2024
1 parent a699ef4 commit 88d01ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
20 changes: 2 additions & 18 deletions resources/ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
# App

- Fix issue when event, meta data and HK patterns are empty
- Fix issue with closing invalid figures
-

# Software

- Add method to `mag.Instrument` to fill warm-up with `missing` data
- Add method to `mag.Science` to replace periods with a filler variable
- Add save/load utility class
- Separate calculation of spectrogram in separate function
- Replace last element of file with `missing` to improve plot where data is missing
- Science object with no data is considered empty in `mag.Instrument`
- Reintroduce filtering for charts
- Rename `cropDataBasedOnScience` to `cropToMatch`
- Make sure derivative is empty when data is empty
- Remove unnecessary `Sealed` attributes on classes
- Fix issue with consecutive events of the same type missing a completion message
- Fix issue when cropping data and no timestamps are selected
- Fix issue with `mag.graphics.chart.Stem` not showing markers
- Add tests for `mag.Instrument`, `mag.PSD` and `mag.Science/computePSD`
- Add tests for `mag.graphics.mixin.mustBeColor`
- Fix typo in `MarkerSupportTestCase`
- Fix issue with computing PSD when data has `NaN`s or `Inf`s
5 changes: 4 additions & 1 deletion src/data/+mag/Science.m
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ function replace(this, timeFilter, filler)
% Compute PSD.
dt = seconds(median(diff(t(locFilter))));

[psd, f] = psdtsh(this.XYZ(locFilter, :), dt, options.FFTType, options.NW);
xyz = this.XYZ(locFilter, :);
xyz(ismissing(xyz) | isinf(xyz)) = 0;

[psd, f] = psdtsh(xyz, dt, options.FFTType, options.NW);
psd = psd .^ 0.5;

data = mag.PSD(table(f, psd(:, 1), psd(:, 2), psd(:, 3), VariableNames = ["f", "x", "y", "z"]));
Expand Down

0 comments on commit 88d01ed

Please sign in to comment.