def test_filter_by_shape(self): rmin = 50 rmax = 1000 cmin = 200 cmax = 5000 matrices = p.search(rowbounds = (rmin, rmax), colbounds=(cmin, cmax)) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertTrue(matrix.rows >= rmin and matrix.rows <= rmax and matrix.cols >= cmin and matrix.cols <= cmax)
def test_filter_by_shape(self): rmin = 50 rmax = 1000 cmin = 200 cmax = 5000 matrices = p.search(rowbounds=(rmin, rmax), colbounds=(cmin, cmax)) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertTrue(matrix.rows >= rmin and matrix.rows <= rmax and matrix.cols >= cmin and matrix.cols <= cmax)
def get_all_by_shape(rmin=50, rmax=1000, cmin=200, cmax=5000): matrices = uf.search(rowbounds=(rmin, rmax), colbounds=(cmin, cmax)) print "Found {} matrices within the range ({}-{}) rows and ({}-{}) cols".format( len(matrices), rmin, rmax, cmin, cmax) for matrix in matrices: matrix.download(destpath='./matrices', extract=True) directory = './matrices/{}'.format(matrix.name) filename = '{}.mtx'.format(matrix.name) shutil.move(directory + '/' + filename, directory + '.mtx') shutil.rmtree(directory)
def test_search_by_id(self): m = p.search(42) self.assertEqual(len(m), 1) self.assertEqual(m[0].id, 42)
def test_filter_by_spd_false(self): matrices = p.search(isspd=False) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertFalse(matrix.isspd)
def test_filter_by_rows(self): matrices = p.search(rowbounds=(None, 1000)) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertTrue(matrix.rows <= 1000)
def test_search_by_name(self): matrices = p.search("c-") self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertTrue(matrix.name.startswith("c-"))
def test_search_by_group(self): matrices = p.search("HB/*") for matrix in matrices: self.assertEqual(matrix.group, "HB")
def test_filter_by_spd_false(self): matrices = p.search(isspd = False) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertFalse(matrix.isspd)
def test_filter_by_rows(self): matrices = p.search(rowbounds = (None, 1000)) self.assertTrue(len(matrices) > 0) for matrix in matrices: self.assertTrue(matrix.rows <= 1000)