Ticket #7672 (closed: fixed)
Add moment calculation(s) to statistics module
Reported by: | Peter Peterson | Owned by: | Peter Peterson |
---|---|---|---|
Priority: | minor | Milestone: | Release 3.0 |
Component: | Framework | Keywords: | Maintenance |
Cc: | Blocked By: | ||
Blocking: | #7891 | Tester: | Michael Reuter |
Description (last modified by Peter Peterson) (diff)
Add a calculation of the first n-modes to Kernel/Statistics and expose it to python. The function signature should be:
std::vector<double> getMomentsAboutOrigin(const vector<TYPE>& x, const vector<TYPE>& y, const int maxMoment=3); std::vector<double> getMomentsAboutMean(const vector<TYPE>& x, const vector<TYPE>& y, const int maxMoment=3);
Change History
comment:4 Changed 7 years ago by Peter Peterson
Re #7672. Added moment calculations to Kernel/Statistics.
The two methods are getMomentsAboutOrigin and getMomentsAboutMean. They work for densities and histograms.
Changeset: 1ff6fd9a126450d3e5f9e36fc9ca5e4f1156b02c
comment:5 Changed 7 years ago by Peter Peterson
- Description modified (diff)
The function signature was changed because you need to have the x-axis as well. Also there are two types of moments that people might want so just have both.
comment:6 Changed 7 years ago by Peter Peterson
This is on feature/7672_moment_calc.
To test: since this is really only available from c++, it is probably better to look at the additional unit tests and see if they make sense.
comment:7 Changed 7 years ago by Peter Peterson
- Status changed from inprogress to verify
- Resolution set to fixed
comment:8 Changed 7 years ago by Russell Taylor
- Status changed from verify to reopened
- Resolution fixed deleted
Test is failing on Windows (sometimes)
comment:9 Changed 7 years ago by Martyn Gigg
I ran it in debug and Visual Studio immediately flagged up an out-of-bounds error at Statistics.cpp:364 that must be throwing it off. The fix is obvious as it's the same that is done in the function above so I'll put it in.
comment:10 Changed 7 years ago by Martyn Gigg
- Status changed from reopened to inprogress
Fix loop limit that caused out of bounds error on vector access.
Refs #7672
Changeset: a01a48939f3ca754a2546bdf5f5368df99cd9f0c
comment:11 Changed 7 years ago by Peter Peterson
- Status changed from inprogress to verify
- Resolution set to fixed
comment:12 Changed 7 years ago by Michael Reuter
- Status changed from verify to verifying
- Tester set to Michael Reuter
comment:13 Changed 7 years ago by Michael Reuter
- Status changed from verifying to reopened
- Resolution fixed deleted
The two sets of loops in both functions are nearly identical with the exception of the calculation of temp. The loop max y.size() takes care of both density and histogram cases. Each of the two loops can be consolidated into one.
comment:14 Changed 7 years ago by Peter Peterson
- Status changed from reopened to inprogress
Re #7672. Refactored according to Michael's comments.
Changeset: a0636ccee09271bec331241a2e6cfb79fccb10c0
comment:15 Changed 7 years ago by Peter Peterson
- Status changed from inprogress to verify
- Resolution set to fixed
Assuming that I refactored everything fine (and windoze doesn't break again) the testing should be the same as before.
comment:17 Changed 7 years ago by Michael Reuter
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/7672_moment_calc'
comment:18 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 8517