-
Notifications
You must be signed in to change notification settings - Fork 7
Implementation of diffuse flux in the background #449
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
Open
sathanas31
wants to merge
17
commits into
master
Choose a base branch
from
diffuse_flux_bkg
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+879
−566
Conversation
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
2. remove kwargs from class init, instead takes a dict where name, smoothing order, and gamma precision should be in. NO default vals! The latter 2 can be of str type. 3. bkg_weights class method returns NotImplementedError instead of array of 1s 4. remove obsolete environment smoothing & precision keys 5. remove redundant if clauses pertaining to making smoothing order an int & environment key in make_2d_spline_from_hist method 6. type annotate smoothing order to int where needed 7. remove kwargs from methods, use the class params instead 8. change the plot paths in make_individual_spline_set method to include a suffix with the subclass name if not "no_difffuse". The sig, SoB hist & splines plots will now be under the <gamma>/precision<float>_smoothing<int> dir 9. change the SoB_spline_path func args to include the sob dict as kwargs in make_splines & load_spline methods 10. BugFix: use per-flavour fluxes for SPL & BPL subclasses 11. BugFix: make the diffuse + atm weights an np.array 12. BPL subclass get_diffuse_flux method returns fluxes and respective masks for the 2 energy ranges. That accommodates the subclass bkg_weights method to comply with returning a single weights array _Note to self: commit more oft!_
…fffuse" (ie atm-only). Adds extra arg in the smoothing_precision_string, llh_energy_hash_pickles, and bkg_spline_path func
…ulate_background(), but takes a bkg_weights func as an arg, so that the diffuse + atm weights are calculated for given MC
…ntedError (only for NT!!) 2. add SoB arg in make_background_spatial(). The SoB_splines.mmake_background_spline() is then called 3. change imports
…nt for the BackgroundSpatialPDF, particularly for the ZenithSpline where SoB_splines class is needed for the create_background_function method. For UniformSolidAngle bkg spatial pdf the SoB = None
1. when initializing, make sob dict with default vals for bkg_model_name, smoothing_order, and gamma_precision and instantiate SoB_splines. 2. pass the SoB class when creating the spatial_pdf if the "bkg_spatial_pdf" DOES NOT exist in the injection_spatial_pdf dict (BackgroundSpatialPDF defaults to ZenithSpline), otherwise is None NOTE: not optimal and subject to change, since it depends on BackgroundSpatialPDF.create method!!! 3. when creating the dataset, call season.simulate_bkg_with_diffuse() w/ Sob_splines.bkg_weights as its Callable arg if sob_name isn't "no_difffuse", otherwise use the regular simulate_background()
…'t "no_difffuse", have a try except clause to catch cases when datasets other than NT are used. If that's the case a NotImplementedError is raised and simulate_background() is used instead. Note: currently simulate_bkg_with_diffuse() is only implemented for NTSeason but can be extended to all datasets w/ MC
1. when initializing LLH a) make sob dict with default vals for smoothing, precision, and SoB name. If sob dict isn't passed in the llh dict, then it's created with smoothing and precision vals taken from the llh dict for backwards compatibility. Create SoB spline and pass its smoothing_order and gamma_precision properties to the respective LLH ones. b) when creating the SpatialPDF, pass SoB instance if bkg spatial is not specified in the llh spatial dict, otherwise pass None. !!Hacky method, dependent on the hardcoded default "zenith spline" for the bkg spatial. Prone to error if that changes!!!! 2. BUGFIX: update return val in SpatialLLH create_energy_function. Calls self.spatial_pdf.background_spatial instead of obsolete property 3. changes in FixedEnergyLLH: a) delete redundant smoothing order and precision properties assignment when initializing b) update llh_energy_hash_pickles() c) replace old methods to SoB class methods where needed d) BUGFIX: dump proper sinDEC bins from season when making SoB pickle in create_energy_weighting_function() 4. changes in StandardLLH a) replace old methods to SoB class methods where needed b) update SoB_spline_path() 5. BUGFIX: in generate_dynamic_flare_class() raise NotImplementedError if mh_name is either "spatial", or "fixed_energy" since there is no SoB energy cache in these 2
…he llh & inj dicts are different
…gamma trials with different gamma in the llh dict than the one in inj dict
…r when LowMemoryInjector is used and the make_band_mask needs to be called. Fixes cases when you submit jobs on the cluster that don't include inj dict
… seasons. Substitute load_background_model() with use_data_for_trials() so the exp data are correctly loaded when initializing. Bypass the season's simulate_background() in create_dataset() by basically copying the Season.simulate_background() method before applying the angular_error_modifier (bad practice but can't think of sth better)
…lass (no_difffuse, flarestack smoothing order and precision) to call make_individual_spline_set method
…useSpline; return correct types for masks in its get_diffuse_flux method
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Up until now, the background model assumes only conventional atmospheric events. This implementation is constructed so that it allows the option of including an extra diffuse flux component in the background model, where the diffuse flux can follow a single or broken power-law model with user-defined parameters.
Major changes:
make_SoB_splinesmodule by introducing theSoB_splinesbase class, with subclasses including "no_difffuse", "spl_difffuse", and "bpl_difffuse". All the methods for creating the background spatial and SoB splines are now methods of this class. When diffuse is included in the background, the background spatial and energy pdfs are constructed by weighting the histograms with the atmospheric + diffuse event weights, with the latter being derived in the respective class from the input (per-flavour) flux model.BackgroundSpatialPDFis created with an optional SoB arg, which is necessary for theZenithSpline, thus reflected when creatingSpatialPDF.SoB_splinestakes a dictionary with user-defined background model parameters: "bkg_model_name" for the subclass name, "phi0" for the (per-flavour) norm, "spl_gamma", "gamma1", "gamma2", and "logEbreak" (see the respective classes for default values). Thissob_dictis passed in theinj_dictandllh_dictas the "sob_dict" key. If not explicitly passed, then it is created when initializing the injector and llh defaulting to "no_difffuse". Thesob_dictmust also have "smoothing_order" and "gamma_precision" keys to create the SoB splines, which they both default to "flarestack" if not explicitly set by the user.create_datasetto add diffuse flux component in the pseudo-dataset if "bkg_model_name" != "no_difffuse" & season == NTSeason.BUGFIXES:
MockUnblindedInjectorshould return scrambled data for all seasons.Submitterfor when you submit jobs on the cluster that don't include inj_dict.