# Serpent Support – pyne.serpent¶

Serpent is a continuous energy Monte Carlo reactor physics code. Pyne contains support for reading in serpents three types of output files, which are all in Matlab’s *.m format. These files are all read in as Python dictionaries and optionally written out to a corresponding *.py file.

All functionality may be found in the serpent package:

from pyne import serpent


## Serpent API¶

Creates the footer for use in the parse_dep function.

Parameters
fstr

f from parse_dep

serp2bool
True if serp2 dep file, False if serp1. Default false
Returns
footerstr

The footer to be appended to f

pyne.serpent.parse_dep(depfile, write_py=False, make_mats=True)[source]

Converts a serpent depletion *_dep.m output file to a dictionary (and optionally to a *_dep.py file).

Parameters
depfilestr or file-like object

Path to depletion file or a dep file handle.

write_pybool, optional

Flag for whether to write the dep file to an analogous python file.

make_matsbool, optional

Flag for whether or not to build Materials out of mass data and add these to the return dictionary. Materials so added have names which end in ‘_MATERIAL’.

Returns
depdict

Dictionary of the parsed depletion information. Please see the Serpent manual for a complete description of contents.

pyne.serpent.parse_det(detfile, write_py=False)[source]

Converts a serpent detector *_det.m output file to a dictionary (and optionally to a *_det.py file).

Parameters
detfilestr or file-like object

Path to detector file or a det file handle.

write_pybool, optional

Flag for whether to write the det file to an analogous python file.

Returns
detdict

Dictionary of the parsed detector. Please see the Serpent manual for a complete description of contents.

pyne.serpent.parse_res(resfile, write_py=False)[source]

Converts a serpent results *_res.m output file to a dictionary (and optionally to a *_res.py file).

Parameters
resfilestr or file-like object

Path to results file or a res file handle.

write_pybool, optional

Flag for whether to write the res file to an analogous python file.

Returns
resdict

Dictionary of the parsed results. Please see the Serpent manual for a complete description of contents.