wnutils package

A package of python routines to read and plot webnucleo xml and hdf5 files.

Submodules

wnutils.base module

class wnutils.base.Base[source]

Bases: object

Class for setting wnutils parameters and utilities.

apply_class_methods(plt, keyword_params)[source]

Method to apply plot functions.

Args:

plt (matplotlib.pyplot): A pyplot plot instance.

keyword_params (dict): A dictionary of functions that will be applied to the plot. The key is the function and the value is the argument of the function.

Returns:
On successful return, the functions have been applied to the plot.
create_nuclide_name(z, a, state)[source]

Method to create the name of a nuclide.

Args:

z (int): An integer giving the nuclide’s atomic number.

a (int): An integer giving the nuclide’s mass number.

state (str): A string giving the nuclide’s state suffix.

Returns:
str: The nuclide’s name.
get_graphviz_names(nuclides)[source]

Method to get graphviz strings of nuclides’ names.

Args:
nuclides (list): A list of strings giving the nuclides.
Returns:
dict: A dictionary of graphviz strings.
get_latex_names(nuclides)[source]

Method to get latex strings of nuclides’ names.

Args:
nuclides (list): A list of strings giving the nuclides.
Returns:
dict: A dictionary of latex strings.
get_z_a_state_from_nuclide_name(name)[source]

Method to get the Z, A, and state from the name of a nuclide.

Args:
name (str): The nuclide’s name.
Returns:
A tuple containing the Z, A, and state label corresponding to the name.
is_non_nuclide_reaction_element_string(name)[source]

Method to check if a string is that of a non-nuclide reaction element.

Args:
name (str): A string giving the possible non-nuclide reaction element.
Returns:
bool: A boolean with value True if the string is that of a non-nuclide reaction element and False if not.
list_rcParams()[source]

Method to list default rcParams.

Returns:
Prints the default matplotlib.rcParams.
make_time_t9_rho_title_str(props, i)[source]

Method to create a default title string.

Args:

props (dict): A dictionary of float. The dictionary must contain entries that are numpy.array objects containing time, the time in seconds, t9, the temperature in billions of Kelvins, and rho, the mass density in grams per cubic centimeter.

i (int): An integer giving the location in the arrays of the properties to use to construct the string.

Returns:
str: The default title string.
make_time_title_str(time)[source]

Method to create a default title string.

Args:

props (dict): A dictionary of float. The dictionary must contain at least one numpy.array object containing time, the time in seconds.

time (int): A float giving the time to use to construct the string.

Returns:
str: The default title string.
set_plot_params(my_mpl, my_params)[source]

Method to set plot parameters.

Args:

my_mpl (matplotlib): A matplotlib instance.

my_params (dict): A dictionary with rcParams to be applied.

Returns:
On successful return, the matplotlib.rcParams have first been set to their defaults and then updated with the values in my_params.
show_or_close(plt, kwargs)[source]

Method to show or close plot.

Args:

plt (matplotlib.pyplot): A pyplot plot instance.

keyword_params (dict): A dictionary of functions that will be applied to the plot. The key is the function and the value is the argument of the function.

Returns:
On successful return, the plot has been shown or closed.

wnutils.h5 module

class wnutils.h5.H5(file)[source]

Bases: wnutils.base.Base

A class for reading and plotting webnucleo HDF5 files.

Each instance corresponds to an hdf5 file. Methods extract data and plot data from the file.

Args:
file (str): The name of the hdf5 file.
get_group_mass_fractions(group)[source]

Method to return mass fractions from a group in an hdf5 file.

Args:
group (str): The name of the group.
Returns:
A 2d hdf5 dataset. The first index indicates the zone and the second the species.
get_group_properties_in_zones(group, properties)[source]

Method to return properties in all zones for a group.

Args:

group (str): A string giving the group name.

properties (list): A list of strings or tuples of up to three strings giving the properties to be retrieved.

Returns:
dict: A dictionary of list giving the properties in the zones as strings.
get_group_properties_in_zones_as_floats(group, properties)[source]

Method to return properties in all zones for a group as floats.

Args:

group (str): A string giving the group name.

properties (list): A list of strings or tuples of up to three strings giving the properties to be retrieved.

Returns:
dict: A dictionary of numpy.array giving the properties in the zones as floats.
get_group_zone_properties(group, zone)[source]

Method to return all properties in a zone in a group.

Args:

group (str): A string giving the group name.

zone (tuple): A three element tuple giving the three labels for the zone.

