original_docstring: 
      Construct a model light curve.
  
      Parameters:
      ------------
      time : numpy array
      flux : numpy array
      errors : numpy array
      mode : 'davenport' or str
          Defines the method used to construct model light curve
      
docstring: Construct a model light curve.
  Parameters.
  
  time : numpy array
  flux : numpy array
  errors : numpy array
  mode : 'davenport' or str
  Defines the method used to construct model light curve
docstring_tokens: Construct a model light curve . Parameters . time : numpy array flux : numpy array errors : numpy array mode : ' davenport ' or str Defines the method used to construct model light curve
code: def ModelLC(time, flux, error, mode='davenport', **kwargs):
  
      '''
      Construct a model light curve.
  
      Parameters:
      ------------
      time : numpy array
      flux : numpy array
      errors : numpy array
      mode : 'davenport' or str
          Defines the method used to construct model light curve
      '''
  
  
      if (mode == 'median'):
          # only for fully preprocessed LCs like K2SC
          flux_model_i = np.nanmedian(flux) * np.ones_like(flux)
          flux_diff = flux - flux_model_i
  
      if (mode == 'boxcar'):
          # just use the multi-pass boxcar and average. Simple. Too simple...
          flux_model1 = detrend.MultiBoxcar(time, flux, error, kernel=0.1)
          flux_model2 = detrend.MultiBoxcar(time, flux, error, kernel=1.0)
          flux_model3 = detrend.MultiBoxcar(time, flux, error, kernel=10.0)
  
          flux_model_i = (flux_model1 + flux_model2 + flux_model3) / 3.
          flux_diff = flux - flux_model_i
  
      if (mode == 'fitsin'):
          # first do a pass thru w/ largebox to get obvious flares
          box1 = detrend.MultiBoxcar(time, flux, error,
                                     kernel=2.0, numpass=2)
          sin1 = detrend.FitSin(time, box1, error, maxnum=2,
                                maxper=(max(time)-min(time)))
  
          box2 = detrend.MultiBoxcar(time, flux - sin1, error, kernel=0.25)
          flux_model_i = (box2 + sin1)
          flux_diff = flux - flux_model_i
  
  
      if (mode == 'davenport'):
          # do iterative rejection and spline fit - like FBEYE did
          # also like DFM & Hogg suggest w/ BART
          box1 = detrend.MultiBoxcar(time, flux, error,
                                     kernel=2.0, numpass=2)
  
          sin1 = detrend.FitSin(time, box1, error, maxnum=5,
                                maxper=(max(time)-min(time)),
                                per2=False, debug=kwargs['debug'])
          box3 = detrend.MultiBoxcar(time, flux - sin1, error, kernel=0.3)
          t = np.array(time)
          dt = np.nanmedian(t[1:] - t[0:-1])
          exptime_m = (np.nanmax(time) - np.nanmin(time)) / len(time)
          # ksep used to = 0.07...
          flux_model_i = detrend.IRLSSpline(time, box3, error, numpass=20,
                                            ksep=exptime_m*10.,
                                            debug=kwargs['debug'])
          flux_model_i += sin1
          signalfwhm = dt * 2
          ftime = np.arange(0, 2, dt)
          modelfilter = aflare1(ftime, 1, signalfwhm, 1)
          #Cross-correlate model filter to enhance flare signals
          flux_diff = correlate(flux - flux_model_i,
                                modelfilter, mode='same')
  
      if (mode == 'savgol'):
          # fit data with a SAVGOL filter
          dt = np.nanmedian(time[1:] - time[0:-1])
          Nsmo = np.floor(0.2 / dt)
          if Nsmo % 2 == 0:
              Nsmo = Nsmo + 1
          flux_model_i = savgol_filter(flux, Nsmo, 2, mode='nearest')
          flux_diff = flux - flux_model_i
  
      return flux_model_i, flux_diff
code_tokens: def ModelLC ( time , flux , error , mode = 'davenport' , ** kwargs ) : if ( mode == 'median' ) : flux_model_i = np . nanmedian ( flux ) * np . ones_like ( flux ) flux_diff = flux - flux_model_i if ( mode == 'boxcar' ) : flux_model1 = detrend . MultiBoxcar ( time , flux , error , kernel = 0.1 ) flux_model2 = detrend . MultiBoxcar ( time , flux , error , kernel = 1.0 ) flux_model3 = detrend . MultiBoxcar ( time , flux , error , kernel = 10.0 ) flux_model_i = ( flux_model1 + flux_model2 + flux_model3 ) / 3. flux_diff = flux - flux_model_i if ( mode == 'fitsin' ) : box1 = detrend . MultiBoxcar ( time , flux , error , kernel = 2.0 , numpass = 2 ) sin1 = detrend . FitSin ( time , box1 , error , maxnum = 2 , maxper = ( max ( time ) - min ( time ) ) ) box2 = detrend . MultiBoxcar ( time , flux - sin1 , error , kernel = 0.25 ) flux_model_i = ( box2 + sin1 ) flux_diff = flux - flux_model_i if ( mode == 'davenport' ) : box1 = detrend . MultiBoxcar ( time , flux , error , kernel = 2.0 , numpass = 2 ) sin1 = detrend . FitSin ( time , box1 , error , maxnum = 5 , maxper = ( max ( time ) - min ( time ) ) , per2 = False , debug = kwargs [ 'debug' ] ) box3 = detrend . MultiBoxcar ( time , flux - sin1 , error , kernel = 0.3 ) t = np . array ( time ) dt = np . nanmedian ( t [ 1 : ] - t [ 0 : - 1 ] ) exptime_m = ( np . nanmax ( time ) - np . nanmin ( time ) ) / len ( time ) flux_model_i = detrend . IRLSSpline ( time , box3 , error , numpass = 20 , ksep = exptime_m * 10. , debug = kwargs [ 'debug' ] ) flux_model_i += sin1 signalfwhm = dt * 2 ftime = np . arange ( 0 , 2 , dt ) modelfilter = aflare1 ( ftime , 1 , signalfwhm , 1 ) flux_diff = correlate ( flux - flux_model_i , modelfilter , mode = 'same' ) if ( mode == 'savgol' ) : dt = np . nanmedian ( time [ 1 : ] - time [ 0 : - 1 ] ) Nsmo = np . floor ( 0.2 / dt ) if Nsmo % 2 == 0 : Nsmo = Nsmo + 1 flux_model_i = savgol_filter ( flux , Nsmo , 2 , mode = 'nearest' ) flux_diff = flux - flux_model_i return flux_model_i , flux_diff
short_docstring: Construct a model light curve.
short_docstring_tokens: Construct a model light curve .
comment: '''
      Construct a model light curve.
  
      Parameters:
      ------------
      time : numpy array
      flux : numpy array
      errors : numpy array
      mode : 'davenport' or str
          Defines the method used to construct model light curve
      '''$SEP$# only for fully preprocessed LCs like K2SC
  $SEP$# just use the multi-pass boxcar and average. Simple. Too simple...
  $SEP$# first do a pass thru w/ largebox to get obvious flares
  $SEP$# do iterative rejection and spline fit - like FBEYE did
  $SEP$# also like DFM & Hogg suggest w/ BART
  $SEP$# ksep used to = 0.07...
  $SEP$#Cross-correlate model filter to enhance flare signals
  $SEP$# fit data with a SAVGOL filter
  