def summarizeECG(data):
    """Create txt file summarizing ECG analysis

    :param data: dict{instHR, avgHR, brady, tachy}
    """
    #Calls hrdetector() to get instantaneous heart rate
    #instHR = findInstHR()

    #Calls findAvgHR() to get average heart rate
    #avgHR = findAvgHR()
    #Calls bradyTimes() to get times when bradycardia occurred
    #brady = bradyTimes()
    #Calls tachtimes() to get times when tachycardia occurred
    #tachy = tachyTimes()
    
    #Writes the output of the ECG analysis to an output file named ecgOutput.txt
    with open('ecgOutput.txt','w') as ecgResults:
        instHRstr = "Estimated instantaneous heart rate: {}".format(data['instHR'])
        avgHRstr = "Estimated average heart rate: {}".format(data['avgHR'])
        if data['brady'] is None:
            bradystr = "Bradycardia never occurred."
        else:
            bradystr = "Bradycardia occurred at: {}".format(data['brady'])
        tachystr = "Tachycardia occurred at: {}".format(data['tachy'])

        ecgResults.write(instHRstr + ' BPM\n' + avgHRstr + ' BPM\n' + bradystr + ' sec\n' + tachystr + ' sec')

@@ -1,8 +1,48 @@
+import pandas as pd%0Aimport numpy as np%0A%0A
 def summ
@@ -169,59 +169,59 @@
 %22%22%22%0A
+%0A
     #
-Calls hrdetector() to get instantaneous
+Get user specified period for averaging
  heart
- 
 rate
@@ -229,61 +229,46 @@
     
-#instHR
+avgPeriod
  = 
-f
 in
-dInstHR()%0A%0A    #Calls findAvgHR() to get
+put(%22How many minutes to
  ave
@@ -281,220 +281,329 @@
 eart
- 
 rate
+?%22)
 %0A    
-#avgHR = findAvgHR()%0A    #Calls bradyTimes() to get times when bradycardia occurred%0A    #brady = bradyTimes()%0A    #Calls tachtimes() to get times when tachycardia occurred%0A    #tachy = tachyTimes()%0A    
+print(%22You selected to average over%22 + avgPeriod + %22 minutes%22)%0A    #Convert input into index number%0A    avgPeriod = (avgPeriod*60)/5%0A    #Create column of just the instantaneous heartrates%0A    instHR = data%5B'HeartRate'%5D%0A    #Average heartrate over period specified by user%0A    avgHR = instHR%5B0:avgPeriod%5D.mean
 %0A   
@@ -804,22 +804,25 @@
 t(data%5B'
-instHR
+HeartRate
 '%5D)%0A    
@@ -857,32 +857,41 @@
 erage heart rate
+ after %7B%7D
 : %7B%7D%22.format(dat
@@ -891,21 +891,23 @@
 mat(
-data%5B'
+avgPeriod,
 avgHR
-'%5D
 )%0A  

Find average based on user input