GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixed develop merge conflicts · walshjon/pyne@2a8e78a

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • docs
    • index.rst
  • pyne
    • cpp_material.pxd
    • material.pyx
  • src
    • material.cpp
    • material.h
  • tests
    • test_material.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎docs/index.rst‎

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 numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ PyNE - The Nuclear Engineering Toolkit
1010

1111
.. image:: gallery/data_sources_thumb.png
1212
.. image:: gallery/fng_model_thumb.png
13-
.. image:: gallery/discretized_teapot_thumb.png
1413
.. image:: gallery/ace_thumb.png
1514

1615
.. raw:: html
@@ -65,7 +64,7 @@ bindings and I/O support for other industry standard nuclear codes.
6564
<div id="usingContent" style="display:none;">
6665
<ul>
6766
<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>
6968
<li><a href="cppapi/index.html">C++ & Fortran API Documentation</a></li>
7069
<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.
7170
<li><a href="https://github.com/pyne/pyne/issues">Report an Issue</a></li>
Collapse file

‎pyne/cpp_material.pxd‎

Copy file name to clipboardExpand all lines: pyne/cpp_material.pxd
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ cdef extern from "material.h" namespace "pyne":
6565

6666
void normalize() except +
6767
map[int, double] mult_by_mass() except +
68+
map[int, double] activity() except +
6869
double molecular_mass() except +
6970
double molecular_mass(double) except +
7071
Material expand_elements() except +
Collapse file

‎pyne/material.pyx‎

Copy file name to clipboardExpand all lines: pyne/material.pyx
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ cdef class _Material:
572572

573573

574574
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
576576
nuctopic vector.
577577
578578
Returns
@@ -589,6 +589,21 @@ cdef class _Material:
589589
return nucvec_proxy
590590

591591

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+
592607
def molecular_mass(self, atoms_per_molecule=-1.0):
593608
"""molecular_mass(atoms_per_molecule=-1.0)
594609
This method returns the molecular mass of the comp of this
Collapse file

‎src/material.cpp‎

Copy file name to clipboardExpand all lines: src/material.cpp
+13-2Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99

1010
#ifndef PYNE_IS_AMALGAMATED
1111
#include "material.h"
12-
#include "nucname.h"
13-
#include "decay.h"
1412
#endif
1513

1614
// h5wrap template
@@ -1092,6 +1090,19 @@ pyne::comp_map pyne::Material::mult_by_mass() {
10921090

10931091

10941092

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+
10951106
double pyne::Material::molecular_mass(double apm) {
10961107
// Calculate the atomic weight of the Material
10971108
double inverseA = 0.0;
Collapse file

‎src/material.h‎

Copy file name to clipboardExpand all lines: src/material.h
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "utils.h"
2929
#include "nucname.h"
3030
#include "data.h"
31+
#include "decay.h"
3132
#endif
3233

3334
namespace pyne
@@ -219,6 +220,9 @@ namespace pyne
219220
/// used (and stored on the instance) as the atoms_per_molecule for this calculation.
220221
/// If \a apm and atoms_per_molecule on this instance are both negative, then the best
221222
/// 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.
222226
double molecular_mass(double apm=-1.0);
223227
/// Returns a copy of the current material where all natural elements in the
224228
/// composition are expanded to their natural isotopic abundances.
Collapse file

‎tests/test_material.py‎

Copy file name to clipboardExpand all lines: tests/test_material.py
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,14 @@ def test_mult_by_mass(self):
201201
assert_equal(nucvec, {922350000: 0.75, 922380000: 14.25})
202202

203203

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+
204212
def test_molecular_mass(self):
205213
mat_empty = Material({})
206214
assert_equal(mat_empty.molecular_mass(), 0.0)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.