-
Notifications
You must be signed in to change notification settings - Fork 2
/
PyFauxFur.py
executable file
·89 lines (71 loc) · 2.77 KB
/
PyFauxFur.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env python
# encoding: utf-8
"""
PyFauxFur.py
Created by Olivier Le Floch on 2009-03-17.
Program written by Thomas Deniau and Olivier Le Floch.
Copyright (c) 2009. All rights reserved.
"""
import sys
from optparse import OptionParser
program = 'PyFauxFur'
version = 'Version 0.1, written by Thomas Deniau and Olivier Le Floch (c) 2009'
def main(argv=None):
if argv is None:
argv = sys.argv
parser = OptionParser()
parser.add_option(
'-V', '--version', dest='version', default=False,
action="store_true",
help="show version information and exit")
parser.add_option(
'-r', '--autorun', dest='autorun', default=False, action='store_true',
help='automatically launch morphogenesis')
parser.add_option(
'-i', '--iterations', dest='iterations', type='int', default=1000,
help='when running automatically, stop after this many iterations',
metavar='ITERATIONS')
parser.add_option(
'-p', '--dump_path', dest='dumpAtEndPath', type="string", default=None,
help='when running automatically, if not empty, save the final image and quit',
metavar='PATH')
parser.add_option(
'-s', dest='D_s', type="float", default=0.0005,
help="reaction rate parameter [default: %default]", metavar='RATE')
parser.add_option(
'-a', dest='D_a', type="float", default=0.25,
help="diffusion rate parameter for a [default: %default]", metavar='RATE')
parser.add_option(
'-b', dest='D_b', type="float", default=0.0625,
help="diffusion rate parameter for b [default: %default]", metavar='RATE')
parser.add_option(
'-d', dest='beta_i', type="float", default=12,
help="decay rate for b [default: %default]", metavar='DECAY')
parser.add_option(
'-x', '--width', dest='width', type="int", default=400,
help="width of the generated texture [default: %default]", metavar='WIDTH')
parser.add_option(
'-y', '--height', dest='height', type="int", default=400,
help="height of the generated texture [default: %default]", metavar='HEIGHT')
parser.add_option(
'-g', '--generator', dest='generator', type='string', default='random',
help='generator to use for the initial conditions [default: %default] (other possible values: stripe)',
metavar='NAME')
(options, args) = parser.parse_args()
if options.version:
print program + ', ' + version
quit()
from PyQt4 import QtGui
from MainWindow import MainWindow
from Controller import Controller
app = QtGui.QApplication(args)
window = MainWindow()
controller = Controller(window)
controller.awake()
controller.setOptions(options)
window.show()
if options.autorun:
controller.run(maxIterations=options.iterations, dumpAtEndPath=options.dumpAtEndPath)
app.exec_()
if __name__ == "__main__":
sys.exit(main())