NNPDF / pineappl

PineAPPL is not an extension of APPLgrid
https://nnpdf.github.io/pineappl/
GNU General Public License v3.0
13 stars 3 forks source link

Channel manipulation in grids #149

Closed alecandido closed 5 months ago

alecandido commented 2 years ago

We should expose in the Python interface a function to manipulate luminosity function (in the first place, we need such a function in the Rust library).

Of course complicate manipulation are useless, but I would add a couple of simple ones:

Both of them should not involve generating further subgrids (but possibly dropping them), since the luminosity function can already optimize for equal channels. So, they are mostly about manipulating the luminosity function itself, rather than subgrids.

Even before, I will:

alecandido commented 2 years ago
  • [x] expose the Grid.lumi in the Python interface.

Ok, this was simple. Done in 5f4902f6e665c7f1734353376abb46db9216ad16.

cschwan commented 2 years ago

This will probably not do what you'd like: it only returns the first flavour combination, but discards the remaining flavour combinations and factors.

alecandido commented 2 years ago

This will probably not do what you'd like: it only returns the first flavour combination, but discards the remaining flavour combinations and factors.

I didn't understand...

The function I put above is just to query which is the luminosity function of the given grid. It is just a read function, not one for manipulating...

cschwan commented 2 years ago

This line:

https://github.com/N3PDF/pineappl/commit/5f4902f6e665c7f1734353376abb46db9216ad16#diff-1f7e3cc6363a7e6cbf795dc23874cf1e6c5d09b5b254ce0c8710e389f2f6badaR593

will return uu~ if your lumi entry is 2 * uu~ + 1 * cc~. You're probably thinking of FkTable which has the limitation that all lumis are trivial, but that limitation doesn't exist for Grid.

alecandido commented 2 years ago

Ops, you're right...

Just copied from here: https://github.com/N3PDF/pineappl/blob/5f4902f6e665c7f1734353376abb46db9216ad16/pineappl/src/fk_table.rs#L202 and I didn't notice the zero.

But you're right of course, let me iterate even on that dimension.

alecandido commented 2 years ago

I just tested on a DIS grid, and even there it was working, but because in yadism we're always writing trivial lumis...

cschwan commented 2 years ago

Madgraph5 doesn't and usually they're very non-trivial because we assume a diagonal CKM matrix.

alecandido commented 2 years ago

@cschwan check if now is more sensible (I checked is compiling and working, but again, on DIS; I'm going to check right now on TEST_RUN_SH)

cschwan commented 2 years ago

That looks much better, but you're still throwing away the factors; without them the lumis are incomplete!

alecandido commented 2 years ago

I had another try :)

cschwan commented 2 years ago

See also #165, this would simplify any querying/manipulation of the lumi function.

alecandido commented 1 year ago
  • [ ] duplicate a lumi channel

I don't remember any longer why this would have been useful...

I still would like to be able to drop lumi channels (and consequently associated subgrids), and manipulate existing ones (i.e. manipulate/replace the content of a LumiEntry). But for sure, what I don't want to do is to create additional channels, since there would be no subgrid associated, or I should copy all the existing subgrids associated to another channel.

cschwan commented 1 year ago

During the implementation of #199 I noticed that it's useful to have the following type of operation (and that should explain the question in https://github.com/NNPDF/pineappl/issues/149#issuecomment-1401901494):

This allows to implement the following operations:

cschwan commented 1 year ago

Another operation that we'll need is to change the factors of the luminosity function if we'd like to change the values of the CKM matrix, for instance.

cschwan commented 10 months ago

Another operation that we'll need is to change the factors of the luminosity function if we'd like to change the values of the CKM matrix, for instance.

This can be done with with the Grid::set_lumis method and the CLI's write --rewrite-channels. This gist shows an application of it.

cschwan commented 5 months ago

In meantime we have quite a few operations on channels:

and also the general-purpose access methods:

which allow to change the channels arbitrarily. I'm closing this Issue, if more methods are required, please open a new Issue.