-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.py
More file actions
50 lines (33 loc) · 931 Bytes
/
examples.py
File metadata and controls
50 lines (33 loc) · 931 Bytes
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
"""
examples.py
Opened: May 2018
Author: Rafael Frongillo
Some examples showing how to use the Sofic Processor
"""
from sofic_processor import SoficProcessor
import pickle
import numpy
print "EXAMPLE 1: the even shift"
matrix = numpy.matrix( [[1, 0, 1],
[0,-1, 1],
[1,-1, 1]] )
labels = { 0 : [0,1], 1 : [2] }
sof = SoficProcessor(matrix, labels, debug=True)
sof.process()
sof.debug=False
print sof
print "Entropy of the even shift:", sof.entropy()
print "Now minimizing..."
sof.minimize()
print sof
print "EXAMPLE 2: Henon map"
matrix = pickle.load(open('henon-4555-M.pkl','rb'))
labels = pickle.load(open('henon-4555-G.pkl','rb'))
sof = SoficProcessor(matrix, labels, debug=False)
sof.process()
print 'finished processing:', sof
#print 'entropy:', sof.entropy()
sof.take_periodic_closure()
print 'periodic closure:', sof
sof.minimize()
print "minimized:", sof