channel_number = 1 max_multiplexed = 1 emg_analyser = EmgAnalyser(options.frequency, options.start_time, 1) if not options.input_file: print "Input file required; type -h for help." exit(-1) ## construct main agents bandpass_filter = BandpassFilter(options.frequency, [20, 180]) data_preparator = DataPreparator(options, channel_number, max_multiplexed, [bandpass_filter]) data_preparator.load_file() plotter = SignalPlotter(data_preparator.prepare_timeline()) data_preparator.prepare_data() if options.mode == "trigger": data_preparator.apply_filters(exclude = [3]) elif options.mode == "simple": data_preparator.apply_filters() else: data_preparator.apply_filters(exclude = [1]) print "Analysing channel %s\n" % options.channel # plot signal if options.mode == "trigger": signal = data_preparator.trigger_signal_set() elif options.mode == "simple":
options, args = parser.parse_args() options.channel = int(options.channel) if not options.input_file: print "Input file required; type -h for help." exit(-1) ## construct main agents bandstop_filter = BandstopFilter(options.frequency, [49, 51]) highpass_filter = HighpassFilter(options.frequency, 0.5) data_preparator = DataPreparator(options, [bandstop_filter, highpass_filter]) data_preparator.load_file() ekg_analyser = EkgAnalyser(options.frequency, data_preparator.start_time) plotter = SignalPlotter(data_preparator.prepare_timeline()) data_preparator.prepare_data() data_preparator.apply_filters() print "%s representation" % options.representation.capitalize() print "Analysing channel %s\n" % options.channel # plot signal if options.representation == "raw": signal = data_preparator.raw_signal_set() elif options.representation == "einthoven": signal = data_preparator.einthoven_signal_set() elif options.representation == "goldberg": signal = data_preparator.goldberg_signal_set()
# parse command-line arguments, exits when fatal error options, args = parser.parse_args() if not options.input_file: print "Input file required; type -h for help." exit(-1) ## construct main agents band_stop = BandstopFilter(options.frequency, [49,51]) high_pass = HighpassFilter(options.frequency, 0.1) data_preparator = GSRDataPreparator(options, [band_stop, high_pass]) data_preparator.load_file() plotter = SignalPlotter(data_preparator.prepare_timeline()) data_preparator.prepare_data() data_preparator.apply_filters(exclude = [3]) signal = data_preparator.montage_signal_set() analyser = GSRAnalyser(options.frequency, options.start_time) analyser.load_signal_set(signal) triggers = analyser.load_emo_reactions(options.decision_file) dec_dict = analyser.get_decisions(options.decision_file, jump = 100) increase = dec_dict["increase"] peaks = dec_dict["peak"] half = dec_dict["half"] print len(triggers), triggers