1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 from lib import lib, PyFile_AsFile
20
22 """Export accumulated wisdom to file given by the filename"""
23 fp = open(filename, 'a')
24 c_fp = PyFile_AsFile(fp)
25 lib.fftwf_export_wisdom_to_file(c_fp)
26 fp.close()
27
29 """Returns a string with the accumulated wisdom"""
30 return lib.fftwf_export_wisdom_to_string()
31
33 """Imports wisdom from the file given by the filename"""
34 fp = open(filename,'r')
35 c_fp = PyFile_AsFile(fp)
36 if lib.fftwf_import_wisdom_from_file(c_fp):
37 pass
38 else:
39 raise IOError, "Could not read wisdom from file %s" % filename
40
42 """Import wisdom from the given string"""
43 if lib.fftwf_import_wisdom_from_string(wisdom):
44 pass
45 else:
46 raise Exception, "Could not read wisdom from string: %s" % wisdom
47
49 """Import the system wisdom, this lives under /etc/fftw/wisdom on
50 Unix/Linux systems"""
51 if lib.fftwf_import_system_wisdom():
52 pass
53 else:
54 raise IOError, "Could not read system wisdom. On GNU/Linux and Unix "\
55 "system wisdom is located in /etc/fftw/wisdom"
56
58 """Clear all wisdom"""
59 lib.fftwf_forget_wisdom()
60