-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathview_ash_types.py
More file actions
72 lines (72 loc) · 1.9 KB
/
Copy pathview_ash_types.py
File metadata and controls
72 lines (72 loc) · 1.9 KB
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
#
# View Ash Types
#
# Peter Turney, August 21, 2020
#
# Uses a modified form of Adam P Goucher's Ash Pattern
# Generator (Apgsearch) to compare the demographics of
# different populations of organisms that have formed
# in a model of the evolution of symbiosis (Model-S).
#
# Load a seed from a pickle generated by Model-S and
# use routines borrowed from "apgsearch-2015-05-25.py" to
# run the seed and analyze the resulting soup.
#
import golly as g
import model_classes as mclass
import model_functions as mfunc
import model_parameters as mparam
import apgsearch_repurposed as apg
import pickle
import time
import hashlib
import datetime
#
# Ask the user to select a pickle.
#
g.note("You will be asked to select a pickled seed file.\n" + \
"The top seed in the file will be inserted into Golly.\n" + \
"Ash Pattern Generator (apgsearch) will run Golly and\n" + \
"present a summary of the ash that it finds.")
#
pickle_path = g.opendialog("Select a pickled seed file (*.bin)", \
"(*.bin)|*.bin", g.getdir("app"))
#
# Read the pickle file.
#
pickle_handle = open(pickle_path, "rb") # rb = read binary
pickle = pickle.load(pickle_handle)
pickle_handle.close()
#
# Select the top seed from the pickle file.
#
seed = pickle[0]
#
# Specify rule and symmetry.
#
rulestring = "B3/S23"
symmstring = "C1" # C1 means the soup is asymmetric
numsoups = 1 # soup count
#
# Create associated rule tables.
#
soup = apg.Soup()
soup.rg.setrule(rulestring)
soup.rg.saveAllRules()
#
# Make an ID for the soup.
#
soupid = datetime.datetime.now().isoformat()
#
# Make a soup from a seed.
#
soup.stabilise_seed(seed)
#
# Write census as tab-separated value (.tsv) file.
#
spreadsheet_path = "C:/Users/peter/Peter's Projects" + \
"/autopoiesis/Paper Sections/Part 2 - Diversity/test.tsv"
#
soup.spreadsheet_census(spreadsheet_path, numsoups, soupid, symmstring)
#
#