import nose from nose.tools import assert_equal, assert_in, assert_true, assert_almost_equal import numpy as np import numpy.testing as npt from pyne.utils import QAWarning from pyne.pyne_config import pyne_conf warnings.simplefilter("ignore", QAWarning) import pyne from pyne import data, nucname from pyne import utils if utils.use_warnings(): utils.toggle_warnings() def test_atomic_mass(): # set the datapath to nonsense so we call the cpp data version orig = pyne_conf.NUC_DATA_PATH pyne_conf.NUC_DATA_PATH = b"bobbobhonkeytonk" o16 = [15.9949146196, 16.0] u235 = [235.04392819, 235.0] am242m = [242.059547428, 242.0] # zzaam form assert_in(data.atomic_mass(80160), o16) assert_in(data.atomic_mass(922350), u235) assert_in(data.atomic_mass(952421), am242m) pyne_conf.NUC_DATA_PATH = orig
def test_toggle_warnings(): state = utils.use_warnings() observed = utils.toggle_warnings() assert_equal(state, not observed)
# PYTHON_ARGCOMPLETE_OK import argparse import os from subprocess import run import logging from itertools import combinations import numpy as np from scipy.sparse import csr_matrix from scipy.sparse.linalg import use_solver import tables from pyne.utils import toggle_warnings import warnings toggle_warnings() warnings.simplefilter('ignore') import pyne.data import pyne.material from pyne.origen22 import (nlbs, write_tape5_irradiation, write_tape4, parse_tape9, merge_tape9, write_tape9, parse_tape6) from pyne.material import from_atom_frac from .util import load_sparse_csr, time_func from .tape9utils import origen_to_name from .codegen import CRAM_matrix_exp_lambdify logger = logging.getLogger(__name__) logger.addHandler(logging.StreamHandler()) # Change to WARN for less output
#! /usr/bin/env python """This file generates a static C++ decayer function for use with PyNE. It is suppossed to be fast. """ import io import warnings from argparse import ArgumentParser, Namespace import numpy as np warnings.simplefilter('ignore', RuntimeWarning) import tables as tb import jinja2 from pyne.utils import QAWarning, toggle_warnings warnings.simplefilter('ignore', QAWarning) toggle_warnings() from pyne import nuc_data from pyne import nucname from pyne.data import branch_ratio, half_life, decay_const, \ all_children, fpyield, all_branch_ratio ENV = jinja2.Environment(undefined=jinja2.StrictUndefined) autogenwarn = """ // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // WARNING // This file has been auto generated // Do not modify directly. You have // been warned. This is that warning // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
import nose from nose.tools import assert_equal, assert_in, assert_true import numpy as np import numpy.testing as npt from pyne.utils import QAWarning warnings.simplefilter("ignore", QAWarning) import pyne from pyne import data, nucname from pyne import utils if utils.use_warnings(): utils.toggle_warnings() # These tests require nuc_data if not os.path.isfile(pyne.nuc_data): raise RuntimeError("Tests require nuc_data.h5. Please run nuc_data_make.") def test_atomic_mass(): o16 = [15.99491461957, 16.0] u235 = [235.043930131, 235.0] am242m = [242.059549364, 242.0] # zzaam form assert_in(data.atomic_mass(80160), o16) assert_in(data.atomic_mass(922350), u235) assert_in(data.atomic_mass(952421), am242m)