(self, percent, category_percents)
| 3833 | |
| 3834 | |
| 3835 | def submit_session(self, percent, category_percents): |
| 3836 | global musicplayer |
| 3837 | global applauseplayer |
| 3838 | self.history.append([mode.session_number, mode.mode, mode.back, percent, mode.manual]) |
| 3839 | |
| 3840 | if ATTEMPT_TO_SAVE_STATS: |
| 3841 | try: |
| 3842 | sep = STATS_SEPARATOR |
| 3843 | statsfile_path = os.path.join(get_data_dir(), cfg.STATSFILE) |
| 3844 | statsfile = open(statsfile_path, 'a') |
| 3845 | outlist = [strftime("%Y-%m-%d %H:%M:%S"), |
| 3846 | mode.short_name(), |
| 3847 | str(percent), |
| 3848 | str(mode.mode), |
| 3849 | str(mode.back), |
| 3850 | str(mode.ticks_per_trial), |
| 3851 | str(mode.num_trials_total), |
| 3852 | str(int(mode.manual)), |
| 3853 | str(mode.session_number), |
| 3854 | str(category_percents['position1']), |
| 3855 | str(category_percents['audio']), |
| 3856 | str(category_percents['color']), |
| 3857 | str(category_percents['visvis']), |
| 3858 | str(category_percents['audiovis']), |
| 3859 | str(category_percents['arithmetic']), |
| 3860 | str(category_percents['image']), |
| 3861 | str(category_percents['visaudio']), |
| 3862 | str(category_percents['audio2']), |
| 3863 | str(category_percents['position2']), |
| 3864 | str(category_percents['position3']), |
| 3865 | str(category_percents['position4']), |
| 3866 | str(category_percents['vis1']), |
| 3867 | str(category_percents['vis2']), |
| 3868 | str(category_percents['vis3']), |
| 3869 | str(category_percents['vis4']), |
| 3870 | str(mode.ticks_per_trial * TICK_DURATION * mode.num_trials_total), |
| 3871 | str(0), |
| 3872 | ] |
| 3873 | statsfile.write(sep.join(outlist)) # adds sep between each element |
| 3874 | statsfile.write('\n') # but we don't want a sep before '\n' |
| 3875 | statsfile.close() |
| 3876 | if CLINICAL_MODE: |
| 3877 | picklefile = open(os.path.join(get_data_dir(), STATS_BINARY), 'ab') |
| 3878 | pickle.dump([strftime("%Y-%m-%d %H:%M:%S"), mode.short_name(), |
| 3879 | percent, mode.mode, mode.back, mode.ticks_per_trial, |
| 3880 | mode.num_trials_total, int(mode.manual), |
| 3881 | mode.session_number, category_percents['position1'], |
| 3882 | category_percents['audio'], category_percents['color'], |
| 3883 | category_percents['visvis'], category_percents['audiovis'], |
| 3884 | category_percents['arithmetic'], category_percents['image'], |
| 3885 | category_percents['visaudio'], category_percents['audio2'], |
| 3886 | category_percents['position2'], category_percents['position3'], |
| 3887 | category_percents['position4'], |
| 3888 | category_percents['vis1'], category_percents['vis2'], |
| 3889 | category_percents['vis3'], category_percents['vis4']], |
| 3890 | picklefile, protocol=2) |
| 3891 | picklefile.close() |
| 3892 | cfg.SAVE_SESSIONS = True # FIXME: put this where it belongs |
no test coverage detected