def find_TPs_and_DUPs(self, percent=<NUM_LIT>, makefig=False):
t0_model=self.find_first_TP()<EOL>t0_idx=(t0_model-self.get("<STR_LIT>")[<NUM_LIT:0>])<EOL>first_TP_he_lum=<NUM_LIT:10>**(self.get("<STR_LIT>")[t0_idx])<EOL>he_lum=<NUM_LIT:10>**(self.get("<STR_LIT>")[t0_idx:])<EOL>h_lum=<NUM_LIT:10>**(self.get("<STR_LIT>")[t0_idx:])<EOL>model=self.get("<STR_LIT>")[t0_idx:]<EOL>try:<EOL><INDENT>h1_bndry=self.get("<STR_LIT>")[t0_idx:]<EOL><DEDENT>except:<EOL><INDENT>try:<EOL><INDENT>h1_bndry=self.get('<STR_LIT>')[t0_idx:]<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>maxima=[<NUM_LIT:0>]<EOL>for i in range(<NUM_LIT:2>,len(model)-<NUM_LIT:1>):<EOL><INDENT>if he_lum[i] > he_lum[i-<NUM_LIT:1>] and he_lum[i] > he_lum[i+<NUM_LIT:1>]:<EOL><INDENT>if he_lum[i-<NUM_LIT:1>] > he_lum[i-<NUM_LIT:2>] and he_lum[i+<NUM_LIT:1>] > he_lum[i+<NUM_LIT:2>]:<EOL><INDENT>if he_lum[i] > h_lum[i]:<EOL><INDENT>maxima.append(i)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>DUPs=[]<EOL>TPend=[]<EOL>maxDUPs=[]<EOL>for i in range(len(maxima)):<EOL><INDENT>idx1=maxima[i]<EOL>try:<EOL><INDENT>idx2=maxima[i+<NUM_LIT:1>]<EOL><DEDENT>except IndexError:<EOL><INDENT>idx2=-<NUM_LIT:1><EOL><DEDENT>bound=h1_bndry[idx1:idx2]<EOL>bound0=bound[<NUM_LIT:0>]<EOL>if bound0==min(bound) or bound0 < min(bound): <EOL><INDENT>DUP=idx1<EOL>DUPs.append(DUP)<EOL>maxDUPs.append(DUP)<EOL><DEDENT>else:<EOL><INDENT>maxDUPs.append(idx1+bound.argmin()) <EOL>maxDUP=bound0-min(bound) <EOL>db=bound - bound[<NUM_LIT:0>]<EOL>db_maxDUP = old_div(db, maxDUP)<EOL>DUP=np.where(db_maxDUP <= old_div(-float(percent),<NUM_LIT>))[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>DUPs.append(DUP+idx1)<EOL><INDENT>top=self.get('<STR_LIT>')[idx1]<EOL>DUP=np.abs(bound-top).argmin()<EOL>DUPs.append(DUP+idx1)<EOL><DEDENT><DEDENT>mx2b=self.get('<STR_LIT>')[t0_idx:][idx1:idx2]<EOL>for i in range(len(mx2b)):<EOL><INDENT>if mx2b[i]==<NUM_LIT:0.>:<EOL><INDENT>endTP=i+idx1<EOL>TPend.append(endTP)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>lambd=[<NUM_LIT:0.>]<EOL>for i in range(<NUM_LIT:1>,len(maxima)):<EOL><INDENT>dmenv = h1_bndry[maxima[i]] - h1_bndry[maxDUPs[i-<NUM_LIT:1>]]<EOL>dmdredge = h1_bndry[maxima[i]] - h1_bndry[maxDUPs[i]]<EOL>lambd.append(old_div(dmdredge,dmenv))<EOL><DEDENT>TPmods = maxima + t0_idx<EOL>DUPmods = DUPs + t0_idx<EOL>TPend = TPend + t0_idx<EOL>return TPmods, DUPmods, TPend, lambd<EOL>
Function which finds TPs and uses the calc_DUP_parameter
function.  To calculate DUP parameter evolution dependent of
the star or core mass.

Parameters
----------
fig : integer
    Figure number to plot.
t0_model : integer
    First he-shell lum peak.
percent : float
    dredge-up is defined as when the mass dredged up is a certain
    percent of the total mass dredged up during that event, which
    is set by the user in this variable.
    The default is 5.
makefig :
    do you want a figure to be made?

Returns
-------
TPmods : array
    model numbers at the peak of each thermal pulse
DUPmods : array
    model numbers at the dredge-up, where dredge-up is defined as
    when the mass dredged up is a certain percent of the total mass
    dredged up during that event, which is set by the user
TPend : array
    model numbers at the end of the PDCZ for each TP
lambda : array
    DUP efficiency for each pulse