Commits

Phillip Alday committed 4f4bceb

Fixed a bug with argparse in interactive mode; added signdist to verbose and interactive output.

Comments (0)

Files changed (1)

alday_ms_ibs_neuroinformatics.py

 arguments = ARGS.parse_args()
 NOUN_TABLE_FILE = arguments.nouns
 VERB_TABLE_FILE = arguments.verbs
-STIMULI_FILE = arguments.experiment[0]
-if len(arguments.experiment) == 2:
-    STIMULI_OUTPUT_FILE = arguments.experiment[1]
-elif len(arguments.experiment) > 2:
-    sys.stderr.write('Too many file arguments for batch mode.\n')
-    exit(2)
+if arguments.experiment:
+    STIMULI_FILE = arguments.experiment[0]
+
+    if len(arguments.experiment) == 2:
+        STIMULI_OUTPUT_FILE = arguments.experiment[1]
+    elif len(arguments.experiment) > 2:
+        sys.stderr.write('Too many file arguments for batch mode.\n')
+        exit(2)
+    else:
+        STIMULI_OUTPUT_FILE = None
 else:
-    STIMULI_OUTPUT_FILE = None     
+    STIMULI_FILE = None 
+    
 STAGE2_TESTDIR = arguments.stage2test
 EUCLIDEAN_METRIC = bool(arguments.euclidean)
 MAGNITUDE_DIFFERENCE = bool(arguments.magnitude)
             if STAGE2_VERBOSE:
                 print()
                 print("Distinctness measures:")
-                print("\tUndistorted distance between vectors: ",
+                print("\tUndistorted distance between vectors (dist): ",
                     distance(pvectors["np2"], pvectors["np1"]) )
-                print("\tWeighted scalar difference (NP2-NP1): ",
+                print("\tSigned distance between vectors (signdist): ",
+                    signdistance(pvectors["np2"], pvectors["np1"]) )
+                print("\tWeighted scalar difference (NP2-NP1) (sdiff): ",
                     (pscalars["np2"] - pscalars["np1"]) )
         fileout.close()
 
             print("\nDistinctness measures:")
             print("\tUndistorted distance between vectors: ",
                 distance(pvectors["np2"], pvectors["np1"]) )
+            print("\tSigned distance between vectors (signdist): ",
+                    signdistance(pvectors["np2"], pvectors["np1"]) )
             print("\tWeighted scalar difference (NP2-NP1): ",
                 (pscalars["np2"] - pscalars["np1"]) )