Commit 8edbbf87876a405346fac56ca45087ef7889d727
1 parent
d8471eb4
fixed logic of exclusion map handling
Showing
1 changed file
with
24 additions
and
8 deletions
cscripts/obsutils.py
| @@ -825,18 +825,34 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | @@ -825,18 +825,34 @@ def get_onoff_obs(cls, obs, nthreads=0, ra = None, dec = None, srcname = ''): | ||
| 825 | phagen['debug'] = cls['debug'].boolean() | 825 | phagen['debug'] = cls['debug'].boolean() |
| 826 | phagen['nthreads'] = nthreads | 826 | phagen['nthreads'] = nthreads |
| 827 | 827 | ||
| 828 | - # Pipe exclusion map in memory | 828 | + # Set exclusion map |
| 829 | + # Initialise exclusion map flag to False | ||
| 830 | + use_excl_map = False | ||
| 831 | + # Initialise inexclusion par flag to False | ||
| 832 | + use_inexclusion = False | ||
| 833 | + # Do we have valid exclusion map in memory? | ||
| 829 | if hasattr(cls, 'exclusion_map'): | 834 | if hasattr(cls, 'exclusion_map'): |
| 830 | exclusion_map = cls.exclusion_map() | 835 | exclusion_map = cls.exclusion_map() |
| 831 | if exclusion_map is not None: | 836 | if exclusion_map is not None: |
| 837 | + # Set use exclusion map flag to True | ||
| 838 | + use_excl_map = True | ||
| 839 | + # Set exclusion map | ||
| 832 | phagen.exclusion_map(exclusion_map) | 840 | phagen.exclusion_map(exclusion_map) |
| 833 | - # Otherwise try to read it as user parameter | ||
| 834 | - elif cls.has_par('inexclusion'): | ||
| 835 | - if cls['inexclusion'].is_valid(): | ||
| 836 | - inexclusion = cls['inexclusion'].value() | ||
| 837 | - phagen['inexclusion'] = inexclusion | ||
| 838 | - # Otherwise set to None | ||
| 839 | - else: | 841 | + # If we do not have valid exclusion map in memory ... |
| 842 | + if not use_excl_map: | ||
| 843 | + # ... do we have an inxeclusion parameter? | ||
| 844 | + if cls.has_par('inexclusion'): | ||
| 845 | + # If the inexclusion parameter is valid | ||
| 846 | + if cls['inexclusion'].is_valid(): | ||
| 847 | + # Set use inexclusion flag to True | ||
| 848 | + use_inexclusion = True | ||
| 849 | + # Set inexclusion parameter | ||
| 850 | + inexclusion = cls['inexclusion'].value() | ||
| 851 | + phagen['inexclusion'] = inexclusion | ||
| 852 | + # If there is no valid exclusion map in memory | ||
| 853 | + # nor valid inexclusion parameter | ||
| 854 | + if not use_excl_map and not use_inexclusion: | ||
| 855 | + # Set inexclusion for csphagen to None | ||
| 840 | phagen['inexclusion'] = 'NONE' | 856 | phagen['inexclusion'] = 'NONE' |
| 841 | 857 | ||
| 842 | # Run csphagen | 858 | # Run csphagen |