Returns:
dict: A dictionary of strings giving all the properties in the zone in the group.
get_iterable_groups()[source]

Method to return the non-nuclide data groups in an hdf5 file.

Returns:
list: A list of strings giving the names of the groups.
get_nuclide_data()[source]

Method to return nuclide data from an hdf5 file.

Returns:

dict: A dictionary of the nuclide data. Each entry is itself a dictionary containing the nuclide’s index, name, z, a, source (data source), state, spin, and mass excess.
get_zone_labels_for_group(group)[source]

Method to return zone labels for a group in a webnucleo hdf5 file.

Args:
group (str): The name of the group.
Returns:
list: A list of tuple giving the labels for the zones in a group.
get_zone_mass_fractions_in_groups(zone, species)[source]

Method to return zone mass fractions in all groups.

Args:

zone (tuple): A three element tuple giving the three labels for the zone.

species (list): A list of strings giving the species whose mass fractions are to be retrieved.

Returns:
dict: A dictionary of numpy.array giving the mass fractions in the groups.
get_zone_properties_in_groups(zone, properties)[source]

Method to return zone properties in all groups.

Args:

zone (tuple): A three element tuple giving the three labels for the zone.

properties (list): A list of strings or tuples of up to three strings giving the properties to be retrieved.

Returns:
dict: A dictionary of list giving the properties in the groups as strings.
get_zone_properties_in_groups_as_floats(zone, properties)[source]

Method to return zone properties in all groups as floats.

Args:

zone (tuple): A three element tuple giving the three labels for the zone.

properties (list): A list of strings or tuples of up to three strings giving the properties to be retrieved.

Returns:
dict: A dictionary of numpy.array giving the properties in the groups as floats.
make_mass_fractions_movie(species, movie_name='', property=None, fps=15, xfactor=1, use_latex_names=False, title_func=None, rcParams=None, plotParams=None, **kwargs)[source]

Method to make a movie of mass fractions in the zones.

Args:

species (list): A list of the species to include in the movie.

movie_name (str): A string giving the name of the resultin movie file.

property (str, optional): A string giving property to be the x axis. Defaults to zone index.

fps (float, optional): A float giving the frames per second in the resulting movie.

xfactor (float, optional): A float giving the scaling of the x axis.

use_latex_names (bool, optional): If set to True, species names converted to latex format.

