GeezerVison is showing github.com — fixed develop merge conflicts · walshjon/pyne@2a8e78a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: docs/index.rst +1-2Lines changed: 1 addition & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -10,7 +10,6 @@ PyNE - The Nuclear Engineering Toolkit | 10 | 10 |
| 11 | 11 | .. image:: gallery/data_sources_thumb.png | 12 | 12 | .. image:: gallery/fng_model_thumb.png | 13 | | - .. image:: gallery/discretized_teapot_thumb.png | 14 | 13 | .. image:: gallery/ace_thumb.png | 15 | 14 |
| 16 | 15 | .. raw:: html | @@ -65,7 +64,7 @@ bindings and I/O support for other industry standard nuclear codes. | 65 | 64 | <div id="usingContent" style="display:none;"> | 66 | 65 | <ul> | 67 | 66 | <li><a href="usersguide/index.html">User's Guide</a></li> | 68 | | - <li><a href="pyapi/index.html}}">Python API Documentation</a></li> | | 67 | + <li><a href="pyapi/index.html">Python API Documentation</a></li> | 69 | 68 | <li><a href="cppapi/index.html">C++ & Fortran API Documentation</a></li> | 70 | 69 | < li>< a href= "mailto:[email protected]?subject=Subscribe&body=Send this message to subscribe to the list">Join</ a> the < a href= "https://groups.google.com/forum/#!forum/pyne-users" target= "_blank"> Users</ a> mailing list. | 71 | 70 | <li><a href="https://github.com/pyne/pyne/issues">Report an Issue</a></li> | |
Collapse file Copy file name to clipboardExpand all lines: pyne/cpp_material.pxd +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -65,6 +65,7 @@ cdef extern from "material.h" namespace "pyne": | 65 | 65 |
| 66 | 66 | void normalize() except + | 67 | 67 | map[int, double] mult_by_mass() except + | | 68 | + map[int, double] activity() except + | 68 | 69 | double molecular_mass() except + | 69 | 70 | double molecular_mass(double) except + | 70 | 71 | Material expand_elements() except + | |
Collapse file Copy file name to clipboardExpand all lines: pyne/material.pyx +16-1Lines changed: 16 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -572,7 +572,7 @@ cdef class _Material: | 572 | 572 |
| 573 | 573 |
| 574 | 574 | def mult_by_mass(self): | 575 | | - """This multiplies multiplies comp by mass and returns the resultant | | 575 | + """This multiplies comp by mass and returns the resultant | 576 | 576 | nuctopic vector. | 577 | 577 |
| 578 | 578 | Returns | @@ -589,6 +589,21 @@ cdef class _Material: | 589 | 589 | return nucvec_proxy | 590 | 590 |
| 591 | 591 |
| | 592 | + def activity(self): | | 593 | + """This provides the activity of the comp of the material. | | 594 | +
| | 595 | + Returns | | 596 | + ------- | | 597 | + nucvec : dict | | 598 | + For a Material mat | | 599 | +
| | 600 | + """ | | 601 | + cdef conv._MapIntDouble nucvec_proxy = conv.MapIntDouble() | | 602 | + nucvec_proxy.map_ptr = new cpp_map[int, double]( | | 603 | + self.mat_pointer.activity()) | | 604 | + return nucvec_proxy | | 605 | + | | 606 | + | 592 | 607 | def molecular_mass(self, atoms_per_molecule=-1.0): | 593 | 608 | """molecular_mass(atoms_per_molecule=-1.0) | 594 | 609 | This method returns the molecular mass of the comp of this | |
Collapse file Copy file name to clipboardExpand all lines: src/material.cpp +13-2Lines changed: 13 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 |
| 10 | 10 | #ifndef PYNE_IS_AMALGAMATED | 11 | 11 | #include "material.h" | 12 | | -#include "nucname.h" | 13 | | -#include "decay.h" | 14 | 12 | #endif | 15 | 13 |
| 16 | 14 | // h5wrap template | @@ -1092,6 +1090,19 @@ pyne::comp_map pyne::Material::mult_by_mass() { | 1092 | 1090 |
| 1093 | 1091 |
| 1094 | 1092 |
| | 1093 | +pyne::comp_map pyne::Material::activity() { | | 1094 | + using pyne::decay_const; | | 1095 | + using pyne::atomic_mass; | | 1096 | + pyne::comp_map act; | | 1097 | + double masspermole = mass * pyne::N_A; | | 1098 | + for (pyne::comp_iter i = comp.begin(); i != comp.end(); ++i) { | | 1099 | + act[i->first] = masspermole * (i->second) * decay_const(i->first) / atomic_mass(i->first); | | 1100 | + } | | 1101 | + return act; | | 1102 | +} | | 1103 | + | | 1104 | + | | 1105 | + | 1095 | 1106 | double pyne::Material::molecular_mass(double apm) { | 1096 | 1107 | // Calculate the atomic weight of the Material | 1097 | 1108 | double inverseA = 0.0; | |
Collapse file Copy file name to clipboardExpand all lines: src/material.h +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 28 | 28 | #include "utils.h" | 29 | 29 | #include "nucname.h" | 30 | 30 | #include "data.h" | | 31 | +#include "decay.h" | 31 | 32 | #endif | 32 | 33 |
| 33 | 34 | namespace pyne | @@ -219,6 +220,9 @@ namespace pyne | 219 | 220 | /// used (and stored on the instance) as the atoms_per_molecule for this calculation. | 220 | 221 | /// If \a apm and atoms_per_molecule on this instance are both negative, then the best | 221 | 222 | /// guess value calculated from the normailized composition is used here. | | 223 | + comp_map activity(); | | 224 | + /// Calculates the activity of a material based on the composition and each | | 225 | + /// nuclide's mass, decay_const, and atmoic_mass. | 222 | 226 | double molecular_mass(double apm=-1.0); | 223 | 227 | /// Returns a copy of the current material where all natural elements in the | 224 | 228 | /// composition are expanded to their natural isotopic abundances. | |
Collapse file Copy file name to clipboardExpand all lines: tests/test_material.py +8Lines changed: 8 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -201,6 +201,14 @@ def test_mult_by_mass(self): | 201 | 201 | assert_equal(nucvec, {922350000: 0.75, 922380000: 14.25}) | 202 | 202 |
| 203 | 203 |
| | 204 | + def test_activity(self): | | 205 | + mat = Material({922350000: 0.05, 922380000: 0.95}, 15) | | 206 | + obs = mat.activity() | | 207 | + exp = {922350000: 59953.15101810882, 922380000: 177216.65112976026} | | 208 | + assert_equal(set(obs), set(exp)) | | 209 | + assert_equal(set(obs.values()), set(exp.values())) | | 210 | + | | 211 | + | 204 | 212 | def test_molecular_mass(self): | 205 | 213 | mat_empty = Material({}) | 206 | 214 | assert_equal(mat_empty.molecular_mass(), 0.0) | |
|