Changeset 2672


Ignore:
Timestamp:
10/18/12 21:06:07 (12 years ago)
Author:
Malte Marquarding
Message:

introduce 'reshape' method; this includes a fix to c++ for the upper boundary assertion

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/ipysupport.py

    r2499 r2672  
    9797        resample        - return a scan with resampled channels
    9898        smooth          - return the spectrally smoothed scan
     99        reshape         - cut out channel range
    99100        poly_baseline   - fit a polynomial baseline to all Beams/IFs/Pols
    100101        auto_poly_baseline - automatically fit a polynomial baseline
  • trunk/python/scantable.py

    r2645 r2672  
    21922192
    21932193    @asaplog_post_dec
     2194    def reshape(self, first, last, insitu=None):
     2195        """Resize the band by providing first and last channel.
     2196        This will cut off all channels outside [first, last].
     2197        """
     2198        if insitu is None:
     2199            insitu = rcParams['insitu']
     2200        varlist = vars()
     2201        if last < 0:
     2202            last = self.nchan()-1 + last
     2203        s = None
     2204        if insitu:
     2205            s = self
     2206        else:
     2207            s = self.copy()
     2208        s._reshape(first,last)
     2209        s._add_history("reshape", varlist)
     2210        if not insitu:
     2211            return s       
     2212
     2213    @asaplog_post_dec
    21942214    def resample(self, width=5, method='cubic', insitu=None):
    21952215        """\
  • trunk/src/Scantable.cpp

    r2666 r2672  
    18351835
    18361836  // if nmax exceeds nChan, reset nmax to nChan
    1837   if ( nmax >= nChan ) {
     1837  if ( nmax >= nChan-1 ) {
    18381838    if ( nmin == 0 ) {
    18391839      // nothing to do
  • trunk/test/test_observatories/test_parkes_mx.py

    r2522 r2672  
    2727        rms = avp.stats("rms")
    2828        mx = avp.stats("max_abc")
    29         print rms
    3029        assert_almost_equals(rms[0], 0.04148, 5)
    3130        assert_almost_equals(mx[0], 86.67328, 5)
  • trunk/test/test_scantable.py

    r2634 r2672  
    222222        assert_almost_equals(res_rms[0], 0.38346, 5)
    223223        assert_almost_equals(res_rms[1], 0.38780, 5)       
     224
     225
     226    def test_reshape(self):
     227        cp = self.st.copy()
     228        n = cp.nchan()
     229        rs = cp.reshape(10,-10,False)
     230        assert_equals(n-20, rs.nchan())
     231        assert_equals(cp.nchan(), n)
     232        rs = cp.reshape(10,n-11,False)
     233        assert_equals(n-20, rs.nchan())
     234        cp.reshape(10,-10,True)
     235        assert_equals(n-20, cp.nchan())
Note: See TracChangeset for help on using the changeset viewer.