-
Notifications
You must be signed in to change notification settings - Fork 84
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
Pisa weight fitter #237
Merged
RasmusOrsoe
merged 5 commits into
graphnet-team:main
from
RasmusOrsoe:pisa_weight_fitter
Aug 8, 2022
Merged
Pisa weight fitter #237
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7585964
added weight template
RasmusOrsoe 3bf42ef
committtttt
RasmusOrsoe 9ea0c69
Update src/graphnet/pisa/fitting.py
RasmusOrsoe 67699ce
added docstring
RasmusOrsoe 54833ba
Merge branch 'pisa_weight_fitter' of https://github.com/RasmusOrsoe/g…
RasmusOrsoe 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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from graphnet.pisa.fitting import WeightFitter | ||
|
||
outdir = "/mnt/scratch/rasmus_orsoe/weight_test" | ||
database_path = "/mnt/scratch/rasmus_orsoe/databases/dev_lvl3_genie_burnsample_v5/data/dev_lvl3_genie_burnsample_v5.db" | ||
fitter = WeightFitter(database_path=database_path) | ||
|
||
pisa_config_dict = { | ||
"reco_energy": {"num_bins": 8}, | ||
"reco_coszen": {"num_bins": 8}, | ||
"pid": {"bin_edges": [0, 0.5, 1]}, | ||
"true_energy": {"num_bins": 200}, | ||
"true_coszen": {"num_bins": 200}, | ||
"livetime": 10 | ||
* 0.01, # set to 1% of 10 years - correspond to the size of the oscNext burn sample | ||
} | ||
# by calling fitter.fit_weights we get the weights returned pr. event. if add_to_database = True, a table will be added to the database | ||
weights = fitter.fit_weights( | ||
outdir, | ||
add_to_database=True, | ||
weight_name="weight_livetime10_1percent", | ||
pisa_config_dict=pisa_config_dict, | ||
) | ||
|
||
print(weights) |
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
101 changes: 101 additions & 0 deletions
101
src/graphnet/pisa/resources/configuration_templates/pipeline_config_weight_template.cfg
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#include settings/osc/nufitv20.cfg as osc | ||
#include settings/osc/earth.cfg as earth | ||
[pipeline] | ||
order = data.sqlite_loader, flux.honda_ip, flux.barr_simple, osc.prob3, aeff.aeff | ||
param_selections = nh | ||
name = neutrinos | ||
output_binning = graphnet_dynamic_binning | ||
output_key = weights, errors | ||
|
||
[data.sqlite_loader] | ||
calc_mode = events | ||
apply_mode = events | ||
output_names = nue_cc, numu_cc, nutau_cc, nue_nc, numu_nc, nutau_nc, nuebar_cc, numubar_cc, nutaubar_cc, nuebar_nc, numubar_nc, nutaubar_nc | ||
post_fix = _pred | ||
database = /mnt/scratch/rasmus_orsoe/databases/oscillations/dev_lvl7_robustness_muon_neutrino_0000/pipelines/pipeline_oscillation_final/pipeline_oscillation_final.db | ||
|
||
[flux.honda_ip] | ||
calc_mode = true_allsky_fine | ||
apply_mode = events | ||
param.flux_table = flux/honda-2015-spl-solmin-aa.d | ||
|
||
[flux.barr_simple] | ||
calc_mode = true_allsky_fine | ||
apply_mode = events | ||
param.nu_nubar_ratio = 1.0 +/- 0.1 | ||
param.nu_nubar_ratio.fixed = True | ||
param.nu_nubar_ratio.range = nominal + [-3., +3.] * sigma | ||
param.nue_numu_ratio = 1.0 +/- 0.05 | ||
param.nue_numu_ratio.fixed = False | ||
param.nue_numu_ratio.range = nominal + [-0.5, +0.5] | ||
param.Barr_uphor_ratio = 0.0 +/- 1.0 | ||
param.Barr_uphor_ratio.fixed = False | ||
param.Barr_uphor_ratio.range = nominal + [-3.0, +3.0] | ||
param.Barr_nu_nubar_ratio = 0.0 +/- 1.0 | ||
param.Barr_nu_nubar_ratio.fixed = False | ||
param.Barr_nu_nubar_ratio.range = nominal + [-3.0, +3.0] | ||
param.delta_index = 0.0 +/- 0.1 | ||
param.delta_index.fixed = False | ||
param.delta_index.range = nominal + [-5, +5] * sigma | ||
|
||
[osc.prob3] | ||
calc_mode = true_allsky_fine | ||
apply_mode = events | ||
param.earth_model = osc/PREM_12layer.dat | ||
param.YeI = ${earth:YeI} | ||
param.YeM = ${earth:YeM} | ||
param.YeO = ${earth:YeO} | ||
param.detector_depth = ${earth:detector_depth} | ||
param.prop_height = ${earth:prop_height} | ||
param.theta12 = ${osc:theta12} | ||
param.theta12.fixed = True | ||
param.nh.theta13 = ${osc:theta13_nh} | ||
param.nh.theta13.fixed = False | ||
param.nh.theta13.range = ${osc:theta13_nh.range} | ||
param.ih.theta13 = ${osc:theta13_ih} | ||
param.ih.theta13.fixed = False | ||
param.ih.theta13.range = ${osc:theta13_ih.range} | ||
param.nh.theta23 = ${osc:theta23_nh} | ||
param.nh.theta23.fixed = False | ||
param.nh.theta23.range = ${osc:theta23_nh.range} | ||
param.nh.theta23.prior = uniform | ||
param.ih.theta23 = ${osc:theta23_ih} | ||
param.ih.theta23.fixed = False | ||
param.ih.theta23.range = ${osc:theta23_ih.range} | ||
param.ih.theta23.prior = uniform | ||
param.nh.deltacp = 0.0 * units.degree | ||
param.nh.deltacp.fixed = True | ||
param.nh.deltacp.range = ${osc:deltacp_nh.range} | ||
param.nh.deltacp.prior = uniform | ||
param.ih.deltacp = 0.0 * units.degree | ||
param.ih.deltacp.fixed = True | ||
param.deltam21 = ${osc:deltam21} | ||
param.deltam21.fixed = True | ||
param.nh.deltam31 = ${osc:deltam31_nh} | ||
param.nh.deltam31.fixed = False | ||
param.nh.deltam31.prior = uniform | ||
param.nh.deltam31.range = [0.001, +0.007] * units.eV**2 | ||
param.ih.deltam31 = ${osc:deltam31_ih} | ||
param.ih.deltam31.fixed = False | ||
param.ih.deltam31.prior = uniform | ||
param.ih.deltam31.range = [-0.007, -0.001] * units.eV**2 | ||
|
||
[aeff.aeff] | ||
calc_mode = events | ||
apply_mode = events | ||
param.livetime = 10 * units.common_year | ||
param.aeff_scale = 1.0 | ||
param.aeff_scale.fixed = False | ||
param.aeff_scale.prior = uniform | ||
param.aeff_scale.range = [0.,3.] * units.dimensionless | ||
param.nutau_cc_norm = 1.0 | ||
param.nutau_cc_norm.fixed = True | ||
param.nutau_cc_norm.range = [0.2, 2.0] * units.dimensionless | ||
param.nutau_cc_norm.prior = uniform | ||
param.nutau_norm = 1.0 | ||
param.nutau_norm.fixed = False | ||
param.nutau_norm.range = [-1.0, 8.5] * units.dimensionless | ||
param.nutau_norm.prior = uniform | ||
param.nu_nc_norm = 1.0 +/- 0.2 | ||
param.nu_nc_norm.fixed = False | ||
param.nu_nc_norm.range = nominal + [-.5,+.5] |
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.
A docstring here, or in
fit_weights
, would be helpful to explain which weights are being fitted, exactly.