Commit 2a41df9074cd3eafc8d5650a1d58410c0e88670a
1 parent
1516d46a
Reorder code to reduce code duplication ;)
Showing
2 changed files
with
11 additions
and
11 deletions
cscripts/cslightcrv.py
| @@ -120,8 +120,8 @@ class cslightcrv(ctools.csobservation): | @@ -120,8 +120,8 @@ class cslightcrv(ctools.csobservation): | ||
| 120 | ctools.csobservation.__setstate__(self, state['base']) | 120 | ctools.csobservation.__setstate__(self, state['base']) |
| 121 | self._srcname = state['srcname'] | 121 | self._srcname = state['srcname'] |
| 122 | self._tbins = state['tbins'] | 122 | self._tbins = state['tbins'] |
| 123 | - self._onoff = state['onoff'] | ||
| 124 | self._stacked = state['stacked'] | 123 | self._stacked = state['stacked'] |
| 124 | + self._onoff = state['onoff'] | ||
| 125 | self._fits = state['fits'] | 125 | self._fits = state['fits'] |
| 126 | self._nthreads = state['nthreads'] | 126 | self._nthreads = state['nthreads'] |
| 127 | self._excl_reg_map = state['excl_reg_map'] | 127 | self._excl_reg_map = state['excl_reg_map'] |
| @@ -145,15 +145,15 @@ class cslightcrv(ctools.csobservation): | @@ -145,15 +145,15 @@ class cslightcrv(ctools.csobservation): | ||
| 145 | if self.obs().models().size() == 0: | 145 | if self.obs().models().size() == 0: |
| 146 | self.obs().models(self['inmodel'].filename()) | 146 | self.obs().models(self['inmodel'].filename()) |
| 147 | 147 | ||
| 148 | - # Get source name | ||
| 149 | - self._srcname = self['srcname'].string() | ||
| 150 | - | ||
| 151 | # Get time boundaries | 148 | # Get time boundaries |
| 152 | self._tbins = self._create_tbounds() | 149 | self._tbins = self._create_tbounds() |
| 153 | 150 | ||
| 154 | # Set On/Off analysis flag and query relevant user parameters | 151 | # Set On/Off analysis flag and query relevant user parameters |
| 155 | self._onoff = self._is_onoff() | 152 | self._onoff = self._is_onoff() |
| 156 | 153 | ||
| 154 | + # Get source name | ||
| 155 | + self._srcname = self['srcname'].string() | ||
| 156 | + | ||
| 157 | # Set stacked analysis flag and query relevant user parameters | 157 | # Set stacked analysis flag and query relevant user parameters |
| 158 | if not self._onoff: | 158 | if not self._onoff: |
| 159 | self._stacked = self._is_stacked() | 159 | self._stacked = self._is_stacked() |
cscripts/csphasecrv.py
| @@ -91,9 +91,9 @@ class csphasecrv(ctools.csobservation): | @@ -91,9 +91,9 @@ class csphasecrv(ctools.csobservation): | ||
| 91 | 'stacked' : self._stacked, | 91 | 'stacked' : self._stacked, |
| 92 | 'onoff' : self._onoff, | 92 | 'onoff' : self._onoff, |
| 93 | 'fits' : self._fits, | 93 | 'fits' : self._fits, |
| 94 | - 'fitmodels' : self._fitmodels, | ||
| 95 | 'nthreads' : self._nthreads, | 94 | 'nthreads' : self._nthreads, |
| 96 | - 'excl_reg_map' : self._excl_reg_map} | 95 | + 'excl_reg_map' : self._excl_reg_map, |
| 96 | + 'fitmodels' : self._fitmodels} | ||
| 97 | 97 | ||
| 98 | # Return pickled dictionary | 98 | # Return pickled dictionary |
| 99 | return state | 99 | return state |
| @@ -110,12 +110,12 @@ class csphasecrv(ctools.csobservation): | @@ -110,12 +110,12 @@ class csphasecrv(ctools.csobservation): | ||
| 110 | ctools.csobservation.__setstate__(self, state['base']) | 110 | ctools.csobservation.__setstate__(self, state['base']) |
| 111 | self._srcname = state['srcname'] | 111 | self._srcname = state['srcname'] |
| 112 | self._phbins = state['phbins'] | 112 | self._phbins = state['phbins'] |
| 113 | - self._onoff = state['onoff'] | ||
| 114 | self._stacked = state['stacked'] | 113 | self._stacked = state['stacked'] |
| 114 | + self._onoff = state['onoff'] | ||
| 115 | self._fits = state['fits'] | 115 | self._fits = state['fits'] |
| 116 | - self._fitmodels = state['fitmodels'] | ||
| 117 | self._nthreads = state['nthreads'] | 116 | self._nthreads = state['nthreads'] |
| 118 | self._excl_reg_map = state['excl_reg_map'] | 117 | self._excl_reg_map = state['excl_reg_map'] |
| 118 | + self._fitmodels = state['fitmodels'] | ||
| 119 | 119 | ||
| 120 | # Return | 120 | # Return |
| 121 | return | 121 | return |
| @@ -136,15 +136,15 @@ class csphasecrv(ctools.csobservation): | @@ -136,15 +136,15 @@ class csphasecrv(ctools.csobservation): | ||
| 136 | if self.obs().models().size() == 0: | 136 | if self.obs().models().size() == 0: |
| 137 | self.obs().models(self['inmodel'].filename()) | 137 | self.obs().models(self['inmodel'].filename()) |
| 138 | 138 | ||
| 139 | - # Get source name | ||
| 140 | - self._srcname = self['srcname'].string() | ||
| 141 | - | ||
| 142 | # Get phase boundaries | 139 | # Get phase boundaries |
| 143 | self._phbins = self._create_tbounds() | 140 | self._phbins = self._create_tbounds() |
| 144 | 141 | ||
| 145 | # Set On/Off analysis flag and query relevant user parameters | 142 | # Set On/Off analysis flag and query relevant user parameters |
| 146 | self._onoff = self._is_onoff() | 143 | self._onoff = self._is_onoff() |
| 147 | 144 | ||
| 145 | + # Get source name | ||
| 146 | + self._srcname = self['srcname'].string() | ||
| 147 | + | ||
| 148 | # If cube analysis is selected | 148 | # If cube analysis is selected |
| 149 | # Set stacked analysis flag and query relevant user parameters | 149 | # Set stacked analysis flag and query relevant user parameters |
| 150 | if not self._onoff: | 150 | if not self._onoff: |