action = "store_true", default = False, help = "Plots recurrence charts.") # parse command-line arguments, exits when fatal error 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":
channel_number = 2 max_multiplexed = 2 emg_analyser = EmgAnalyser(options.frequency, options.start_time, 3) else: 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