Skip to content

Commit

Permalink
Merge pull request #726 from lucabaldini/issue_725
Browse files Browse the repository at this point in the history
Tentative fix for issue #725.
  • Loading branch information
lucabaldini committed Mar 8, 2024
2 parents 1bb3184 + 4bef682 commit 8cb8890
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
9 changes: 8 additions & 1 deletion docs/release_notes.rst
Expand Up @@ -4,6 +4,13 @@ Release notes
=============


* Merging in pull request https://github.com/lucabaldini/ixpeobssim/pull/726
* Fix for a critical bug that was preventing from using weights in a model-independent
analysis with the latest iteration of the response files.
* Issue(s) closed:
* https://github.com/lucabaldini/ixpeobssim/issues/725


*ixpeobssim (31.0.0) - Thu, 07 Mar 2024 15:21:06 +0100*

* Merging in pull request https://github.com/lucabaldini/ixpeobssim/pull/723
Expand Down Expand Up @@ -4093,4 +4100,4 @@ strongly advised against using this version. Please update straight to 6.0.0)

*ximpol (0.0.1) - Fri, 04 Dec 2015 06:39:19 -0800*

* Initial setup of the github repository
* Initial setup of the github repository
23 changes: 21 additions & 2 deletions ixpeobssim/irf/caldb.py
Expand Up @@ -48,10 +48,29 @@
# Auxiliary variables for the IRF variants, i.e., simple weighting and gray filter.
VALID_WEIGHT_NAMES = ('alpha075', )
SUPPORTED_SIMPLE_IRF_TYPES = ('arf', 'mrf')
SUPPORTED_SIMPLE_INTENTS = ('obssim_alpha075', )
SUPPORTED_GRAY_IRF_TYPES = ('arf', 'mrf')


def _supports_simple_weighting(intent):
"""Return True if the given intent portion of the irf_name supports simple
weighting.
This used to be a simple tuple ('obssim_alpha075', ), but we have to resort
to a function after
https://github.com/lucabaldini/ixpeobssim/issues/725
due to the fact the, starting with version v13, we ship different sets of
response files in 6-months time bins.
Arguments
---------
intent : str
The given intent.
"""
if intent.endswith('_alpha075'):
return True
return False


def irf_file_name(base, du_id, irf_type, intent, version, simple_weighting=False,
gray_filter=False):
"""Return the file name for a specific response function.
Expand Down Expand Up @@ -98,7 +117,7 @@ def irf_file_name(base, du_id, irf_type, intent, version, simple_weighting=False
if simple_weighting:
if irf_type not in SUPPORTED_SIMPLE_IRF_TYPES:
raise RuntimeError('No simple weighting available for %s files.', irf_type)
if intent not in SUPPORTED_SIMPLE_INTENTS:
if not _supports_simple_weighting(intent):
raise RuntimeError('No simple weighting available for %s intent.', intent)
intent = '%ssimple' % intent
logger.debug('Simple weighting scheme required, intent set to %s...', intent)
Expand Down

0 comments on commit 8cb8890

Please sign in to comment.