Пример #1
0
def create_list_fpaths(self):
    self.list_fpaths = []
    self.extensions = ['*.jpg', '*.jpeg']
    self.extensions.extend([ext.upper() for ext in self.extensions])

    dpath = apath(os.path.dirname(__file__))
    for ext in self.extensions:
        for fpath in glob.glob(pjoin(dpath, 'stegoappdb', 'covers', ext)):
            self.list_fpaths.append(apath(fpath))

        for fpath in glob.glob(pjoin(dpath, 'stegoappdb', 'stegos', ext)):
            self.list_fpaths.append(apath(fpath))
Пример #2
0
 def test_adv_summary(self):
     fpath = apath(
         pjoin(dname(__file__), 'resources', 'tripod', 'north', 'adv',
               'MCR13N1T05adv1s-cal.nc'))
     shutil.copy2(fpath, self.tmpf)
     for of in adv.enhance_summary(self.tmpf):
         logger.info('Wrote output: {}'.format(of))
Пример #3
0
 def test_adcp_wvs(self):
     fpath = apath(
         pjoin(dname(__file__), 'resources', 'tripod', 'north', 'adcp',
               'MCR13N1T_wvs.nc'))
     shutil.copy2(fpath, self.tmpf)
     for of in adcp.enhance_wvs(self.tmpf):
         logger.info('Wrote output: {}'.format(of))
Пример #4
0
def create_list_fpaths(self):
    self.list_fpaths = []
    self.extensions = ['*.jpg', '*.jpeg']

    dpath = os.path.dirname(__file__)
    for ext in self.extensions:
        for fpath in glob.glob(pjoin(dpath, 'images', ext)):
            self.list_fpaths.append(apath(fpath))
Пример #5
0
 def test_adv_summary(self):
     fpath = apath(pjoin(
         dname(__file__),
         'resources',
         'tripod',
         'north',
         'adv',
         'MCR13N1T05adv1s-cal.nc'
     ))
     shutil.copy2(fpath, self.tmpf)
     for of in adv.enhance_summary(self.tmpf):
         logger.info('Wrote output: {}'.format(of))
Пример #6
0
 def test_adcp_wvs(self):
     fpath = apath(pjoin(
         dname(__file__),
         'resources',
         'tripod',
         'north',
         'adcp',
         'MCR13N1T_wvs.nc'
     ))
     shutil.copy2(fpath, self.tmpf)
     for of in adcp.enhance_wvs(self.tmpf):
         logger.info('Wrote output: {}'.format(of))
Пример #7
0
    def test_compare_count_nnz_ac(self):
        """=> Test counting non-zero DCT AC coefficients.
        """
        for fpath in self.list_fpaths:
            fname = os.path.basename(fpath)
            dpath_mat = apath(
                pjoin(os.path.dirname(fpath), os.path.pardir,
                      'matlab_outputs'))
            fpath_mat = pjoin(dpath_mat, 'nnz_' + fname + '.mat')
            if not os.path.isfile(fpath_mat):
                continue

            mat = spio.loadmat(fpath_mat)
            nnz_ac_mat = mat['nnz_ac'][0]

            jpeg = jpegio.read(fpath)
            nnz_ac_jpegio = jpeg.count_nnz_ac()

            self.assertTrue(nnz_ac_mat == nnz_ac_jpegio)
Пример #8
0
    def test_compare_dct_coef(self):
        """=> Test reading DCT coefficients.
        """
        for fpath in self.list_fpaths:
            fname = os.path.basename(fpath)
            dpath_mat = apath(
                pjoin(os.path.dirname(fpath), os.path.pardir,
                      'matlab_outputs'))
            fpath_mat = pjoin(dpath_mat, 'coef_arrays' + fname + '.mat')
            if not os.path.isfile(fpath_mat):
                continue

            mat = spio.loadmat(fpath_mat)
            coef_arrays_mat = mat['coef_arrays'][0]
            jpeg = jpegio.read(fpath)
            for i in range(len(jpeg.coef_arrays)):
                self.assertEqual(coef_arrays_mat[i].dtype,
                                 jpeg.coef_arrays[i].dtype)
                res = np.array_equal(jpeg.coef_arrays[i], coef_arrays_mat[i])
                self.assertTrue(res)