data_about_players: By default, players_all now covers players mentioned in the paper...
[gostyle.git] / make_input_vector.py
blobd77a5ba56a0916eb93d3f2f98d5cb96d27282825
1 #!/usr/bin/python
2 """
3 This script generates input vectors using the InputGenerator loaded from a file `pickle_filename'.
4 This InputGenerator file is created e.g. by ./make_train_set.py
6 It then generates input vectors for each pat file specified as the script parameter.
8 Usage:
9 ./make_input_vector.py karel.pat john.pat
10 """
11 import sys
12 from gostyle import print_vector, load_object_from_file, InputVectorGenerator, Compose, PCA
14 if __name__ == '__main__':
15 # Name of filename with saved input generator (see make_train_set.py)
16 pickle_filename = 'input_gen.pickle'
17 # Loads the generator
18 input_generator = load_object_from_file(pickle_filename)
20 # For pat_file in argv
21 for pat_file in sys.argv[1:]:
22 try:
23 # Generate players input vector
24 input_vector = input_generator(pat_file)
25 # print it
26 print_vector(input_vector)
27 except IOError:
28 print >>sys.stderr, "Pat file %s missing. Skipping."%(pat_file)