title_func (optional): A function that applies the title to each frame of the movie. The function must take a single argument, an int giving the index of the frame to which the title will be applied. Other data can be bound to the function. The function must return either a str giving the title or a two-element tuple in which the first element is a string giving the title and the second element is a dict with optional matplotlib.pyplot.title keyword arguments. The default is a title giving the time in seconds.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the movie. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the lines in the movie.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
The animation.
plot_group_mass_fractions(group, species, use_latex_names=False, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot group mass fractions vs. zone.

Args:

group (str): A string giving the group.

species (list): A list of strings giving the species to plot.

use_latex_names (bool, optional): If set to True, species names converted to latex format.

rcParams` (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as species.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_group_mass_fractions_vs_property(group, prop, species, xfactor=1, use_latex_names=False, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot group mass fractions vs. zone property.

Args:

group (str): A string giving the group.

prop (str or tuple): A string or tuple of up to three strings giving the property (which will serve as the plot abscissa).

species (list): A list of strings giving the species to plot.

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

use_latex_names (bool, optional): If set to True, species names converted to latex format.

rcParams` (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as species.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_group_properties_vs_property(group, prop, props, xfactor=1, yfactor=None, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot group mass fractions vs. zone property.

Args:

group (str): A string giving the group.

prop (str or tuple): A string or tuple of up to three strings giving the property (which will serve as the plot abscissa).

props (list): A list of strings or tuples of up to three strings giving the properties (which will serve as the plot ordinates).

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (float, optional): A list of floats giving the scaling for the ordinate values. Defaults to 1.

rcParams` (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as species.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_group_property_in_zones(group, property, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a group property vs. zone.

Args:

group (str): A string giving the group.

property (str or tuple): A string or tuple of up to three strings giving the group.

rcParams` (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (dict, optional): A dictionary of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_zone_mass_fractions_vs_property(zone, prop, species, xfactor=1, yfactor=None, use_latex_names=False, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot zone mass fractions vs. zone property.

Args:

zone (tuple): A three element tuple giving the zone.

prop (str or tuple): A string or tuple of up to three strings giving the property (which will serve as the plot abscissa).

species (list): A list of strings giving the species to plot.

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (list, optional): A list of floats giving factor by which to scale the mass fractions. Defaults to not scaling. If supplied, must by the same length as species.

use_latex_names (bool, optional): If set to True, species names converted to latex format.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (dict, optional): A dictionary of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_zone_property_vs_property(zone, prop1, prop2, xfactor=1, yfactor=1, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a property vs. a property in a zone.

Args:

zone (tuple): A three element tuple giving the zone labels.

prop1 (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

prop2 (str or tuple): A string or tuple of up to three strings giving the property (which will be the ordinate of the plot).

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (float, optional): A float giving the scaling for the ordinate values. Defaults to 1.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (dict, optional): A dictionary of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
class wnutils.h5.New_H5(file, nucs)[source]

Bases: wnutils.base.Base

A class for creating webnucleo hdf5 files.

Each instance corresponds to new hdf5. Main method sets group data.

Args:

file (str): A string giving the name of the new h5py file.

nucs (dict): A dictionary of nuclide data.

add_group(group, zones)[source]

Method to add a group to an hdf5 file.

Args:

group (str): A string giving the group name.

zones (dict): A dictionary of zone data for the group.

Returns:
On successful return, the group has been added to the hdf5 file.

wnutils.multi_h5 module

class wnutils.multi_h5.Multi_H5(files)[source]

Bases: wnutils.base.Base

A class for reading and plotting webnucleo multiple HDF5 files.

Each instance corresponds to a set of HDF5 files. Methods plot data from the files.

Args:
files (list): The names of the HDF5 files.
get_files()[source]

Method to return the names of the input files.

Returns:
list: A list of str giving the files
get_h5()[source]

Method to return individual H5 instances.

Returns:
list: A list of individual wnutils.h5.H5 instances.
plot_zone_mass_fraction_vs_property(zone, prop, species, xfactor=1, use_latex_names=False, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a mass fraction versus a property.

Args:

zone (tuple): A three-element tuple giving the three str labels of the zone.

prop (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

species (str): A string giving the species.

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

use_latex_names (bool, optional): If set to True, converts species labels to latex format.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements number of files in the class instance.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:

A matplotlib plot.
plot_zone_property_vs_property(zone, prop1, prop2, xfactor=1, yfactor=1, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a property vs. a property in the files.

Args:

zone (tuple): A three-element tuple giving the three str labels of the zone.

prop1 (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

prop2 (str or tuple): A string or tuple of up to three strings giving the property (which will be the ordinate of the plot).

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (float, optional): A float giving the scaling for the ordinate values. Defaults to 1.

rcParams (dict, optional): A dictionary of : obj: matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements number of files in the class instance.

**kwargs: Acceptable: obj: matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.

wnutils.multi_xml module

class wnutils.multi_xml.Multi_Xml(files)[source]

Bases: wnutils.base.Base

A class for reading and plotting webnucleo multiple xml files.

Each instance corresponds to a set of xml files. Methods plot data from the files.

Args:
files (list): The names of the xml files.
get_files()[source]

Method to return the names of the input files.

Returns:
list: A list of str giving the files
get_xml()[source]

Method to return individual Xml instances.

Returns:
list: A list of individual wnutils.xml.Xml instances.
plot_mass_fraction_vs_property(prop, species, xfactor=1, use_latex_names=False, labels=None, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a mass fraction versus a property.

Args:

prop (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

species (str): A string orgiving the species.

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

use_latex_names (bool, optional): If set to True, converts species labels to latex format.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as the number of files in the class instance.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:

A matplotlib plot.
plot_property_vs_property(prop1, prop2, xfactor=1, yfactor=1, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a property vs. a property in the files.

Args:

prop1 (str or tuple): A string or tuple of up to three strings giving the property(which will be the abscissa of the plot).

prop2 (str or tuple): A string or tuple of up to three strings giving the property(which will be the ordinate of the plot).

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (float, optional): A float giving the scaling for the ordinate values. Defaults to 1.

rcParams (dict, optional): A dictionary of : obj: matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as the number of files in the class instance.

**kwargs: Acceptable: obj: matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.

wnutils.xml module

class wnutils.xml.New_Xml(xml_type='nuclear_network')[source]

Bases: wnutils.base.Base

A class for creating webnucleo xml files.

Each instance corresponds to new xml. Methods set the nuclide, reaction, or zone data or write the xml to a file.

Args:
xml_type (str, optional): The type of xml file to be created (“nuclear_data”, “reaction_data”, “nuclear_network”, “zone_data”, or “libnucnet_input”). Defaults to “nuclear_network”.
set_nuclide_data(nuclides)[source]

Method to set the nuclide data.

Args:

nuclides (dict): A dictionary containing the nuclides to be created and their data.
Returns:
On successful return, the underlying xml has been created with the data in nuclides.
set_reaction_data(reactions)[source]

Method to set the reaction data.

Args:

reactions (dict): A dictionary containing the reactions to be set and their data.
Returns:
On successful return, the underlying xml has been created with the data in reactions.
set_zone_data(zones)[source]

Method to set the zone data.

Args:

zones (dict): A dictionary containing the zones to be set and their data.
Returns:
On successful return, the underlying xml has been created with the data in reactions.
write(file, pretty_print=True)[source]

Method to write the xml to a file.

Args:

file (str): A string giving the name of output xml file.

pretty_print (bool, optional): If set to True, routine outputs the xml in nice indented format.

Returns:
On successful return, the underlying xml has been written to file.
class wnutils.xml.Reaction[source]

Bases: wnutils.base.Base

A class for storing and retrieving data about reactions.

compute_rate(t9, user_funcs=' ')[source]

Method to compute rate for a reaction at input t9.

Args:

t9 (float): The temperature in billions of K giving the rate for the reaction.

user_funcs (dict, optional): A dictionary of user-defined functions associated with a user_rate key.

Returns:
float: The computed rate.
get_data()[source]

Method to return the data for a reaction.

Returns:
dict: A dictionary containing the rate data for the reaction.
get_latex_string()[source]

Method to return the latex string for a reaction.

Returns:
str: The reaction string.
get_string()[source]

Method to return the string for a reaction.

Returns:
str: The reaction string.
class wnutils.xml.Xml(file)[source]

Bases: wnutils.base.Base

A class for reading and plotting webnucleo xml files.

Each instance corresponds to an xml file. Methods extract data and plot data from the file.

Args:
file (str): The name of the xml file.
get_abundances_vs_nucleon_number(nucleon='a', zone_xpath=' ')[source]

Method to retrieve abundances summed over nucleon number in zones.

Args:

nucleon (str): String giving the nucleon number to sum over. Must be ‘z’, ‘n’, or ‘a’. Defaults to ‘a’.

zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.

Returns:
numpy.array: A two-dimensional array in which the first index gives the zone and the second gives the nucleon number value.
get_all_abundances_in_zones(zone_xpath=' ')[source]

Method to retrieve all abundances in zones.

Args:
zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.
Returns:
numpy.array: A three-dimensional array in which the first index gives the zone, the second gives the atomic number, and the third gives the neutron number. The array value is the abundance in the zone given by the first index of the species with atomic number and neutron number given by the second and third indices, respectively. The abundance of the species is the sum of the abundances of all states of that species.
get_all_properties_for_zone(zone_xpath)[source]

Method to retrieve all properties in a zone in an xml file

Args:
zone_xpath (str): XPath expression to select zone. Must evaluate to a single zone.
Returns:
dict: A dictionary containing all the properties in the zone as strings.
get_chain_abundances(nucleon, zone_xpath='', vs_A=False)[source]

Method to retrieve the abundances in a chain (fixed Z or N).

Args:

nucleon (tuple, optional): A tuple giving the nucleon. The first entry must be the nucleon type (must be ‘z’ or ‘n’) while the second entry must be the value.

zone_xpath (str, optional): A string giving the XPath expression to select the zones. Defaults to all zones.

vs_A (bool, optional): A boolean to select whether abscissa data should be mass number.

Returns:
A tuple containing an array of the nucleon values as the first element and a two-d numpy.array as the second element. The first index of the two-d array indicates the step and the second the abundance of the species with the corresponding nucleon number in the first element with the same index.
get_mass_fractions(species, zone_xpath=' ')[source]

Method to retrieve mass fractions of nuclides in specified zones.

Args:

species (list): List of strings giving the species to retrieve.

zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.

Returns:
dict: A dictionary of numpy.array containing the mass fractions of the requested species in the zones as floats.
get_network_limits(nuc_xpath=' ')[source]

Method to retrieve the network limits from the nuclide data.

Args:
nuc_xpath (str, optional): XPath expression to select the nuclides. Defaults to all nuclides.
Returns:
dict: A dictionary of numpy.array containing the network limits. The array with key z gives the atomic values. The array with key n_min gives the lowest neutron number present for the corresponding atomic number. The array with key n_max gives the highest neutron number present for the corresponding atomic number.
get_nuclide_data(nuc_xpath=' ')[source]

Method to retrieve nuclear data from webnucleo XML.

Args:
nuc_xpath (str, optional): XPath expression to select nuclides. Defaults to all nuclides.
Returns:
dict: A dictionary of nuclide data. The data for each nuclide are themselves contained in a dict.
get_properties(properties, zone_xpath=' ')[source]

Method to retrieve properties in specified zones in an xml file

Args:

properties (list): List of strings or tuples (each of up to three strings) giving requested properites.

zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.

Returns:
dict: A dictionary of lists containing the properties in the zones as strings.
get_properties_as_floats(properties, zone_xpath=' ')[source]

Method to retrieve properties in zones in an xml file as floats.

Args:

properties (list): List of strings or tuples (each of up to three strings) giving requested properites.

zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.

Returns:
dict: A dictionary of numpy.array containing the properties in the zones as floats.
get_reaction_data(reac_xpath=' ')[source]

Method to retrieve reaction data from webnucleo XML.

Args:
reac_xpath (str, optional): XPath expression to select reactions. Defaults to all reactions.
Returns:
dict: A dictionary of reaction data. The data for each reaction are themselves contained in a Reaction.
get_type()[source]

Method to retrieve the root type of the webnucleo XML.

Returns:
str: One of nuclear_data, reaction_data, nuclear_network, zone_data, libnucnet_input indicating the root type of the XML.
get_zone_data(zone_xpath='')[source]

Method to retrieve zone data from webnucleo XML.

Args:
zone_xpath (str, optional): XPath expression to select zones. Defaults to all zones.
Returns:
dict: A dictionary of zone data. The data for each zone are themselves two dict, one containing properties and one containing mass fractions.
make_abundance_chain_movie(movie_name=None, nucleon=('z', 26), zone_xpath='', plot_vs_A=False, fps=15, title_func=None, rcParams=None, plotParams=None, extraFixedCurves=None, extraCurves=None, **kwargs)[source]

Method to make of movie of abundances in a chain (fixed Z or N).

Args:

movie_name (str, optional): A string giving the name of resulting movie file.

nucleon (tuple, optional): A tuple giving the nucleon. The first entry must be the nucleon type (must be ‘z’ or ‘n’) while the second entry must be the value.

zone_xpath (str, optional): A string giving the XPath expression to select the zones. Defaults to all zones.

plot_vs_A (bool, optional): A boolean to select whether abscissa should be mass number.

fps (float, optional): A float giving the frames per second in the resulting movie.

title_func (optional): A function that applies the title to each frame of the movie. The function must take a single argument, an int giving the index of the frame to which the title will be applied. Other data can be bound to the function. The function must return either a str giving the title or a two-element tuple in which the first element is a string giving the title and the second element is a dict with optional matplotlib.pyplot.title keyword arguments. The default is a title giving the time in seconds, the temperature in billions of Kelvins, and the mass density in grams / cc.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the movie. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the lines in the movie.

extraFixedCurves (list, optional): A list of tuple objects giving fixed curves to appear on each frame of the animation. The first element of the tuple is a list giving the abscissa values for the curve, the second element is the ordinate values for the curve, and the third element, if present, is a dict of matplotlib.pyplot.plot optional keyword arguments to be applied to the extra fixed curves in the movie.

extraCurves (list, optional): A list of tuple objects giving curves to appear on each frame of the animation. The first element of the tuple is a list giving the abscissa values for the curve, the second element is a two-d numpy.array giving the ordinate values for the curve corresponding to each timestep in the animation, and the third element, if present, is a dict of matplotlib.pyplot.plot optional keyword arguments to be applied to the extra fixed curves in the movie.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
The animation.
make_abundances_vs_nucleon_number_movie(movie_name='', nucleon='a', zone_xpath='', fps=15, title_func=None, rcParams=None, plotParams=None, extraFixedCurves=None, extraCurves=None, **kwargs)[source]

Method to make of movie of abundances summed by nucleon number.

Args:

movie_name (str, optional): A string giving the name of resulting movie file.

nucleon (str, optional): A string giving the nucleon (must be ‘z’, ‘n’, or ‘a’). Defaults to ‘a’.

zone_xpath (str, optional): A string giving the XPath expression to select the zones. Defaults to all zones.

fps (float, optional): A float giving the frames per second in the resulting movie file.

title_func (optional): A function that applies the title to each frame of the movie. The function must take a single argument, an int giving the index of the frame to which the title will be applied. Other data can be bound to the function. The function must return either a str giving the title or a two-element tuple in which the first element is a string giving the title and the second element is a dict with optional matplotlib.pyplot.title keyword arguments. The default is a title giving the time in seconds, the temperature in billions of Kelvins, and the mass density in grams / cc.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the movie. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the lines in the movie.

extraFixedCurves (list, optional): A list of tuple objects giving fixed curves to appear on each frame of the animation. The first element of the tuple is a list giving the abscissa values for the curve, the second element is the ordinate values for the curve, and the third element, if present, is a dict of matplotlib.pyplot.plot optional keyword arguments to be applied to the extra fixed curves in the movie.

extraCurves (list, optional): A list of tuple objects giving curves to appear on each frame of the animation. The first element of the tuple is a list giving the abscissa values for the curve, the second element is a two-d numpy.array giving the ordinate values for the curve corresponding to each timestep in the animation, and the third element, if present, is a dict of matplotlib.pyplot.plot optional keyword arguments to be applied to the extra fixed curves in the movie.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
The animation.
make_network_abundances_movie(movie_name='', zone_xpath='', fps=15, title_func=None, rcParams=None, imParams={}, show_limits=True, plotParams={'color': 'black'}, **kwargs)[source]

Method to make of movie of network abundances.

Args:

movie_name (str, optional): A string giving the name of resulting movie file.

zone_xpath (str, optional): A string giving the XPath expression to select the zones. Defaults to all zones.

fps (float, optional): A float giving the frames per second in the resulting movie file.

title_func (optional): A function that applies the title to each frame of the movie. The function must take a single argument, an int giving the index of the frame to which the title will be applied. Other data can be bound to the function. The function must return either a str giving the title or a two-element tuple in which the first element is a string giving the title and the second element is a dict with optional matplotlib.pyplot.title keyword arguments. The default is a title giving the time in seconds, the temperature in billions of Kelvins, and the mass density in grams / cc.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the movie. Defaults to the default rcParams.

imParams (dict, optional): A dictionary of matplotlib.pyplot.imshow options to be applied to the movie. The default is equivalent to calling with imParams={‘origin’:’lower’, ‘cmap’: cm.BuPu, ‘norm’: LogNorm(), ‘vmin’: 1.e-10, ‘vmax’: 1}. cm in this call is the matplotlib.cm namespace. Any or all of these options can be overridden or others added by setting any of them in the input dict.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the network limits. Defaults are shown in the usage statement.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
The animation.
plot_abundances_vs_nucleon_number(nucleon='a', zone_xpath='[last()]', rcParams=None, plotParams=None, **kwargs)[source]

Method to plot abundances summed by nucleon number.

Args:

nucleon (str, optional): A string giving the nucleon (must be ‘z’, ‘n’, or ‘a’). Defaults to ‘a’.

zone_xpath (str, optional): A string giving the XPath expression to select the zones. Defaults to the last zone.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as the number as zones selected by the zone XPath.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
plot_mass_fractions_vs_property(prop, species, xfactor=1, use_latex_names=False, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot the mass fractions versus a property.

Args:

prop (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

specieslist): A list of strings giving the species.

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

use_latex_names (bool, optional): If set to True, converts species labels to latex format.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (list, optional): A list of dictionaries of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot. The list must have the same number of elements as species.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:

A matplotlib plot.
plot_property_vs_property(prop1, prop2, xfactor=1, yfactor=1, rcParams=None, plotParams=None, **kwargs)[source]

Method to plot a property vs. a property.

Args:

prop1 (str or tuple): A string or tuple of up to three strings giving the property (which will be the abscissa of the plot).

prop2 (str or tuple): A string or tuple of up to three strings giving the property (which will be the ordinate of the plot).

xfactor (float, optional): A float giving the scaling for the abscissa values. Defaults to 1.

yfactor (float, optional): A float giving the scaling for the ordinate values. Defaults to 1.

rcParams (dict, optional): A dictionary of matplotlib.rcParams to be applied to the plot. Defaults to the default rcParams.

plotParams (dict, optional): A dictionary of valid matplotlib.pyplot.plot optional keyword arguments to be applied to the plot.

**kwargs: Acceptable matplotlib.pyplot functions. Include directly, as a dict, or both.

Returns:
A matplotlib plot.
wnutils.xml.validate(file)[source]

Method to validate input Webnucleo XML.

Args:
file (str): The name of the xml file to validate.
Returns:
An error message if invalid and nothing if valid.