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

Apply grid normalization #90

Merged
merged 1 commit into from
Nov 18, 2021
Merged

Apply grid normalization #90

merged 1 commit into from
Nov 18, 2021

Conversation

alecandido
Copy link
Member

Hi @cschwan, as you know from #89 we are dealing with normalizations, and I proposed to skip pineappl remap and write instead something in python.

The idea is:

  1. load the grid
  2. apply normalization
  3. dump the grid

Nevertheless, point 2 is not that easy, so I tried to figure a way out of it, as easy as possible.

I had a look inside pineappl remap, and I found that you use BinRemapper to apply normalization:
https://github.com/N3PDF/pineappl/blob/32e63c92cd9ea8358d6e193e068a9ee33d917979/pineappl_cli/src/remap.rs#L155-L161
and this is the only place where the CLI argument norm appears.

So my idea for point 2 would be:

  1. get the remapper (grid.more_members.upgrade() should guarantee is available)
  2. copy the limits
  3. copy normalizations and multiply by norm
  4. create a new BinRemapper
  5. set the new remapper

Unfortunately, I noticed the remapper inside the more_members is an option, so it might not be available, then: what should I do in the case?

Moreover, I would need to implement a getter for bin_remapper in python, and before even in pineappl crate. Then I was wondering:

  • should I implement the getter and do as above?
  • or should we make the normalize/renormalize a method of Grid directly inside pineappl?

P.S.: I needed a commit to open the PR, but I had nothing to commit, so the moment we start I'll just squash it and remove the empty help file

@codecov
Copy link

codecov bot commented Nov 17, 2021

Codecov Report

Merging #90 (9576553) into master (32e63c9) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #90   +/-   ##
=======================================
  Coverage   85.64%   85.64%           
=======================================
  Files          14       14           
  Lines        2076     2076           
=======================================
  Hits         1778     1778           
  Misses        298      298           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32e63c9...9576553. Read the comment docs.

@cschwan
Copy link
Contributor

cschwan commented Nov 18, 2021

The situation with BinRemapper is unfortunately complicated, as I didn't forsee something like it would be needed when I designed the Grid struct. I think what you want to do is to use BinInfo, for which you can get an instance using Grid::bin_info. With a BinInfo object you can get all limits using BinInfo::left and BinInfo::right, and also the normalizations using BinInfo::normalizations, irrespectively of whether there's a remapper or not. This you can use to a set a remapper.

@cschwan
Copy link
Contributor

cschwan commented Nov 18, 2021

See also #83 (comment).

@alecandido
Copy link
Member Author

I took the chance to add grid.scale to python API.

It's doing nothing else, then I would merge.

To be deleted

To be deleted
@cschwan
Copy link
Contributor

cschwan commented Nov 18, 2021

All right, go ahead!

@alecandido alecandido merged commit 9576553 into master Nov 18, 2021
@alecandido alecandido deleted the normalize-grids branch November 18, 2021 15:40
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