Permalink
Browse files

Generate small GPS list

  • Loading branch information...
MJS MJS
MJS authored and MJS committed May 20, 2012
1 parent 194c6a1 commit fd98aa171f22aba6c4387eced0bc3de6f5f925c4
Showing with 29 additions and 12 deletions.
  1. +29 −0 code/_10_small_model_checker_work_in_progress
  2. +0 −12 code/_scratch.py
@@ -0,0 +1,29 @@
+import cPickle
+import shelve
+from _01_graph_enumerator import convert_dict_to_graphs
+from _03_database_functions import decode_gps
+
+split_gps = cPickle.load(file("split_gps_store.pkl"))
+print len(split_gps)
+print split_gps[0] # parsets for this nwkey, total parsets so far, subparsets for this nwkey)
+print split_gps[19682] # parsets for this nwkey, total parsets so far, subparsets for this nwkey)
+
+
+networks = cPickle.load(file("all_networks.db"))
+print "found", len(networks), "networks." # 3^9 = 19683 if unconstrained
+
+shelvefilename = "unique_small_gps_codes.remote_generated.db"
+d = shelve.open(shelvefilename)
+for nwkey in [0, 1, 2, 3, 19681, 19682]:
+ strnwkey = str(nwkey) # because shelve only accepts string keys
+ print strnwkey
+ print networks[nwkey]
+ IG = convert_dict_to_graphs({nwkey:networks[nwkey]})[nwkey]
+ #print IG.edges()
+ print "example item:", list(d[strnwkey])[0]
+ print "converted to gps:", decode_gps(int(list(d[strnwkey])[0]), IG)
+ print "longest code:", max(len(code) for code in d[strnwkey])
+ print "shortest code:", min(len(code) for code in d[strnwkey])
+ print "codes for nwkey:", len(d[strnwkey])
+
+print max([int(key) for key in d.keys()])
View
@@ -1,12 +0,0 @@
-import cPickle
-import shelve
-
-split_gps_store = cPickle.load(file("split_gps_store.pkl"))
-
-test1 = [1, 2, 3]
-test2 = [3, 4]
-
-shelvefilename = "unique_small_gps_codes.db"
-d = shelve.open(shelvefilename)
-print d["0"]
-print d["1"]

0 comments on commit fd98aa1

Please sign in to comment.