GeezerVison is showing github.com — simple test passes · walshjon/pyne@abf3850
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: src/decay-gen.py +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 7 | 7 | from argparse import ArgumentParser, Namespace | 8 | 8 |
| 9 | 9 | import numpy as np | | 10 | +warnings.simplefilter('ignore', RuntimeWarning) | 10 | 11 | import tables as tb | 11 | 12 | import jinja2 | 12 | 13 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/decay.cpp +8-4Lines changed: 8 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,7 @@ std::map<int, double> decay(std::map<int, double> comp, double t) { | 16 | 16 | // setup | 17 | 17 | using std::map; | 18 | 18 | int nuc; | 19 | | - double out [3] = {}; // init to zero | | 19 | + double out [4] = {}; // init to zero | 20 | 20 | map<int, double> outcomp; | 21 | 21 |
| 22 | 22 | // body | @@ -31,6 +31,10 @@ std::map<int, double> decay(std::map<int, double> comp, double t) { | 31 | 31 | break; | 32 | 32 | } case 10030000: { | 33 | 33 | out[2] += (it->second) * (exp2(-2.572085049840012e-09*t)); | | 34 | + out[3] += (it->second) * (1.0 - exp2(-2.572085049840012e-09*t)); | | 35 | + break; | | 36 | + } case 20030000: { | | 37 | + out[3] += it->second; | 34 | 38 | break; | 35 | 39 | } default: { | 36 | 40 | outcomp.insert(*it); | @@ -40,14 +44,14 @@ std::map<int, double> decay(std::map<int, double> comp, double t) { | 40 | 44 | } | 41 | 45 |
| 42 | 46 | // cleanup | 43 | | - for (int i = 0; i < 3; ++i) | | 47 | + for (int i = 0; i < 4; ++i) | 44 | 48 | if (out[i] > 0.0) | 45 | 49 | outcomp[all_nucs[i]] = out[i]; | 46 | 50 | return outcomp; | 47 | 51 | } | 48 | 52 |
| 49 | | -const int all_nucs [3] = { | 50 | | - 10010000, 10020000, 10030000 | | 53 | +const int all_nucs [4] = { | | 54 | + 10010000, 10020000, 10030000, 20030000 | 51 | 55 | }; | 52 | 56 |
| 53 | 57 | } // namespace decayers | |
Collapse file Copy file name to clipboardExpand all lines: src/decay.h +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | namespace pyne { | 18 | 18 | namespace decayers { | 19 | 19 |
| 20 | | -extern const int all_nucs[3]; | | 20 | +extern const int all_nucs[4]; | 21 | 21 |
| 22 | 22 | std::map<int, double> decay(std::map<int, double> comp, double t); | 23 | 23 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/material.cpp +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1545,6 +1545,7 @@ pyne::Material pyne::Material::decay(double t) { | 1545 | 1545 | Material rtn; | 1546 | 1546 | comp_map out = pyne::decayers::decay(to_atom_frac(), t); | 1547 | 1547 | rtn.from_atom_frac(out); | | 1548 | + rtn.mass = mass * rtn.molecular_mass() / molecular_mass(); | 1548 | 1549 | return rtn; | 1549 | 1550 | }; | 1550 | 1551 |
| |
Collapse file Copy file name to clipboardExpand all lines: tests/test_material.py +3Lines changed: 3 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1606,6 +1606,9 @@ def test_decay(): | 1606 | 1606 | obs = mat.decay(data.half_life('H3')) | 1607 | 1607 | print(mat.to_atom_frac()) | 1608 | 1608 | print(obs.to_atom_frac()) | | 1609 | + print(mat) | | 1610 | + print(obs) | | 1611 | + assert False | 1609 | 1612 | assert_equal(0.5, obs['H3']) | 1610 | 1613 |
| 1611 | 1614 |
| |
|