Skip to content
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

[BUG/FEAT] hist division should convert to floats #601

Open
andrzejnovak opened this issue Jul 6, 2021 · 3 comments
Open

[BUG/FEAT] hist division should convert to floats #601

andrzejnovak opened this issue Jul 6, 2021 · 3 comments
Labels
good first issue Good for newcomers

Comments

@andrzejnovak
Copy link
Member

a = hist.Hist.new.Reg(10,-2,2).Int64().fill(np.random.uniform(-2,2,size=1000))
b = hist.Hist.new.Reg(10,-2,2).Int64().fill(np.random.normal(0,1,size=1000))

print(a.values()/b.values())
print((a/b).values())
>>> [2.51351351 1.46153846 0.92380952 0.82857143 0.59119497 0.70666667
 0.85714286 0.89534884 1.625      3.8125    ]
>>> [2 1 0 0 0 0 0 0 1 3]

@henryiii

@henryiii
Copy link
Member

henryiii commented Jul 6, 2021

hists currently do not change storages under operations. @HDembinski should they? I could probably do that if they should.

@HDembinski
Copy link
Member

In Python, I think the conversion should happen, as this is the least surpring thing. The unlimited storage also converts in this case.

@henryiii henryiii changed the title [BUG] hist division should convert to floats [BUG/FEAT] hist division should convert to floats Sep 15, 2021
@nsmith-
Copy link
Member

nsmith- commented Sep 16, 2021

In addition it would be good if scaling a histogram by a scalar value automatically converts scalar storage (Int64, Double etc.) to Weight storage so that the variance is correctly propagated. In the case here, where two histograms are divided, it is a bit ambiguous what the appropriate variance would be so I am not sure I can recommend conversion to Weight storage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Status: No status
Development

No branches or pull requests

5 participants