| OLD | NEW |
| 1 """Launches an anaconda environment to run some scipy hypothesis tests.""" | 1 """Launches an anaconda environment to run some scipy hypothesis tests.""" |
| 2 | 2 |
| 3 import json | 3 import json |
| 4 import os | 4 import os |
| 5 import subprocess | 5 import subprocess |
| 6 import sys | 6 import sys |
| 7 | 7 |
| 8 class ScipyNotInstalledError(Exception): | 8 class ScipyNotInstalledError(Exception): |
| 9 pass | 9 pass |
| 10 | 10 |
| 11 def main(argv, anaconda_path=None): | 11 def main(argv, anaconda_path=None): |
| 12 _, list_a, list_b, significance = argv | 12 _, list_a, list_b, significance = argv |
| 13 | 13 |
| 14 # Do not even test if there's a single repeated value on both samples. | 14 # Do not even test if there's a single repeated value on both samples. |
| 15 if len(set(list_a + list_b)) == 1: | 15 if len(set(json.loads(list_a) + json.loads(list_b))) == 1: |
| 16 return { | 16 return { |
| 17 'first_sample': list_a, | 17 'first_sample': json.loads(list_a), |
| 18 'second_sample': list_b, | 18 'second_sample': json.loads(list_b), |
| 19 'mann_p_value': None, | 19 'mann_p_value': None, |
| 20 'anderson_p_value': None, | 20 'anderson_p_value': None, |
| 21 'welch_p_value': None, | 21 'welch_p_value': None, |
| 22 'normal-y': None, | 22 'normal-y': None, |
| 23 'significantly_different': False | 23 'significantly_different': False |
| 24 } | 24 } |
| 25 | 25 |
| 26 if not anaconda_path: | 26 if not anaconda_path: |
| 27 if os.name == 'nt': | 27 if os.name == 'nt': |
| 28 anaconda_path = r'c:\conda-py-scientific\python.exe' | 28 anaconda_path = r'c:\conda-py-scientific\python.exe' |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 return json.loads(subprocess.check_output( | 40 return json.loads(subprocess.check_output( |
| 41 [anaconda_path, inner_script_location,list_a, list_b, significance], | 41 [anaconda_path, inner_script_location,list_a, list_b, significance], |
| 42 env=conda_environ)) | 42 env=conda_environ)) |
| 43 | 43 |
| 44 if __name__ == '__main__': | 44 if __name__ == '__main__': |
| 45 result = main(sys.argv) | 45 result = main(sys.argv) |
| 46 if result: | 46 if result: |
| 47 print json.dumps(result, indent=4) | 47 print json.dumps(result, indent=4) |
| 48 sys.exit(0) | 48 sys.exit(0) |
| 49 sys.exit(1) | 49 sys.exit(1) |
| OLD | NEW |