docs: def generate(self, mags, n=2e4, mag_errs=None,
                   Teff=None, logg=None, feh=None,
                   MAfn=None, f_triple=0.12, starmodel=None,
                   **kwargs):
          """Generates stars and eclipses
  
          All arguments previously defined.
          """
          n = int(n)
  
  
          #create master population from which to create eclipses
          pop = Observed_TriplePopulation(mags=mags, mag_errs=mag_errs,
                                          Teff=Teff,
                                          logg=logg, feh=feh,
                                          starmodel=starmodel,
                                          period=self.period,
                                          n=2*n)
  
          all_stars = pop.stars
  
          #start with empty; will concatenate onto
          stars = pd.DataFrame()
          df_orbpop_short = pd.DataFrame()
          df_orbpop_long = pd.DataFrame()
  
  
          #calculate eclipses
  
          if MAfn is None:
              MAfn = MAInterpolationFunction(pmin=0.007, pmax=1/0.007, nzs=200, nps=400)
  
          tot_prob = None; tot_dprob = None; prob_norm = None
          n_adapt = n
          while len(stars) < n:
              n_adapt = int(n_adapt)
              inds = np.random.randint(len(all_stars), size=n_adapt)
  
              s = all_stars.iloc[inds]
  
              #calculate limb-darkening coefficients
              u1A, u2A = ldcoeffs(s['Teff_A'], s['logg_A'])
              u1B, u2B = ldcoeffs(s['Teff_B'], s['logg_B'])
              u1C, u2C = ldcoeffs(s['Teff_C'], s['logg_C'])
  
              cur_orbpop_short_df = pop.orbpop.orbpop_short.dataframe.iloc[inds].copy()
              cur_orbpop_long_df = pop.orbpop.orbpop_long.dataframe.iloc[inds].copy()
  
              #calculate eclipses.
              inds, df, (prob,dprob) = calculate_eclipses(s['mass_B'], s['mass_C'],
                                                          s['radius_B'], s['radius_C'],
                                                          s['{}_mag_B'.format(self.band)],
                                                          s['{}_mag_C'.format(self.band)],
                                                          u11s=u1A, u21s=u2A,
                                                          u12s=u1B, u22s=u2B,
                                                          band=self.band,
                                                          period=self.period,
                                                          calc_mininc=True,
                                                          return_indices=True,
                                                          MAfn=MAfn)
  
              s = s.iloc[inds].copy()
              s.reset_index(inplace=True)
              for col in df.columns:
                  s[col] = df[col]
              stars = pd.concat((stars, s))
  
              new_df_orbpop_short = cur_orbpop_short_df.iloc[inds].copy()
              new_df_orbpop_short.reset_index(inplace=True)
  
              new_df_orbpop_long = cur_orbpop_long_df.iloc[inds].copy()
              new_df_orbpop_long.reset_index(inplace=True)
  
              df_orbpop_short = pd.concat((df_orbpop_short, new_df_orbpop_short))
              df_orbpop_long = pd.concat((df_orbpop_long, new_df_orbpop_long))
  
              logging.info('{} eclipsing HEB systems generated (target {})'.format(len(stars),n))
              logging.debug('{} nans in stars[dpri]'.format(np.isnan(stars['dpri']).sum()))
              logging.debug('{} nans in df[dpri]'.format(np.isnan(df['dpri']).sum()))
  
              if tot_prob is None:
                  prob_norm = (1/dprob**2)
                  tot_prob = prob
                  tot_dprob = dprob
              else:
                  prob_norm = (1/tot_dprob**2 + 1/dprob**2)
                  tot_prob = (tot_prob/tot_dprob**2 + prob/dprob**2)/prob_norm
                  tot_dprob = 1/np.sqrt(prob_norm)
  
              n_adapt = min(int(1.2*(n-len(stars)) * n_adapt//len(s)), 5e4)
              n_adapt = max(n_adapt, 100)
  
          stars = stars.iloc[:n]
          df_orbpop_short = df_orbpop_short.iloc[:n]
          df_orbpop_long = df_orbpop_long.iloc[:n]
          orbpop = TripleOrbitPopulation.from_df(df_orbpop_long, df_orbpop_short)
  
          stars = stars.reset_index()
          stars.drop('index', axis=1, inplace=True)
  
          stars['mass_1'] = stars['mass_B']
          stars['radius_1'] = stars['radius_B']
          stars['mass_2'] = stars['mass_C']
          stars['radius_2'] = stars['radius_C']
  
          ## Why does this make it go on infinite loop??
          #Observed_TriplePopulation.__init__(self, stars=stars, orbpop=orbpop,
          #                                   mags=mags, mag_errs=mag_errs,
          #                                   Teff=Teff, logg=logg, feh=feh,
          #                                   starmodel=starmodel)
          #############
  
          self.mags = mags
          self.mag_errs = mag_errs
          self.Teff = Teff
          self.logg = logg
          self.feh = feh
          self._starmodel = pop.starmodel
  
          priorfactors = {'f_triple':f_triple}
  
          EclipsePopulation.__init__(self, stars=stars, orbpop=orbpop,
                                     period=self.period, cadence=self.cadence,
                                     model=self.model,
                                     priorfactors=priorfactors, prob=tot_prob,
                                     lhoodcachefile=self.lhoodcachefile)