diff --git a/cpp/measure.cpp b/cpp/measure.cpp index cb79d7a605..556af65df1 100644 --- a/cpp/measure.cpp +++ b/cpp/measure.cpp @@ -25,7 +25,7 @@ #include -#include "measure.hpp" +#include "measure.h" class CartVect { private: diff --git a/cpp/measure.hpp b/cpp/measure.h similarity index 100% rename from cpp/measure.hpp rename to cpp/measure.h diff --git a/cpp/source_sampling.cpp b/cpp/source_sampling.cpp index 2aeccc5289..591ac8caa7 100644 --- a/cpp/source_sampling.cpp +++ b/cpp/source_sampling.cpp @@ -91,15 +91,15 @@ void Sampler::get_mesh_geom_data(MBRange ves, vect_d &volumes) { MBCartVect x(coords[3], coords[4], coords[5]); MBCartVect y(coords[9], coords[10], coords[11]); MBCartVect z(coords[12], coords[13], coords[14]); - edge_vects ev = {o, x-o, y-o, z-o}; - _all_edge_vects.push_back(ev); + edge_points ep = {o, x-o, y-o, z-o}; + _all_edge_points.push_back(ep); } else if (_ve_type == MBTET) { MBCartVect o(coords[0], coords[1], coords[2]); MBCartVect x(coords[3], coords[4], coords[5]); MBCartVect y(coords[6], coords[7], coords[8]); MBCartVect z(coords[9], coords[10], coords[11]); - edge_vects ev = {o, x-o, y-o, z-o}; - _all_edge_vects.push_back(ev); + edge_points ep = {o, x-o, y-o, z-o}; + _all_edge_points.push_back(ep); } } } @@ -112,7 +112,7 @@ void Sampler::get_mesh_tag_data(MBRange ves, const vect_d volumes) { MB_TYPE_DOUBLE, src_tag); // THIS rval FAILS because we do not know number of energy groups a priori. - + // That's okay. That's what the next line is all about: _num_e_groups = get_num_groups(src_tag); vect_d pdf(_num_ves*_num_e_groups); rval = _mesh->tag_get_data(src_tag, ves, &pdf[0]); @@ -226,10 +226,10 @@ MBCartVect Sampler::get_xyz(int ve_idx, vect_d rands) { } } - return s*_all_edge_vects[ve_idx].x_vec + \ - t*_all_edge_vects[ve_idx].y_vec + \ - u*_all_edge_vects[ve_idx].z_vec + \ - _all_edge_vects[ve_idx].o_point; + return s*_all_edge_points[ve_idx].x_vec + \ + t*_all_edge_points[ve_idx].y_vec + \ + u*_all_edge_points[ve_idx].z_vec + \ + _all_edge_points[ve_idx].o_point; } double Sampler::get_e(int e_idx, double rand) { diff --git a/cpp/source_sampling.h b/cpp/source_sampling.h index 1027777f41..a25286693d 100644 --- a/cpp/source_sampling.h +++ b/cpp/source_sampling.h @@ -1,12 +1,26 @@ -#ifndef PYNE_6OR6BJURKJHHTOFWXO2VMQM5EY -#define PYNE_6OR6BJURKJHHTOFWXO2VMQM5EY /// \file source_sampling.h /// \author Elliott Biondo (biondo\@wisc.edu) /// -/// \brief The tally class and helper functions +/// \brief Mesh-based Monte Carlo source sampling. /// -/// The tally class is in essesence a structure containing attributes -/// related to tallies +/// The Sampler class is used for Monte Carlo source sampling from mesh-based +/// sources. The source density distribution and optional biased source density +/// distribution are defined on a MOAB mesh. Upon instantiation, a Sampler +/// object reads this mesh and creates an alias table for randomly sampling +/// particle birth parameters. The particle_birth member function is supplied +/// with 6 pseudo-random numbers and returns the position, energy, and weight +/// of a particle upon birth. There are three sampling modes: analog, uniform, +/// and user. In analog sampling, no source biasing is used and birth weights +/// are all 1. In uniform sampling, all phase space is sampled evenly and weights +/// are adjusted accordingly. In user mode, a user-supplied biased source +/// density distribution is used for sampling and particle weights are adjusted +/// accordingly. The biased source density distribution must have the same number +/// of energy groups as the unbiased distribution. Alternatively, it may have +/// exactly 1 energy group, in which case this value is used for all energies +/// within a particular mesh volume element. + +#ifndef PYNE_6OR6BJURKJHHTOFWXO2VMQM5EY +#define PYNE_6OR6BJURKJHHTOFWXO2VMQM5EY #include #include @@ -20,7 +34,7 @@ #include "moab/Range.hpp" #include "MBCore.hpp" -#include "measure.hpp" +#include "measure.h" #include "MBCartVect.hpp" #ifdef __cplusplus @@ -31,13 +45,7 @@ void get_e_bounds_data(std::string e_bounds_file); typedef std::vector vect_d; typedef std::string str; -struct Sample { - vect_d xyz; /// \param type - double e; - double w; -}; - -struct edge_vects { +struct edge_points { MBCartVect o_point; MBCartVect x_vec; MBCartVect y_vec; @@ -66,9 +74,9 @@ class Sampler Sampler(str filename, str src_tag_name, vect_d e_bounds, bool uniform); Sampler(str filename, str src_tag_name, vect_d e_bounds, str bias_tag_name); ~Sampler() { - delete _mesh; - delete _at; - }; + delete _mesh; + delete _at; + }; vect_d particle_birth(vect_d rands); private: @@ -84,7 +92,7 @@ class Sampler int _num_ves; MBEntityType _ve_type; int _verts_per_ve; - std::vector _all_edge_vects; + std::vector _all_edge_points; AliasTable* _at; std::vector _biased_weights; diff --git a/docs/theorymanual/source_sampling.rst b/docs/theorymanual/source_sampling.rst new file mode 100644 index 0000000000..fe87a07e7e --- /dev/null +++ b/docs/theorymanual/source_sampling.rst @@ -0,0 +1,52 @@ +.. _source_sampling: + +============================= +Source Sampling +============================= + +.. currentmodule:: pyne.source_sampling + +This page presents a detailed explanation of how :py:mod:`Source Sampling` works, including +underlying theory, any assocaited assumptions, and information about correct and +appropriate use of this physics. + + +***************************** +Descriptive Heading of Method +***************************** + +Mathematical Details, some example math syntax: + +You can use LaTeX format in rst. To do inline expressions (what $expression$ would +do in LaTeX) :math:`A\vec{x} = \vec{b}`. + +To have blocks of mathematical content, do this + +.. math:: + + A\vec{x} = \vec{b} + +Support is limited to a subset of LaTeX math by the conversion required for many output formats. + +*********** +Assumptions +*********** + +Any assumptions (explicit or implicit) about this method that would impact use, conclusions, validity, etc. + + + +********************** +Additional Information +********************** + +Details about impact of this theory on method use. + +********** +References +********** + +All of the justification for us listening to you. + + + diff --git a/pyne/cpp_source_sampling.pxd b/pyne/cpp_source_sampling.pxd index cceb9ee1be..b8b25c6671 100644 --- a/pyne/cpp_source_sampling.pxd +++ b/pyne/cpp_source_sampling.pxd @@ -51,22 +51,5 @@ cdef extern from "source_sampling.h" : -cdef extern from "source_sampling.h" : - - cdef cppclass Sample: - # constructors - Sample() except + - - # attributes - double e - double w - cpp_vector[double] xyz - - # methods - - pass - - - {'cpppxd_footer': '', 'pyx_header': '', 'pxd_header': '', 'pxd_footer': '', 'cpppxd_header': '', 'pyx_footer': ''} \ No newline at end of file diff --git a/pyne/source_sampling.pxd b/pyne/source_sampling.pxd index e276bb9cf9..e52068bc4f 100644 --- a/pyne/source_sampling.pxd +++ b/pyne/source_sampling.pxd @@ -8,9 +8,6 @@ ################################################ -cimport dtypes -cimport numpy as np -from libcpp.vector cimport vector as cpp_vector from pyne cimport cpp_source_sampling @@ -24,16 +21,6 @@ cdef class Sampler: -cdef class Sample: - cdef void * _inst - cdef public bint _free_inst - cdef public np.ndarray _xyz - pass - - - - - cdef class AliasTable: cdef void * _inst cdef public bint _free_inst diff --git a/pyne/source_sampling.pyx b/pyne/source_sampling.pyx index 8afd4d6968..1678df5441 100644 --- a/pyne/source_sampling.pyx +++ b/pyne/source_sampling.pyx @@ -11,7 +11,6 @@ cimport dtypes cimport numpy as np from libc.stdlib cimport free -from libc.stdlib cimport malloc from libcpp cimport bool as cpp_bool from libcpp.string cimport string as std_string from libcpp.vector cimport vector as cpp_vector @@ -120,118 +119,39 @@ cdef class AliasTable: -cdef class Sample: - """no docstring for {'tarbase': 'source_sampling', 'tarname': 'Sample', 'language': 'c++', 'srcname': 'Sample', 'sidecars': (), 'incfiles': ('source_sampling.h',), 'srcfiles': ('cpp/source_sampling.cpp', 'cpp/source_sampling.h')}, please file a bug report!""" - - - - # constuctors - def __cinit__(self, *args, **kwargs): - self._inst = NULL - self._free_inst = True - - # cached property defaults - self._xyz = None - - def __init__(self, ): - """Sample(self, ) - """ - self._inst = malloc(sizeof(cpp_source_sampling.Sample)) - ( self._inst)[0] = cpp_source_sampling.Sample() - - - def __dealloc__(self): - if self._free_inst and self._inst is not NULL: - free(self._inst) - - # attributes - property e: - """no docstring for e, please file a bug report!""" - def __get__(self): - return float(( self._inst).e) - - def __set__(self, value): - ( self._inst).e = value - - - property w: - """no docstring for w, please file a bug report!""" - def __get__(self): - return float(( self._inst).w) - - def __set__(self, value): - ( self._inst).w = value - - - property xyz: - """no docstring for xyz, please file a bug report!""" - def __get__(self): - cdef np.ndarray xyz_proxy - cdef np.npy_intp xyz_proxy_shape[1] - if self._xyz is None: - xyz_proxy_shape[0] = ( self._inst).xyz.size() - xyz_proxy = np.PyArray_SimpleNewFromData(1, xyz_proxy_shape, np.NPY_FLOAT64, &( self._inst).xyz[0]) - self._xyz = xyz_proxy - return self._xyz - - def __set__(self, value): - cdef cpp_vector[double] value_proxy - cdef int ivalue - cdef int value_size - cdef double * value_data - # value is a ('vector', 'float64', 0) - value_size = len(value) - if isinstance(value, np.ndarray) and ( value).descr.type_num == np.NPY_FLOAT64: - value_data = np.PyArray_DATA( value) - value_proxy = cpp_vector[double]( value_size) - for ivalue in range(value_size): - value_proxy[ivalue] = value_data[ivalue] - else: - value_proxy = cpp_vector[double]( value_size) - for ivalue in range(value_size): - value_proxy[ivalue] = value[ivalue] - ( self._inst).xyz = value_proxy - self._xyz = None - - - # methods - - - pass - - - - - cdef class Sampler: """ Attributes ---------- - e_bounds (vect_d) : - mode (Mode) : - mesh (MBInterface *) : - filename (str) : - src_tag_name (str) : - bias_tag_name (str) : - num_e_groups (int) : - ve_type (MBEntityType) : - vects (None) : - verts_per_ve (int) : - cart_sampler (std::vector< ) : - at (None) : - biased_weights (std::vector< double >) : + _e_bounds (vect_d) : + _mode (Mode) : + _mesh (MBInterface *) : + _filename (str) : + _src_tag_name (str) : + _bias_tag_name (str) : + _num_e_groups (int) : + _num_bias_groups (int) : + _num_ves (int) : + _ve_type (MBEntityType) : + _verts_per_ve (int) : + _all_edge_points (std::vector< ) : + _at (None) : + _biased_weights (std::vector< double >) : Methods ------- Sampler ~Sampler + get_bias_pdf get_e get_mesh_geom_data get_mesh_tag_data + get_num_groups get_w get_xyz + normalize_pdf particle_birth setup @@ -251,8 +171,8 @@ cdef class Sampler: # cached property defaults - def _sampler_sampler_0(self, _filename, _src_tag_name, _e_bounds, _bias_tag_name): - """Sampler(self, _filename, _src_tag_name, _e_bounds, _bias_tag_name) + def _sampler_sampler_0(self, filename, src_tag_name, e_bounds, bias_tag_name): + """Sampler(self, filename, src_tag_name, e_bounds, bias_tag_name) This method was overloaded in the C-based source. To overcome this we ill put the relevant docstring for each version below. Each version will begin with a line of # characters. @@ -292,32 +212,32 @@ cdef class Sampler: None """ - cdef char * _filename_proxy - cdef char * _src_tag_name_proxy - cdef cpp_vector[double] _e_bounds_proxy - cdef int i_e_bounds - cdef int _e_bounds_size - cdef double * _e_bounds_data - cdef char * _bias_tag_name_proxy - _filename_bytes = _filename.encode() - _src_tag_name_bytes = _src_tag_name.encode() - # _e_bounds is a ('vector', 'float64', 0) - _e_bounds_size = len(_e_bounds) - if isinstance(_e_bounds, np.ndarray) and ( _e_bounds).descr.type_num == np.NPY_FLOAT64: - _e_bounds_data = np.PyArray_DATA( _e_bounds) - _e_bounds_proxy = cpp_vector[double]( _e_bounds_size) - for i_e_bounds in range(_e_bounds_size): - _e_bounds_proxy[i_e_bounds] = _e_bounds_data[i_e_bounds] + cdef char * filename_proxy + cdef char * src_tag_name_proxy + cdef cpp_vector[double] e_bounds_proxy + cdef int ie_bounds + cdef int e_bounds_size + cdef double * e_bounds_data + cdef char * bias_tag_name_proxy + filename_bytes = filename.encode() + src_tag_name_bytes = src_tag_name.encode() + # e_bounds is a ('vector', 'float64', 0) + e_bounds_size = len(e_bounds) + if isinstance(e_bounds, np.ndarray) and ( e_bounds).descr.type_num == np.NPY_FLOAT64: + e_bounds_data = np.PyArray_DATA( e_bounds) + e_bounds_proxy = cpp_vector[double]( e_bounds_size) + for ie_bounds in range(e_bounds_size): + e_bounds_proxy[ie_bounds] = e_bounds_data[ie_bounds] else: - _e_bounds_proxy = cpp_vector[double]( _e_bounds_size) - for i_e_bounds in range(_e_bounds_size): - _e_bounds_proxy[i_e_bounds] = _e_bounds[i_e_bounds] - _bias_tag_name_bytes = _bias_tag_name.encode() - self._inst = new cpp_source_sampling.Sampler(std_string( _filename_bytes), std_string( _src_tag_name_bytes), _e_bounds_proxy, std_string( _bias_tag_name_bytes)) + e_bounds_proxy = cpp_vector[double]( e_bounds_size) + for ie_bounds in range(e_bounds_size): + e_bounds_proxy[ie_bounds] = e_bounds[ie_bounds] + bias_tag_name_bytes = bias_tag_name.encode() + self._inst = new cpp_source_sampling.Sampler(std_string( filename_bytes), std_string( src_tag_name_bytes), e_bounds_proxy, std_string( bias_tag_name_bytes)) - def _sampler_sampler_1(self, _filename, _src_tag_name, _e_bounds, _uniform): - """Sampler(self, _filename, _src_tag_name, _e_bounds, _uniform) + def _sampler_sampler_1(self, filename, src_tag_name, e_bounds, uniform): + """Sampler(self, filename, src_tag_name, e_bounds, uniform) This method was overloaded in the C-based source. To overcome this we ill put the relevant docstring for each version below. Each version will begin with a line of # characters. @@ -357,33 +277,33 @@ cdef class Sampler: None """ - cdef char * _filename_proxy - cdef char * _src_tag_name_proxy - cdef cpp_vector[double] _e_bounds_proxy - cdef int i_e_bounds - cdef int _e_bounds_size - cdef double * _e_bounds_data - _filename_bytes = _filename.encode() - _src_tag_name_bytes = _src_tag_name.encode() - # _e_bounds is a ('vector', 'float64', 0) - _e_bounds_size = len(_e_bounds) - if isinstance(_e_bounds, np.ndarray) and ( _e_bounds).descr.type_num == np.NPY_FLOAT64: - _e_bounds_data = np.PyArray_DATA( _e_bounds) - _e_bounds_proxy = cpp_vector[double]( _e_bounds_size) - for i_e_bounds in range(_e_bounds_size): - _e_bounds_proxy[i_e_bounds] = _e_bounds_data[i_e_bounds] + cdef char * filename_proxy + cdef char * src_tag_name_proxy + cdef cpp_vector[double] e_bounds_proxy + cdef int ie_bounds + cdef int e_bounds_size + cdef double * e_bounds_data + filename_bytes = filename.encode() + src_tag_name_bytes = src_tag_name.encode() + # e_bounds is a ('vector', 'float64', 0) + e_bounds_size = len(e_bounds) + if isinstance(e_bounds, np.ndarray) and ( e_bounds).descr.type_num == np.NPY_FLOAT64: + e_bounds_data = np.PyArray_DATA( e_bounds) + e_bounds_proxy = cpp_vector[double]( e_bounds_size) + for ie_bounds in range(e_bounds_size): + e_bounds_proxy[ie_bounds] = e_bounds_data[ie_bounds] else: - _e_bounds_proxy = cpp_vector[double]( _e_bounds_size) - for i_e_bounds in range(_e_bounds_size): - _e_bounds_proxy[i_e_bounds] = _e_bounds[i_e_bounds] - self._inst = new cpp_source_sampling.Sampler(std_string( _filename_bytes), std_string( _src_tag_name_bytes), _e_bounds_proxy, _uniform) + e_bounds_proxy = cpp_vector[double]( e_bounds_size) + for ie_bounds in range(e_bounds_size): + e_bounds_proxy[ie_bounds] = e_bounds[ie_bounds] + self._inst = new cpp_source_sampling.Sampler(std_string( filename_bytes), std_string( src_tag_name_bytes), e_bounds_proxy, uniform) - _sampler_sampler_0_argtypes = frozenset(((0, str), (1, str), (2, np.ndarray), (3, str), ("_filename", str), ("_src_tag_name", str), ("_e_bounds", np.ndarray), ("_bias_tag_name", str))) - _sampler_sampler_1_argtypes = frozenset(((0, str), (1, str), (2, np.ndarray), (3, bool), ("_filename", str), ("_src_tag_name", str), ("_e_bounds", np.ndarray), ("_uniform", bool))) + _sampler_sampler_0_argtypes = frozenset(((0, str), (1, str), (2, np.ndarray), (3, str), ("filename", str), ("src_tag_name", str), ("e_bounds", np.ndarray), ("bias_tag_name", str))) + _sampler_sampler_1_argtypes = frozenset(((0, str), (1, str), (2, np.ndarray), (3, bool), ("filename", str), ("src_tag_name", str), ("e_bounds", np.ndarray), ("uniform", bool))) def __init__(self, *args, **kwargs): - """Sampler(self, _filename, _src_tag_name, _e_bounds, _uniform) + """Sampler(self, filename, src_tag_name, e_bounds, uniform) This method was overloaded in the C-based source. To overcome this we ill put the relevant docstring for each version below. Each version will begin with a line of # characters. diff --git a/tests/test_source_sampling.py b/tests/test_source_sampling.py index 8a44b6351f..e04ee82755 100644 --- a/tests/test_source_sampling.py +++ b/tests/test_source_sampling.py @@ -1,10 +1,11 @@ from __future__ import print_function +import os import warnings import itertools from operator import itemgetter -from nose.tools import assert_true, assert_equal, assert_raises, with_setup, assert_almost_equal +from nose.tools import assert_equal, with_setup, assert_almost_equal from random import uniform import numpy as np @@ -21,9 +22,14 @@ from pyne.mesh import Mesh, IMeshTag from pyne.source_sampling import Sampler +def try_rm_file(filename): + return lambda: os.remove(filename) if os.path.exists(filename) else None + +@with_setup(None, try_rm_file('sampling_mesh.h5m')) def test_analog_single_hex(): - m = Mesh(structured=True, structured_coords=[[0, 1], [0, 1], [0, 1]], mats = None) + m = Mesh(structured=True, structured_coords=[[0, 1], [0, 1], [0, 1]], + mats = None) m.src = IMeshTag(1, float) m.src[0] = 1.0 m.mesh.save("sampling_mesh.h5m") @@ -36,13 +42,17 @@ def test_analog_single_hex(): for i in range(num_samples): s = sampler.particle_birth(np.array([uniform(0, 1) for x in range(6)])) assert_equal(s[4], 1.0) - tally[int(s[0]*num_divs), int(s[1]*num_divs), int(s[2]*num_divs), int(s[3]*num_divs)] += score + tally[int(s[0]*num_divs), int(s[1]*num_divs), int(s[2]*num_divs), + int(s[3]*num_divs)] += score for i in range(0, 4): for j in range(0, 2): assert(abs(np.sum(np.rollaxis(tally, i)[j,:,:,:]) - 0.5) < 0.05) +@with_setup(None, try_rm_file('sampling_mesh.h5m')) def test_analog_multiple_hex(): - m = Mesh(structured=True, structured_coords=[[0, 0.5, 1], [0, 0.5, 1], [0, 0.5, 1]], mats = None) + m = Mesh(structured=True, + structured_coords=[[0, 0.5, 1], [0, 0.5, 1], [0, 0.5, 1]], + mats = None) m.src = IMeshTag(2, float) m.src[:] = np.ones(shape=(8,2)) m.mesh.save("sampling_mesh.h5m") @@ -55,13 +65,15 @@ def test_analog_multiple_hex(): for i in range(num_samples): s = sampler.particle_birth([uniform(0, 1) for x in range(6)]) assert_equal(s[4], 1.0) - tally[int(s[0]*num_divs), int(s[1]*num_divs), int(s[2]*num_divs), int(s[3]*num_divs)] += score + tally[int(s[0]*num_divs), int(s[1]*num_divs), int(s[2]*num_divs), + int(s[3]*num_divs)] += score for i in range(0, 4): for j in range(0, 2): halfspace_sum = np.sum(np.rollaxis(tally, i)[j,:,:,:]) assert(abs(halfspace_sum - 0.5)/0.5 < 0.1) +@with_setup(None, try_rm_file('tet.h5m')) def test_analog_single_tet(): mesh = iMesh.Mesh() v1 = [0, 0, 0] @@ -96,8 +108,11 @@ def test_analog_single_tet(): for t in tally: assert(abs(t - 0.25)/0.25 < 0.2) +@with_setup(None, try_rm_file('sampling_mesh.h5m')) def test_uniform(): - m = Mesh(structured=True, structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], mats = None) + m = Mesh(structured=True, + structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], + mats = None) m.src = IMeshTag(2, float) m.src[:] = [[2.0, 3.0], [1.0, 4.0]] e_bounds = np.array([0, 0.5, 1.0]) @@ -121,7 +136,9 @@ def test_uniform(): else: assert_almost_equal(s[4], 1.6) # hand calcs - tally[int(s[0]*num_divs)/10, int(s[1]*num_divs)/10, int(s[2]*num_divs)/10] += score + tally[int(s[0]*num_divs)/10, + int(s[1]*num_divs)/10, + int(s[2]*num_divs)/10] += score for i in range(0, 3): for j in range(0, 2): @@ -129,8 +146,11 @@ def test_uniform(): assert(abs(halfspace_sum - 0.5)/0.5 < 0.1) +@with_setup(None, try_rm_file('sampling_mesh.h5m')) def test_bias(): - m = Mesh(structured=True, structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], mats = None) + m = Mesh(structured=True, + structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], + mats = None) m.src = IMeshTag(2, float) m.src[:] = [[2.0, 3.0], [1.0, 4.0]] e_bounds = np.array([0, 0.5, 1.0]) @@ -164,8 +184,11 @@ def test_bias(): for a, b in zip(tally, expected_tally): assert(abs(a-b)/b < 0.25) +@with_setup(None, try_rm_file('sampling_mesh.h5m')) def test_bias_spacial(): - m = Mesh(structured=True, structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], mats = None) + m = Mesh(structured=True, + structured_coords=[[0, 2.5, 10], [0, 10], [0, 10]], + mats = None) m.src = IMeshTag(2, float) m.src[:] = [[2.0, 3.0], [1.0, 4.0]] m.bias = IMeshTag(2, float) @@ -191,7 +214,9 @@ def test_bias_spacial(): else: assert_almost_equal(s[4], 1.6) # hand calcs - tally[int(s[0]*num_divs)/10, int(s[1]*num_divs)/10, int(s[2]*num_divs)/10] += score + tally[int(s[0]*num_divs)/10, + int(s[1]*num_divs)/10, + int(s[2]*num_divs)/10] += score for i in range(0, 3): for j in range(0, 2): @@ -199,7 +224,6 @@ def test_bias_spacial(): assert(abs(halfspace_sum - 0.5)/0.5 < 0.1) def point_in_tet(t, p): - matricies = [ np.array( [[t[0][0], t[0][1], t[0][2], 1], [t[1][0], t[1][1], t[1][2], 1], diff --git a/xdressrc.py b/xdressrc.py index a9c3c5b36c..5d9ab579d2 100644 --- a/xdressrc.py +++ b/xdressrc.py @@ -40,6 +40,4 @@ classes = [apiname('Tally','cpp/tally.*',incfiles='tally.h'), apiname('Sampler','cpp/source_sampling.*',incfiles='source_sampling.h'), - apiname('AliasTable','cpp/source_sampling.*',incfiles='source_sampling.h'), - apiname('Sample','cpp/source_sampling.*', incfiles='source_sampling.h')] - #apiname('sample_vects','cpp/source_sampling.h', incfiles='source_sampling.h')] + apiname('AliasTable','cpp/source_sampling.*',incfiles='source_sampling.h')]