original_docstring: 
      NOTE:
      This needs to be either
      1. made in to simple multi-pass cleaner,
      2. made in to "run till no signif change" cleaner, or
      3. folded back in to main code
  
      Search for flares in the continuous observation periods
      of light curves.
  
      Parameters:
      ------------
      lc : pandas DataFrame
          light curve
      dlr : list of tuples
          contains boundaries of continuous observation periods
      mode : 'davenport' or str
          method for model light curve construction
      gapwindow : 0.1 or float
  
      minsep : 3 or int
  
      debug : False or bool
  
  
      Return:
      ------------
      istart : numpy array
          start indices of flares
      istop : numpy array
          stop indices of flares
      flux_model : numpy array
          model light curve
      
docstring: This needs to be either
  1. made in to simple multi-pass cleaner,
  2. made in to "run till no signif change" cleaner, or
  3. folded back in to main code
  
  Search for flares in the continuous observation periods
  of light curves.
  
  
  
  lc : pandas DataFrame
  light curve
  dlr : list of tuples
  contains boundaries of continuous observation periods
  mode : 'davenport' or str
  method for model light curve construction
  gapwindow : 0.1 or float
  
  minsep : 3 or int
  
  debug : False or bool
  
  
  
  istart : numpy array
  start indices of flares
  istop : numpy array
  stop indices of flares
  flux_model : numpy array
  model light curve
docstring_tokens: This needs to be either 1 . made in to simple multi - pass cleaner 2 . made in to " run till no signif change " cleaner or 3 . folded back in to main code Search for flares in the continuous observation periods of light curves . lc : pandas DataFrame light curve dlr : list of tuples contains boundaries of continuous observation periods mode : ' davenport ' or str method for model light curve construction gapwindow : 0 . 1 or float minsep : 3 or int debug : False or bool istart : numpy array start indices of flares istop : numpy array stop indices of flares flux_model : numpy array model light curve
code: def MultiFind(lc, dlr,mode='davenport',
                gapwindow=0.1, minsep=3, debug=False):
      '''
      NOTE:
      This needs to be either
      1. made in to simple multi-pass cleaner,
      2. made in to "run till no signif change" cleaner, or
      3. folded back in to main code
  
      Search for flares in the continuous observation periods
      of light curves.
  
      Parameters:
      ------------
      lc : pandas DataFrame
          light curve
      dlr : list of tuples
          contains boundaries of continuous observation periods
      mode : 'davenport' or str
          method for model light curve construction
      gapwindow : 0.1 or float
  
      minsep : 3 or int
  
      debug : False or bool
  
  
      Return:
      ------------
      istart : numpy array
          start indices of flares
      istop : numpy array
          stop indices of flares
      flux_model : numpy array
          model light curve
      '''
  
      lc['flux_model'] = 0.
      istart = np.array([], dtype='int')
      istop = np.array([], dtype='int')
      flux_model = lc.flux_model.copy().values
  
      for (le,ri) in dlr:
          lct = lc.iloc[le:ri].copy()
          time, flux  = lct.time.values, lct.flux.values,
          error, flags = lct.error.values, lct.flags.values
  
          # the bad data points (search where bad < 1)
          bad = help.FlagCuts(flags, returngood=False)
  
  
          flux_model_i, flux_diff = ModelLC(time, flux, error,
                                            gapwindow=gapwindow, minsep=minsep,
                                            mode=mode, debug=debug)
  
          # run final flare-find on DATA - MODEL
          isflare = FINDflare(flux_diff, error, N1=3, N2=4, N3=3,
                              returnbinary=True, avg_std=True)
  
          # now pick out final flare candidate points from above
          cand1 = np.where((bad < 1) & (isflare > 0))[0]
  
          x1 = np.where((np.abs(time[cand1]-time[-1]) < gapwindow))
          x2 = np.where((np.abs(time[cand1]-time[0]) < gapwindow))
          cand1 = np.delete(cand1, x1)
          cand1 = np.delete(cand1, x2)
          if (len(cand1) < 1):
              istart_i = np.array([])
              istop_i = np.array([])
          else:
              # find start and stop index, combine neighboring candidates in to same events
              istart_i = cand1[np.append([0], np.where((cand1[1:]-cand1[:-1] > minsep))[0]+1)]
              istop_i = cand1[np.append(np.where((cand1[1:]-cand1[:-1] > minsep))[0], [len(cand1)-1])]
          # if start & stop times are the same, add 1 more datum on the end
          to1 = np.where((istart_i-istop_i == 0))
          if len(to1[0])>0:
              istop_i[to1] += 1
  
          if debug is True:
              plt.figure()
              plt.title('debugging plot')
              plt.scatter(time, flux_i, alpha=0.5,label='flux')
              plt.plot(time,flux_model_i, c='black',label='flux model')
              plt.scatter(time[cand1], flux_i[cand1], c='red',label='flare candidates')
              plt.legend()
              plt.show()
  
  
          #chi2 = chisq(lc.flux.values[le:ri], flux_model_i, error[le:ri])
          istart = np.array(np.append(istart, istart_i + le), dtype='int')
          istop = np.array(np.append(istop, istop_i + le), dtype='int')
          flux_model[le:ri] = flux_model_i
  
      return istart, istop, flux_model
