def burnstage_upgrade(self, **keyw):
if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT:A>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>keyw["<STR_LIT>"] = "<STR_LIT>"<EOL><DEDENT>if ("<STR_LIT>" in keyw) == False:<EOL><INDENT>cyclefin = <NUM_LIT><EOL><DEDENT>else:<EOL><INDENT>cyclefin = keyw["<STR_LIT>"]<EOL><DEDENT>burn_cycles = []<EOL>burn_ages = []<EOL>burn_abun = []<EOL>burn_type = []<EOL>burn_lifetime = []<EOL>firstfile = True<EOL>hemax, cmax, nemax, omax = <NUM_LIT:0.>, <NUM_LIT:0.>, <NUM_LIT:0.>, <NUM_LIT:0.><EOL>hburn_logic = True<EOL>heburn_logic = True<EOL>cburn_logic = True<EOL>neburn_logic = True<EOL>oburn_logic = True<EOL>hburn_start_logic = False<EOL>heburn_start_logic = False<EOL>cburn_start_logic = False<EOL>neburn_start_logic = False<EOL>oburn_start_logic = False<EOL>cyc = self.se.cycles<EOL>sparsity_factor = int(<NUM_LIT:1>)<EOL>cycles_list = list(range(int(cyc[<NUM_LIT:0>]),int(cyc[len(cyc)-<NUM_LIT:1>]),((int(cyc[<NUM_LIT:1>])-int(cyc[<NUM_LIT:0>])))*sparsity_factor))<EOL>age_list    = self.se.get(keyw["<STR_LIT>"])<EOL>all_isos=self.se.isotopes<EOL>useful_species = species_list("<STR_LIT>")<EOL>useful_index  = []<EOL>for iso in useful_species:<EOL><INDENT>useful_index.append(useful_species.index(iso))<EOL><DEDENT>specie_index={}<EOL>for a,b in zip(useful_species,useful_index):<EOL><INDENT>specie_index[a] = b<EOL><DEDENT>xm_init = self.se.get(<NUM_LIT:0>,keyw["<STR_LIT>"])<EOL>central_zone = <NUM_LIT:0><EOL>external_zone = -<NUM_LIT:1><EOL>if isinstance(xm_init, list) == True:<EOL><INDENT>if xm_init[<NUM_LIT:0>] > xm_init[<NUM_LIT:1>]:<EOL><INDENT>central_zone = -<NUM_LIT:1><EOL>external_zone = <NUM_LIT:0><EOL><DEDENT><DEDENT>zone = <NUM_LIT:0><EOL>xm_cyc=[]<EOL>xm_list=[]<EOL>for i in cycles_list:<EOL><INDENT>xm_cyc  = self.se.get(i,keyw["<STR_LIT>"])[central_zone]<EOL>xm_list.append(xm_cyc)<EOL><DEDENT>abund_list = []<EOL>for i in cycles_list:<EOL><INDENT>abund_tmp = []<EOL>for iso in useful_species:<EOL><INDENT>abund_cyc = self.se.get(i,keyw["<STR_LIT>"],iso)[central_zone]<EOL>abund_tmp.append(abund_cyc)<EOL><DEDENT>abund_list.append(abund_tmp)<EOL><DEDENT>if firstfile == True:<EOL><INDENT>hsurf = self.se.get(<NUM_LIT:0>,keyw["<STR_LIT>"],'<STR_LIT>')[external_zone]<EOL>firstfile = False<EOL><DEDENT>for i in range(<NUM_LIT:1>, len(cycles_list)-<NUM_LIT:1>):<EOL><INDENT>if cycles_list[i] > cyclefin and cyclefin != <NUM_LIT:0>:<EOL><INDENT>pair = False<EOL>age1 = -<NUM_LIT:1><EOL>for i in range(len(burn_type)):<EOL><INDENT>if '<STR_LIT:start>' in burn_type[i] and pair == False:<EOL><INDENT>age1 = burn_ages[i]<EOL>pair = True<EOL><DEDENT>elif '<STR_LIT:end>' in burn_type[i] and pair == True:<EOL><INDENT>age2 = burn_ages[i]<EOL>pair = False<EOL>if age1 != -<NUM_LIT:1>:<EOL><INDENT>burn_lifetime.append(age2 - age1)<EOL>age1 = -<NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return [burn_cycles, burn_ages, burn_abun, burn_type,<EOL>burn_lifetime]<EOL>print('<STR_LIT>')<EOL><DEDENT>if hburn_logic:<EOL><INDENT>hcen  = abund_list[i][specie_index['<STR_LIT>']]<EOL>hcennext = abund_list[i+<NUM_LIT:1>][specie_index['<STR_LIT>']]<EOL>if hcen ><NUM_LIT>:<EOL><INDENT>if hcennext < hsurf-<NUM_LIT> and hcen >= hsurf-<NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(hcen)<EOL>burn_type.append('<STR_LIT>')<EOL>hburn_start_logic = True<EOL><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:H>')<EOL><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:H>')<EOL><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:H>')<EOL><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:H>')<EOL><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL>hemax = abund_list[i][specie_index['<STR_LIT>']]<EOL>if hburn_start_logic:<EOL><INDENT>hburn_logic == False<EOL><DEDENT><DEDENT>if hcennext < <NUM_LIT> and hcen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:H>')<EOL><DEDENT><DEDENT><DEDENT>hecen  = abund_list[i][specie_index['<STR_LIT>']]<EOL>hecennext = abund_list[i+<NUM_LIT:1>][specie_index['<STR_LIT>']]<EOL>if hcen < <NUM_LIT> and hecen > <NUM_LIT>:<EOL><INDENT>if hecennext < hemax-<NUM_LIT> and hecen >= hemax-<NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(hecen)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL>cmax = abund_list[i][specie_index['<STR_LIT>']]<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if hecennext < <NUM_LIT> and hecen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT><DEDENT>ccen  = abund_list[i][specie_index['<STR_LIT>']]<EOL>ccennext = abund_list[i+<NUM_LIT:1>][specie_index['<STR_LIT>']]<EOL>if hcen < <NUM_LIT> and hecen < <NUM_LIT> and ccen > <NUM_LIT>:<EOL><INDENT>if ccennext < cmax-<NUM_LIT> and ccen >= cmax-<NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(ccen)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL>nemax = abund_list[i][specie_index['<STR_LIT>']]<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT>if ccennext < <NUM_LIT> and ccen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:C>')<EOL><DEDENT><DEDENT>necen  = abund_list[i][specie_index['<STR_LIT>']]<EOL>necennext = abund_list[i+<NUM_LIT:1>][specie_index['<STR_LIT>']]<EOL>if hcen < <NUM_LIT> and hecen < <NUM_LIT> and ccen < <NUM_LIT> and necen > <NUM_LIT>:<EOL><INDENT>if necennext < nemax-<NUM_LIT> and necen >= nemax-<NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(necen)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL>omax = abund_list[i][specie_index['<STR_LIT>']]<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if necennext < <NUM_LIT> and necen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT><DEDENT>ocen  = abund_list[i][specie_index['<STR_LIT>']]<EOL>ocennext = abund_list[i+<NUM_LIT:1>][specie_index['<STR_LIT>']]<EOL>if hcen < <NUM_LIT> and hecen < <NUM_LIT> and ccen < <NUM_LIT> and ocen > <NUM_LIT>:<EOL><INDENT>if ocennext < omax-<NUM_LIT> and ocen >= omax-<NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(ccen)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT>if ocennext < <NUM_LIT> and ocen >= <NUM_LIT>:<EOL><INDENT>burn_cycles.append(cycles_list[i])<EOL>burn_ages.append(age_list[i])<EOL>burn_abun.append(<NUM_LIT>)<EOL>burn_type.append('<STR_LIT:O>')<EOL><DEDENT><DEDENT><DEDENT>print('<STR_LIT>')<EOL>pair = False<EOL>age1 = -<NUM_LIT:1><EOL>for i in range(len(burn_type)):<EOL><INDENT>if '<STR_LIT:start>' in burn_type[i] and pair == False:<EOL><INDENT>age1 = burn_ages[i]<EOL>pair = True<EOL><DEDENT>elif '<STR_LIT:end>' in burn_type[i] and pair == True:<EOL><INDENT>age2 = burn_ages[i]<EOL>pair = False<EOL>if age1 != -<NUM_LIT:1>:<EOL><INDENT>burn_lifetime.append(age2 - age1)<EOL>age1 = -<NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return [burn_cycles, burn_ages, burn_abun, burn_type, burn_lifetime]<EOL>
This function calculates the presence of burning stages and
outputs the ages when key isotopes are depleted and uses them to
calculate burning lifetimes.

Parameters
----------
keyw : dict
    A dict of key word arguments.

Returns
-------
list
    A list containing the following information: burn_cycles,
    burn_ages, burn_abun, burn_type and burn_lifetime.

Notes
-----
The following keywords can also be used:

+------------------+---------------+
| Keyword Argument | Default Value |
+==================+===============+
| abund            | "iso_massf"   |
+------------------+---------------+
| isoa             | "A"           |
+------------------+---------------+
| isoz             | "Z"           |
+------------------+---------------+
| mass             | "mass"        |
+------------------+---------------+
| cycle            | "cycle"       |
+------------------+---------------+
| cyclefin         | 0             |
+------------------+---------------+

All arguments change the name of fields used to read data from
HDF5 files, other than cyclefin.  Cyclefin is the last timestep
to use when reading files.

Cycles contain the cycle numbers for the various points where
the abundance is abun.  The age of the star at each point and
the type of burning is indicated by those arrays.  The
lifetimes are calculated by.