-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: more control of averaging potentials #1970
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, I think this PR is valuable as a proof of concept study that the averaging of potentials makes a positive difference, but we shouldn't merge it in in it's current form, simply because if we did we would immediately have to fix it up in a patch release anyway.
I think the best route forward is to introduce a PotentialSet
class (distinct from a PartialSet
and a PotentialMap
, and living somewhere in the middle - we might consider renaming the latter to make the separation clear, since the new PotentialSet
class would be based around a std::map
) into which we can implement the necessary de/serialisation and +=
/ /=
operators necessary for the Averaging
functions to work.
@@ -35,6 +36,12 @@ class EPSRManagerModule : public Module | |||
}; | |||
// Potential scalings | |||
std::string potentialScalings_; | |||
// Number of historical partial sets to combine into final partials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Number of historical partial sets to combine into final partials | |
// Number of historical partial sets to combine into final potentials |
@@ -35,6 +36,12 @@ class EPSRManagerModule : public Module | |||
}; | |||
// Potential scalings | |||
std::string potentialScalings_; | |||
// Number of historical partial sets to combine into final partials | |||
std::optional<int> averagingLength_; | |||
// Weighting scheme to use when averaging partials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Weighting scheme to use when averaging partials | |
// Weighting scheme to use when averaging potentials |
src/modules/epsrManager/process.cpp
Outdated
// Check if ran the right amount of iterations before averaging | ||
if (averagedPotentialsStore.size() > averagingLength_) | ||
{ | ||
averagedPotentialsStore.pop_back(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't account for cases where the user changes the averaging length and we need to remove more than one. This curation of data is also handled for us if we move to using the proper Averaging
namespace functions.
src/modules/epsrManager/process.cpp
Outdated
for (auto &&[key, epData] : pots) | ||
{ | ||
averagedPotentials[key].ep += epData.ep; | ||
averagedPotentials[key].ep /= averagingLength_.value(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Careful - the value of averagingLength_
may very well not be equal to the number of potential sets in the averagedPotentialStore
.
0e0b8e9
to
25a1d2f
Compare
Co-authored-by: Adam Washington <[email protected]>
3082f25
to
7f6629e
Compare
Added in capability to average over a specified number of iterations instead of each time. The hope is that this will fix an issue of spikes in r-factor when running the averaging of potentials currently.