Utility Functions – pyne.utils

This module holds some basic utility functions that are used throughout PyNE. You may find them useful as well!

All functionality may be found in the utils module:

from pyne import utils

Utils API

pyne.utils.failure(s)[source]

Formats a fail message for printing. If on a posix system the message will be in color.

pyne.utils.from_barns(xs, units)[source]

Converts a cross section from barns to units.

Parameters:

xs :

Cross section value in [barns].

units : str

Units flag, eg ‘b’, ‘microbarn’.

Returns:

unit_xs :

Cross section value in [units].

pyne.utils.message(s)[source]

Formats a message for printing. If on a posix system the message will be in color.

pyne.utils.remove(path)[source]

Removes a path, or recursively a directory, or does nothing if path is neither a file nor a directory.

pyne.utils.to_barns(xs, units)[source]

Converts a cross section with units to barns.

Parameters:

xs :

Cross section value in [units].

units : str

Units flag, eg ‘b’, ‘microbarn’.

Returns:

barn_xs :

Cross section value in [barns].

pyne.utils.to_sec(input_time, units)[source]

Converts a time with units to seconds.

Parameters:

input_time : number

Time value in [units].

units : str

Units flag, eg ‘min’, ‘ms’, ‘days’, or even ‘MeV’.

Returns:

sec_time : float

Time value in [sec].

pyne.utils.warning(s)[source]

Formats a warning message for printing. If on a posix system the message will be in color.