-
Notifications
You must be signed in to change notification settings - Fork 14
Add python t0 covmat #1052
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
Merged
Add python t0 covmat #1052
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f1108cd
add python t0 covmat and some actions for ease of testing, add basic …
wilsonmr 5794570
added new module with results providers, keep better tab on loading p…
wilsonmr e2df310
update tests to data keyword, where appropriate
wilsonmr 2108cb9
expand python t0 tests
wilsonmr fcc47ed
Apply suggestions from code review
wilsonmr a0227dc
fix up docstrings, removing repetitions and correcting paramters
wilsonmr dfea82c
use params in pytest fixtures to loop over same test with different s…
wilsonmr 649d9c0
update collects to follow convention, add to docstring of systematic …
wilsonmr 85c4fe4
update test to ensure dataset which is assumed to have single systema…
wilsonmr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """ | ||
| results_providers.py | ||
|
|
||
| module which bridges between underlying functions concerned with loading | ||
| theory predictions and data and actions which can be accessed | ||
| by other actions/providers. | ||
|
|
||
| """ | ||
| from reportengine import collect | ||
|
|
||
| from validphys.commondataparser import load_commondata | ||
| from validphys.convolution import central_predictions | ||
|
|
||
| def loaded_commondata_with_cuts(commondata, cuts): | ||
| """Load the commondata and apply cuts. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| commondata: validphys.core.CommonDataSpec | ||
| commondata to load and cut. | ||
| cuts: validphys.core.cuts, None | ||
| valid cuts, used to cut loaded commondata. | ||
|
|
||
| Returns | ||
| ------- | ||
| loaded_cut_commondata: validphys.coredata.CommonData | ||
|
|
||
| """ | ||
| lcd = load_commondata(commondata) | ||
| return lcd.with_cuts(cuts) | ||
|
|
||
| dataset_inputs_loaded_cd_with_cuts = collect( | ||
| "loaded_commondata_with_cuts", ("data_input",)) | ||
|
|
||
|
|
||
| def dataset_t0_predictions(dataset, t0set): | ||
| """Returns the t0 predictions for a ``dataset`` which are the predictions | ||
| calculated using the central member of ``pdf``. Note that if ``pdf`` has | ||
| errortype ``replicas``, and the dataset is a hadronic observable then the | ||
| predictions of the central member are subtly different to the central | ||
| value of the replica predictions. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| dataset: validphys.core.DataSetSpec | ||
| dataset for which to calculate t0 predictions | ||
| t0set: validphys.core.PDF | ||
|
wilsonmr marked this conversation as resolved.
|
||
| pdf used to calculate the predictions | ||
|
|
||
| Returns | ||
| ------- | ||
| t0_predictions: np.array | ||
| 1-D numpy array with predictions for each of the cut datapoints. | ||
|
|
||
| """ | ||
| # Squeeze values since t0_pred is DataFrame with shape n_data * 1 | ||
| return central_predictions(dataset, t0set).to_numpy().squeeze() | ||
|
|
||
| dataset_inputs_t0_predictions = collect("dataset_t0_predictions", ("data",)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.