Exemplo n.º 1
0
 def test_bcmad_uint16(self):
     stat = hdstats.bcmad_pcm(self.data, self.gm)
     intdata = (self.data * 10000).astype(np.uint16)
     intdata[1,1,0,:] = 0
     intstat = hdstats.bcmad_pcm(intdata, self.gm, nodata=0)
     npt.assert_approx_equal(np.nanmean(stat),
                             np.nanmean(intstat),
                             significant=4)
Exemplo n.º 2
0
 def gm_tmad(arr, **kw):
     """
     arr: a high dimensional numpy array where the last dimension will be reduced. 
 
     returns: a numpy array with one less dimension than input.
     """
     gm = hdstats.nangeomedian_pcm(arr, **kw)
     nt = kw.pop('num_threads', None)
     emad = hdstats.emad_pcm(arr, gm, num_threads=nt)[:,:, np.newaxis]
     smad = hdstats.smad_pcm(arr, gm, num_threads=nt)[:,:, np.newaxis]
     bcmad = hdstats.bcmad_pcm(arr, gm, num_threads=nt)[:,:, np.newaxis]
     return np.concatenate([gm, emad, smad, bcmad], axis=-1)