Skip to content

Conversation

henryiii
Copy link
Member

@henryiii henryiii commented Jun 4, 2018

ParameterContainer is now checked when trace is on, and mismatched increments are errors. Several problems with 4 body amps mismatching fixed.

Also fixing extra white space and normalize spelling. Nicer makefile too. Bug in usage of setData fixed.

@henryiii
Copy link
Member Author

henryiii commented Jun 4, 2018

@galapaegos , if you get a chance, please compile with trace on and look at the remaining mismatches. I'm getting some normalize should be 0 errors that probably are an issue, and haven't inspected 3 body yet.

@henryiii
Copy link
Member Author

henryiii commented Jun 5, 2018

The problem seems to be that the normalize (binned) call uses 3N-element non-incrementing "normalize" values (min, max, and bins for N observables), and this causes the PC increment to either expect 0 increment (no argument case) or 1 increment (argument case).

@henryiii
Copy link
Member Author

henryiii commented Jun 5, 2018

import numpy as np

mean = 1.5
sigma = 2.5
x = np.array((1.2, 7.2))
f = np.exp(-(x - mean)**2 / sigma**2)
fn = f / np.sqrt(2 * np.pi * sigma**2)

print("g({}) = {} -> {} normalized".format(x[0], f[0], fn[0]))
print("g({}) = {} -> {} normalized".format(x[1], f[1], fn[1]))

# g(1.2) = 0.985703184122443 -> 0.15729547042910427 normalized
# g(7.2) = 0.005525397988803928 -> 0.0008817259495115716 normalized

@henryiii
Copy link
Member Author

henryiii commented Jun 6, 2018

Right now, these are the same number:

CHECK(gauss.getValue(EvalFunc::Prob) == 0.99282585_a);
CHECK(gauss.getValue(EvalFunc::Eval) == 0.99282585_a);

And they shouldn't be. The Prob one should be multiplying by the normalization, which is not supposed to be one (and isn't, according to the check above this one).

@galapaegos
Copy link
Contributor

Ahh, I was looking at the wrong side. I believe I know the cause of this issue. The normalization value is being reset due to the second setIndices call under getValue. The idea is to pre-compute the values, then use them for other calculations. First, we need to add a 'normalize value' under PdfBase that will cache the computed value. This value will be written under populateArray. The default value needs to be 1.0. I think this will cover the cases.

@henryiii
Copy link
Member Author

henryiii commented Jun 6, 2018

Thanks for fixing those irritating consts! I think it looks great. Will try to give one last look over and merge very soon.

@henryiii
Copy link
Member Author

henryiii commented Jun 6, 2018

Nice; cached normalizations may be very useful; they could replace the host array at some point.

@henryiii henryiii merged commit 60a2fd3 into master Jun 7, 2018
@henryiii henryiii deleted the pcfix branch June 7, 2018 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants