def cores(self, incycle, **keyw):
def infomod(core_opt, *inp):<EOL><INDENT>"""<STR_LIT>"""<EOL>if core_opt == <NUM_LIT:0>:<EOL><INDENT>return infomod1(inp[<NUM_LIT:0>], inp[<NUM_LIT:1>], inp[<NUM_LIT:2>])<EOL><DEDENT>elif core_opt == <NUM_LIT:1>:<EOL><INDENT>return infomod2(inp[<NUM_LIT:0>], inp[<NUM_LIT:1>], inp[<NUM_LIT:2>], inp[<NUM_LIT:3>], inp[<NUM_LIT:4>])<EOL><DEDENT><DEDENT>def infomod1(shell, yps, isoindex):<EOL><INDENT>"""<STR_LIT>"""<EOL>xh = yps[shell][isoindex[<NUM_LIT:0>]]<EOL>xhe = yps[shell][isoindex[<NUM_LIT:1>]]<EOL>xc = yps[shell][isoindex[<NUM_LIT:2>]]<EOL>xo = yps[shell][isoindex[<NUM_LIT:3>]]<EOL>xsi = yps[shell][isoindex[<NUM_LIT:4>]]<EOL>xs = yps[shell][isoindex[<NUM_LIT:5>]]<EOL>xa = yps[shell][isoindex[<NUM_LIT:6>]]<EOL>xca = yps[shell][isoindex[<NUM_LIT:7>]]<EOL>xti = yps[shell][isoindex[<NUM_LIT:8>]]<EOL>xcr = yps[shell][isoindex[<NUM_LIT:9>]]<EOL>xfe = yps[shell][isoindex[<NUM_LIT:10>]]<EOL>xni = yps[shell][isoindex[<NUM_LIT:11>]]<EOL>xsicore = xsi + xs + xa + xca + xti<EOL>xfecore = xcr + xfe + xni<EOL>return '<STR_LIT>' + "<STR_LIT>"%(xh) + '<STR_LIT>' + "<STR_LIT>"%(xhe) +'<STR_LIT>' + "<STR_LIT>"%(xc) + '<STR_LIT>' + "<STR_LIT>"%(xo) +'<STR_LIT>' + "<STR_LIT>"%(xsicore) + '<STR_LIT>' + "<STR_LIT>"%(xfecore)<EOL><DEDENT>def infomod2(shell, yps, isoindex, xsicore, xfecore):<EOL><INDENT>"""<STR_LIT>"""<EOL>xsicore = <NUM_LIT:0.><EOL>xsicoren = <NUM_LIT:0.><EOL>xfecore = <NUM_LIT:0.><EOL>xfecoren = <NUM_LIT:0.><EOL>xh = yps[shell][isoindex[<NUM_LIT:0>]]<EOL>xhe = yps[shell][isoindex[<NUM_LIT:1>]]<EOL>xc = yps[shell][isoindex[<NUM_LIT:2>]]<EOL>xo = yps[shell][isoindex[<NUM_LIT:3>]]<EOL>for j in iso_si:<EOL><INDENT>xsicore += yps[i][j]<EOL>xsicoren += yps[i+iter][j]<EOL><DEDENT>for j in iso_fe:<EOL><INDENT>xfecore += yps[i][j]<EOL>xfecoren += yps[i+iter][j]<EOL><DEDENT>return '<STR_LIT>' + str(shell) + '<STR_LIT>' + "<STR_LIT>"%(xh) +'<STR_LIT>' + "<STR_LIT>"%(xhe) + '<STR_LIT>' + "<STR_LIT>"%(xc) +'<STR_LIT>' + "<STR_LIT>"%(xo) + '<STR_LIT>' + "<STR_LIT>"%(xsicore) +'<STR_LIT>' + "<STR_LIT>"%(xfecore)<EOL><DEDENT>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>core_opt = <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>core_opt = keyw["<STR_LIT>"]<EOL><DEDENT>cores = [<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>,<NUM_LIT:0>]<EOL>core_type = ["<STR_LIT>","<STR_LIT>","<STR_LIT>","<STR_LIT>","<STR_LIT>","<STR_LIT>"]<EOL>core_info = []<EOL>iso_si = []<EOL>iso_fe = []<EOL>first = True<EOL>xm_list     = self.se.get(incycle, keyw["<STR_LIT>"])<EOL>abund_list  = self.se.get(incycle, keyw["<STR_LIT>"])<EOL>tables = self.se.Tables<EOL>isoa_list   = tables[<NUM_LIT:0>]<EOL>isoz_list   = tables[<NUM_LIT:1>]<EOL>xmass = xm_list<EOL>yps = abund_list<EOL>centre = <NUM_LIT:0><EOL>surface = len(xmass)-<NUM_LIT:1><EOL>iter = -<NUM_LIT:1><EOL>if isinstance(xmass, list) == True:<EOL><INDENT>if xmass[<NUM_LIT:0>] > xmass[<NUM_LIT:1>]:<EOL><INDENT>centre = len(xmass)-<NUM_LIT:1><EOL>surface = <NUM_LIT:0><EOL>iter = <NUM_LIT:1><EOL><DEDENT><DEDENT>mco01 = <NUM_LIT:0.><EOL>na    = <NUM_LIT:0><EOL>nco   = <NUM_LIT:0><EOL>h1index = -<NUM_LIT:1><EOL>he4index = -<NUM_LIT:1><EOL>c12index = -<NUM_LIT:1><EOL>o16index = -<NUM_LIT:1><EOL>si28index = -<NUM_LIT:1><EOL>s32index = -<NUM_LIT:1><EOL>a36index = -<NUM_LIT:1><EOL>ca40index = -<NUM_LIT:1><EOL>ti44index = -<NUM_LIT:1><EOL>cr48index = -<NUM_LIT:1><EOL>fe52index = -<NUM_LIT:1><EOL>ni56index = -<NUM_LIT:1><EOL>for i in range(len(isoa_list)):<EOL><INDENT>try:<EOL><INDENT>A = int(isoa_list[i])<EOL>Z = int(isoz_list[i])<EOL><DEDENT>except TypeError:<EOL><INDENT>A = int(isoa_list[i][<NUM_LIT:0>])<EOL>Z = int(isoz_list[i][<NUM_LIT:0>])<EOL><DEDENT>if A == <NUM_LIT:1> and Z == <NUM_LIT:1>:<EOL><INDENT>h1index = i<EOL><DEDENT>elif A == <NUM_LIT:4> and Z == <NUM_LIT:2>:<EOL><INDENT>he4index = i<EOL><DEDENT>elif A == <NUM_LIT:12> and Z == <NUM_LIT:6>:<EOL><INDENT>c12index = i<EOL><DEDENT>elif A == <NUM_LIT:16> and Z == <NUM_LIT:8>:<EOL><INDENT>o16index = i<EOL><DEDENT>if core_opt == <NUM_LIT:0>:<EOL><INDENT>if A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>si28index = i<EOL><DEDENT>elif A == <NUM_LIT:32> and Z == <NUM_LIT:16>:<EOL><INDENT>s32index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>a36index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT:20>:<EOL><INDENT>ca40index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>ti44index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>cr48index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>fe52index = i<EOL><DEDENT>elif A == <NUM_LIT> and Z == <NUM_LIT>:<EOL><INDENT>ni56index = i<EOL><DEDENT><DEDENT><DEDENT>if h1index == -<NUM_LIT:1> or he4index == -<NUM_LIT:1> or c12index == -<NUM_LIT:1> or o16index == -<NUM_LIT:1>:<EOL><INDENT>print("<STR_LIT>")<EOL>os.sys.exit()<EOL><DEDENT>if core_opt == <NUM_LIT:0>:<EOL><INDENT>if si28index == -<NUM_LIT:1> or s32index == -<NUM_LIT:1> or a36index == -<NUM_LIT:1> or ca40index == -<NUM_LIT:1>or ti44index == -<NUM_LIT:1> or cr48index == -<NUM_LIT:1> or fe52index == -<NUM_LIT:1> or ni56index == -<NUM_LIT:1>:<EOL><INDENT>print("<STR_LIT>")<EOL>core_opt = <NUM_LIT:1><EOL><DEDENT><DEDENT>if core_opt == <NUM_LIT:1>:<EOL><INDENT>for i in range(len(isoa_list)):<EOL><INDENT>try:<EOL><INDENT>A = int(isoa_list[i])<EOL>Z = int(isoz_list[i])<EOL><DEDENT>except TypeError:<EOL><INDENT>A = int(isoa_list[i][<NUM_LIT:0>])<EOL>Z = int(isoz_list[i][<NUM_LIT:0>])<EOL><DEDENT>if Z >= <NUM_LIT> and Z <= <NUM_LIT>:<EOL><INDENT>iso_si.append(i)<EOL><DEDENT>if Z >= <NUM_LIT> and Z <= <NUM_LIT>:<EOL><INDENT>iso_fe.append(i)<EOL><DEDENT><DEDENT><DEDENT>isoindex = [h1index, he4index, c12index, o16index]<EOL>if core_opt == <NUM_LIT:0>:<EOL><INDENT>isoindex.extend([si28index, s32index, a36index, ca40index,<EOL>ti44index, cr48index, fe52index, ni56index])<EOL><DEDENT>if first == True:<EOL><INDENT>first = False<EOL>cores[<NUM_LIT:0>] = xmass[surface]<EOL>core_type[<NUM_LIT:0>] = "<STR_LIT>"<EOL>core_info.append(infomod(core_opt, surface, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>for i in np.arange(surface, centre, iter):<EOL><INDENT>xsicore = <NUM_LIT:0.><EOL>xfecore = <NUM_LIT:0.><EOL>xsicoren = <NUM_LIT:0.><EOL>xfecoren = <NUM_LIT:0.><EOL>xh = yps[i][h1index]<EOL>xhe = yps[i][he4index]<EOL>xc = yps[i][c12index]<EOL>xo = yps[i][o16index]<EOL>xhn = yps[i+iter][h1index]<EOL>xhen = yps[i+iter][he4index]<EOL>xcn = yps[i+iter][c12index]<EOL>xon = yps[i+iter][o16index]<EOL>xcocore = xc + xo<EOL>xcocoren = xcn + xon<EOL>if core_opt == <NUM_LIT:0>:<EOL><INDENT>xsi = yps[i][si28index]<EOL>xs = yps[i][s32index]<EOL>xa = yps[i][a36index]<EOL>xca = yps[i][ca40index]<EOL>xti = yps[i][ti44index]<EOL>xcr = yps[i][cr48index]<EOL>xfe = yps[i][fe52index]<EOL>xni = yps[i][ni56index]<EOL>xsin = yps[i+iter][si28index]<EOL>xsn = yps[i+iter][s32index]<EOL>xan = yps[i+iter][a36index]<EOL>xcan = yps[i+iter][ca40index]<EOL>xtin = yps[i+iter][ti44index]<EOL>xcrn = yps[i+iter][cr48index]<EOL>xfen = yps[i+iter][fe52index]<EOL>xnin = yps[i+iter][ni56index]<EOL>xsicore = xsi + xs + xa + xca + xti<EOL>xfecore = xcr + xfe + xni<EOL>xsicoren = xsin + xsn + xan + xcan + xtin<EOL>xfecoren = xcrn + xfen + xnin<EOL><DEDENT>elif core_opt == <NUM_LIT:1>:<EOL><INDENT>for j in iso_si:<EOL><INDENT>xsicore += yps[i][j]<EOL>xsicoren += yps[i+iter][j]<EOL><DEDENT>for j in iso_fe:<EOL><INDENT>xfecore += yps[i][j]<EOL>xfecoren += yps[i+iter][j]<EOL><DEDENT><DEDENT>if xh >= <NUM_LIT>:<EOL><INDENT>if xhen > <NUM_LIT> and xhe <= <NUM_LIT>:<EOL><INDENT>if cores[<NUM_LIT:1>] == <NUM_LIT:0>:<EOL><INDENT>cores[<NUM_LIT:1>] = xmass[i]<EOL>core_type[<NUM_LIT:1>] = '<STR_LIT>'<EOL>core_info.append('<STR_LIT>'+str(xmass[i-iter])+infomod(core_opt, i-iter, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i+iter])+infomod(core_opt, i+iter, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>if xhen > <NUM_LIT:0.5> and xhe <= <NUM_LIT:0.5>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xhn < <NUM_LIT> and xh >= <NUM_LIT>:<EOL><INDENT>na=i<EOL>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xhn < <NUM_LIT> and xh >= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xhn < <NUM_LIT> and xh >= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>if xhe >= <NUM_LIT> and xh < <NUM_LIT>:<EOL><INDENT>if xcocoren > <NUM_LIT:0.5> and xcocore <= <NUM_LIT:0.5>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xcocoren > <NUM_LIT> and xcocore <= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xhen < <NUM_LIT> and xhe >= <NUM_LIT>:<EOL><INDENT>if cores[<NUM_LIT:2>] == <NUM_LIT:0>:<EOL><INDENT>mco01=xmass[i]<EOL>nco=i<EOL>cores[<NUM_LIT:2>] = xmass[i]<EOL>core_type[<NUM_LIT:2>] = '<STR_LIT>'<EOL>core_info.append('<STR_LIT>'+str(xmass[i-iter])+infomod(core_opt, i-iter, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i+iter])+infomod(core_opt, i+iter, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>if xhen < <NUM_LIT> and xhe >= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xhen < <NUM_LIT> and xhe >= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>if xcocore >= <NUM_LIT>:<EOL><INDENT>if xsicoren > <NUM_LIT:0.5> and xsicore <= <NUM_LIT:0.5>:<EOL><INDENT>if cores[<NUM_LIT:3>] == <NUM_LIT:0>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i-iter])+infomod(core_opt, i-iter, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i+iter])+infomod(core_opt, i+iter, yps, isoindex, iso_si, iso_fe))<EOL>cores[<NUM_LIT:3>] = xmass[i]<EOL>core_type[<NUM_LIT:3>] = '<STR_LIT>'<EOL><DEDENT><DEDENT>if xsicoren > <NUM_LIT> and xsicore <= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xcocoren > <NUM_LIT> and xcocore <= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>if xfecoren > <NUM_LIT:0.5> and xfecore <= <NUM_LIT:0.5>:<EOL><INDENT>if cores[<NUM_LIT:4>] == <NUM_LIT:0>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i-iter])+infomod(core_opt, i-iter, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL>core_info.append('<STR_LIT>'+str(xmass[i+iter])+infomod(core_opt, i+iter, yps, isoindex, iso_si, iso_fe))<EOL>cores[<NUM_LIT:4>] = xmass[i]<EOL>core_type[<NUM_LIT:4>] = '<STR_LIT>'<EOL><DEDENT><DEDENT>if xfecoren > <NUM_LIT> and xfecore <= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT>if xsicoren > <NUM_LIT> and xsicore <= <NUM_LIT>:<EOL><INDENT>core_info.append('<STR_LIT>'+str(xmass[i])+infomod(core_opt, i, yps, isoindex, iso_si, iso_fe))<EOL><DEDENT><DEDENT>mcof=mco01<EOL>i=na<EOL>while i < nco:<EOL><INDENT>i+=<NUM_LIT:1><EOL>xco = yps[i][c12index] + yps[i][o16index]<EOL>xcop = yps[i-iter][c12index] + yps[i-iter][o16index]<EOL>mcof+=(xco+xcop)/<NUM_LIT>*(xmass[i-iter]-xmass[i])<EOL><DEDENT>cores[<NUM_LIT:2>] = mcof<EOL>core_type[<NUM_LIT:2>] = '<STR_LIT>'<EOL>xmco = np.array([<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>])<EOL>xmre = np.array([<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>,<NUM_LIT>])<EOL>if '<STR_LIT>' in core_type:<EOL><INDENT>for i in np.arange(len(xmco)):<EOL><INDENT>if cores[<NUM_LIT:2>] < xmco[i]:<EOL><INDENT>xco = yps[i][c12index] + yps[i][o16index]<EOL>xcop = yps[i-iter][c12index] + yps[i-iter][o16index]<EOL>cores[<NUM_LIT:5>] = xmre[i-<NUM_LIT:1>]+(xmre[i]-xmre[i-<NUM_LIT:1>])*(cores[j]-xmco[i-<NUM_LIT:1>])/(xmco[i]-xmco[i-<NUM_LIT:1>])<EOL>core_type[<NUM_LIT:5>] = '<STR_LIT>'<EOL>break<EOL><DEDENT><DEDENT><DEDENT>return [cores, core_type, core_info]<EOL>
This function uses the abundances as a function of time to
return core masses.

Parameters
----------
incycle : integer
    incycle is the cycle to choose where to take the core
    masses.
keyw : dict
    A dict of key word arguments.

Returns
-------
list
    [cores, core_type, core_info]
    cores contains the core masses for the types found in
    core_type.  Core_info stores a variety of information about
    the abundances at certain mass coordinates.

Notes
-----
These core masses are:

+----------+-----------------------------------------+
| M_alpha  | mass of the helium core                 |
+----------+-----------------------------------------+
| M_CO     | mass of the carbon-oxygen core          |
+----------+-----------------------------------------+
| M_si     | mass of the silicon core                |
+----------+-----------------------------------------+
| M_fe     | mass of the iron core                   |
+----------+-----------------------------------------+
| M_rem    | mass of the remnant star post-supernova |
+----------+-----------------------------------------+


The following keywords can also be used:

+------------------+------------------+
| Keyword Argument | Default Value    |
+==================+==================+
| abund            | "iso_massf"      |
+------------------+------------------+
| isoa             | "A"              |
+------------------+------------------+
| isom             | "isomeric_state" |
+------------------+------------------+
| isoz             | "Z"              |
+------------------+------------------+
| mass             | "mass"           |
+------------------+------------------+
| core_opt         | 1                |
+------------------+------------------+

All arguments change the name of fields used to read data from
HDF5 files, other than core_opt.  core_opt controls which
scheme to use for calculating the core masses.

    If core_opt is 0, then cores uses alpha-isotopes to
    calculate the silicon and iron cores.  Use this for stellar
    evolution output.

        Si_core = Si28+S32+Ar36+Ca40+Ti44

        Fe_core = Cr48+Fe52+Ni56

    If core_opt is 1, then cores uses all elements in a network
    with proton number Z=23 as a boundary.  Use this for MPPNP
    output.

        Si_core = Sum of all isotopes with 14 <= Z <= 22

        Fe_core = Sum of all isotopes with 23 <= Z <= 28