code_tokens: def MultiFind ( lc , dlr , mode = 'davenport' , gapwindow = 0.1 , minsep = 3 , debug = False ) : lc [ 'flux_model' ] = 0. istart = np . array ( [ ] , dtype = 'int' ) istop = np . array ( [ ] , dtype = 'int' ) flux_model = lc . flux_model . copy ( ) . values for ( le , ri ) in dlr : lct = lc . iloc [ le : ri ] . copy ( ) time , flux = lct . time . values , lct . flux . values , error , flags = lct . error . values , lct . flags . values bad = help . FlagCuts ( flags , returngood = False ) flux_model_i , flux_diff = ModelLC ( time , flux , error , gapwindow = gapwindow , minsep = minsep , mode = mode , debug = debug ) isflare = FINDflare ( flux_diff , error , N1 = 3 , N2 = 4 , N3 = 3 , returnbinary = True , avg_std = True ) cand1 = np . where ( ( bad < 1 ) & ( isflare > 0 ) ) [ 0 ] x1 = np . where ( ( np . abs ( time [ cand1 ] - time [ - 1 ] ) < gapwindow ) ) x2 = np . where ( ( np . abs ( time [ cand1 ] - time [ 0 ] ) < gapwindow ) ) cand1 = np . delete ( cand1 , x1 ) cand1 = np . delete ( cand1 , x2 ) if ( len ( cand1 ) < 1 ) : istart_i = np . array ( [ ] ) istop_i = np . array ( [ ] ) else : istart_i = cand1 [ np . append ( [ 0 ] , np . where ( ( cand1 [ 1 : ] - cand1 [ : - 1 ] > minsep ) ) [ 0 ] + 1 ) ] istop_i = cand1 [ np . append ( np . where ( ( cand1 [ 1 : ] - cand1 [ : - 1 ] > minsep ) ) [ 0 ] , [ len ( cand1 ) - 1 ] ) ] to1 = np . where ( ( istart_i - istop_i == 0 ) ) if len ( to1 [ 0 ] ) > 0 : istop_i [ to1 ] += 1 if debug is True : plt . figure ( ) plt . title ( 'debugging plot' ) plt . scatter ( time , flux_i , alpha = 0.5 , label = 'flux' ) plt . plot ( time , flux_model_i , c = 'black' , label = 'flux model' ) plt . scatter ( time [ cand1 ] , flux_i [ cand1 ] , c = 'red' , label = 'flare candidates' ) plt . legend ( ) plt . show ( ) istart = np . array ( np . append ( istart , istart_i + le ) , dtype = 'int' ) istop = np . array ( np . append ( istop , istop_i + le ) , dtype = 'int' ) flux_model [ le : ri ] = flux_model_i return istart , istop , flux_model
short_docstring: NOTE:
  This needs to be either
  1. made in to simple multi-pass cleaner,
  2. made in to "run till no signif change" cleaner, or
  3. folded back in to main code
short_docstring_tokens: NOTE : This needs to be either 1 . made in to simple multi - pass cleaner 2 . made in to " run till no signif change " cleaner or 3 . folded back in to main code
comment: '''
      NOTE:
      This needs to be either
      1. made in to simple multi-pass cleaner,
      2. made in to "run till no signif change" cleaner, or
      3. folded back in to main code
  
      Search for flares in the continuous observation periods
      of light curves.
  
      Parameters:
      ------------
      lc : pandas DataFrame
          light curve
      dlr : list of tuples
          contains boundaries of continuous observation periods
      mode : 'davenport' or str
          method for model light curve construction
      gapwindow : 0.1 or float
  
      minsep : 3 or int
  
      debug : False or bool
  
  
      Return:
      ------------
      istart : numpy array
          start indices of flares
      istop : numpy array
          stop indices of flares
      flux_model : numpy array
          model light curve
      '''$SEP$# the bad data points (search where bad < 1)
  $SEP$# run final flare-find on DATA - MODEL
  $SEP$# now pick out final flare candidate points from above
  $SEP$# find start and stop index, combine neighboring candidates in to same events
  $SEP$# if start & stop times are the same, add 1 more datum on the end
  $SEP$#chi2 = chisq(lc.flux.values[le:ri], flux_model_i, error[le:ri])
  