-
Notifications
You must be signed in to change notification settings - Fork 7
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
[WIP]: theory shift covmat comparison - updated #314
Closed
Closed
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
6f423bc
continuing from covmat_cuts branch
bae8d6c
changing 2 to dataspecs
03ed276
Fix dataset_names for daataspecs collection
09a06fc
working on production rule for combination
48093eb
applying matched cuts to combined dataspecs
43868f6
replacing shiftconfig and theoryconfig with matched datasets
82ac339
updating produce_combined_shifts function
43bcb72
adding functions for shift theory ratio plot
1594700
fixing shift correlation matrix plot
29ee758
adding functions to compare elements in matrices
63cc439
Merge branch 'master' into covmat_cuts2
Zaharid ce1a572
adding function to produce eigenvalues and eigenvectors of normalised…
41a9bc9
Merge branch 'covmat_cuts2' of github.com:NNPDF/nnpdf into covmat_cuts2
64756e3
working on action to find fmiss
becdd60
correcting definition of projection operator in theory_covmat_eigenve…
c1e157f
fix bug: extracting eigenvectors in the correct way from la.eigh func…
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 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 |
---|---|---|
|
@@ -885,3 +885,93 @@ def plot_matched_datasets_shift_matrix_correlations( | |
index=matched_datasets_shift_matrix.index) | ||
return plot_corrmat_heatmap( | ||
corrmat, "Shift outer product normalized (correlation) matrix") | ||
|
||
all_matched_results = collect('matched_dataspecs_results', | ||
['matched_datasets_from_dataspecs']) | ||
|
||
def combine_by_type2(process_lookup, all_matched_results, dataset_names): | ||
return combine_by_type(process_lookup, all_matched_results, dataset_names) | ||
|
||
datapsecs_theoryids = collect('theoryid', ['dataspecs']) | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dataspecs_theoryids rather than datapsecs_theoryids? |
||
def process_starting_points2(combine_by_type2): | ||
return process_starting_points(combine_by_type2) | ||
|
||
@make_argcheck | ||
def _check_correct_theory_combination_dataspecs(datapsecs_theoryids, | ||
fivetheories): | ||
return _check_correct_theory_combination.__wrapped__( | ||
datapsecs_theoryids, fivetheories) | ||
|
||
#@_check_correct_theory_combination_dataspecs | ||
def covs_pt_prescrip2(combine_by_type2, | ||
process_starting_points2, | ||
datapsecs_theoryids, | ||
fivetheories: (str, type(None)) = None): | ||
return covs_pt_prescrip(combine_by_type2, process_starting_points2, | ||
datapsecs_theoryids, fivetheories) | ||
|
||
def covmap2(combine_by_type2, dataset_names): | ||
return covmap(combine_by_type2, dataset_names) | ||
|
||
matched_dataspecs_experiment_name = collect( | ||
'experiment_name', ['matched_datasets_from_dataspecs']) | ||
matched_dataspecs_dataset_name = collect( | ||
'dataset_name', ['matched_datasets_from_dataspecs']) | ||
matched_cuts_datasets = collect('dataset', ['dataspecs_with_matched_cuts']) | ||
all_matched_datasets = collect('matched_cuts_datasets', | ||
['matched_datasets_from_dataspecs']) | ||
|
||
|
||
def all_matched_data_lengths(all_matched_datasets): | ||
lens = [] | ||
for rlist in all_matched_datasets: | ||
lens.append(rlist[0].load().GetNData()) | ||
return lens | ||
|
||
def matched_experiments_index(matched_dataspecs_experiment_name, | ||
matched_dataspecs_dataset_name, | ||
all_matched_data_lengths): | ||
|
||
enames = matched_dataspecs_experiment_name | ||
dsnames = matched_dataspecs_dataset_name | ||
lens = all_matched_data_lengths | ||
#build index | ||
expnames = np.concatenate([ | ||
np.full(l, ename, dtype=object) | ||
for (l, ename) in zip(lens, enames) | ||
]) | ||
dsnames = np.concatenate([ | ||
np.full(l, dsname, dtype=object) | ||
for (l, dsname) in zip(lens, dsnames) | ||
]) | ||
point_indexes = np.concatenate([ | ||
np.arange(l) | ||
for l in lens | ||
]) | ||
|
||
index = pd.MultiIndex.from_arrays( | ||
[expnames, dsnames, point_indexes], | ||
names=["Experiment name", "Dataset name", "Point"]) | ||
return index | ||
|
||
@table | ||
def theory_covmat_custom2(covs_pt_prescrip2, covmap2, | ||
matched_experiments_index): | ||
return theory_covmat_custom(covs_pt_prescrip2, covmap2, | ||
matched_experiments_index) | ||
|
||
@table | ||
def theory_corrmat_custom2(theory_covmat_custom2): | ||
"""Calculates the theory correlation matrix for scale variations | ||
with variations by process type""" | ||
mat = theory_corrmat(theory_covmat_custom2) | ||
return mat | ||
|
||
@figure | ||
def plot_thcorrmat_heatmap_custom2(theory_corrmat_custom2, theoryids): | ||
"""Matrix plot of the theory correlation matrix, correlations by process type""" | ||
l = len(theoryids) | ||
fig = plot_corrmat_heatmap(theory_corrmat_custom2, | ||
f"Theory correlation matrix for {l} points") | ||
return fig |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have the time could you please add descriptions to the functions? In particular, could you explain what the difference is between <function_name> and <function_name>2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These things shouldn't be called
_2
in the first places. Should be_dataspecs
or something similar.