Conversation
|
cc: @siranipour no need to review yet but you may wnt to take a look - please bear in mind it still requires some work 😅 |
…t0 test but more required.
…ython commondata and cutting it
|
Should merge #1053 first. I just wanted the diff to only be relevant stuff. It occurs to me that we also need to be able to construct the weighted covmats, which I shall do in another PR. |
RosalynLP
left a comment
There was a problem hiding this comment.
@wilsonmr this is just my first look through it, I checked the tests and had a look at the structure and how everything works. It makes sense to me and looks good but I will go back and check things more thoroughly with numerical examples next week.
Co-authored-by: Rosalyn Pearson <33020850+RosalynLP@users.noreply.github.com>
|
@wilsonmr I was trying to use the API to play around with this a bit but I am running up against some problems... it's probably me doing something really stupid, but essentially I was trying to load a fit runcard and use that to find In [2]: from validphys.api import API
In [3]: import yaml
In [4]: with open("9pt_runcard.yaml", "r") as stream:
...: input_dat = yaml.safe_load(stream)
...:
In [5]: input_dat
Out[5]:
{'description': 'NNPDF3.1 baseline for global fit with 9 point theory covariance matrix',
'dataset_input': [{'dataset': 'NMCPD', 'frac': 0.5},
{'dataset': 'NMC', 'frac': 0.5},
{'dataset': 'SLACP', 'frac': 0.5},
{'dataset': 'SLACD', 'frac': 0.5},
{'dataset': 'BCDMSP', 'frac': 0.5},
{'dataset': 'BCDMSD', 'frac': 0.5},
{'dataset': 'CHORUSNU', 'frac': 0.5},
{'dataset': 'CHORUSNB', 'frac': 0.5},
{'dataset': 'NTVNUDMN', 'frac': 0.5},
{'dataset': 'NTVNBDMN', 'frac': 0.5},
{'dataset': 'HERACOMBNCEM', 'frac': 0.5},
{'dataset': 'HERACOMBNCEP460', 'frac': 0.5},
{'dataset': 'HERACOMBNCEP575', 'frac': 0.5},
{'dataset': 'HERACOMBNCEP820', 'frac': 0.5},
{'dataset': 'HERACOMBNCEP920', 'frac': 0.5},
{'dataset': 'HERACOMBCCEM', 'frac': 0.5},
....
In [6]: API.t0_covmat(**input_dat)
Failed processing key dataset_input.
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/nnpdf/validphys2/src/validphys/config.py in parse_dataset_input(self, dataset)
299 try:
--> 300 name = dataset["dataset"]
301 if not isinstance(name, str):
KeyError: 'dataset'
.......
ConfigError: 'dataset' must be a mapping with 'dataset' and 'sysnum' |
|
That config isn't right, it should either be |
Ah thank you, you are right of course! |
|
Just a bump to get a review for this |
|
It's on my todo list chief, promise to take a look pronto |
|
Yeah sorry same! |
siranipour
left a comment
There was a problem hiding this comment.
Looks great just some minor comments
| central_values: None, np.array | ||
| 1-D array containing alternative central values to combine with | ||
| multiplicative uncertainties. This array must have length equal | ||
| to :py:attr:`self.ndata` | ||
|
|
There was a problem hiding this comment.
Maybe we should specify the default value is None and if so the behaviour is to use the commondata's own experimental central values
There was a problem hiding this comment.
So I looked up if this was easy to do in sphinx and it didn't really seem so, perhaps having the default assignment in the function arguments is enough
There was a problem hiding this comment.
Oh I thought you meant just to add it to docstring. I'm not sure I understand your comment now. You mean like
def ...(..., central_values=self.central_values) or something? I think a default of None and explaining what happens is ok here. Perhaps I'm misunderstanding something.
There was a problem hiding this comment.
Oh my bad, I've confused myself, I was referring to a comment I made in the review, but subsequently deleted. ignore that last comment.
Yeah if we just add default is None which uses the commondata's own central value to the docstring, that should befine
…tic does, small fix of docstring
As discussed I'm adding one of the other ingredients for using the python commondata in fit. I've also added some actions so the new functions can be called from the API.
I thought I was being clever adding
load_commondatato theCommonDataSpecclass but it ended up making circular dependencies - I think a better option would have a provider which calls the funciton on aCommonDataSpec. Whilst I'm at it I will make a second provider which applies cuts.