def test_half_life(): f = StringIO(ensdf3_sample) f.seek(0) hl = ensdf.half_life(f) assert_equal(hl, [(10030, 0.0, 20030, to_sec(12.32, 'Y'), 1.0), (20030, 0.0, 20030, np.inf, 1.0), (20030, 0.0, 20030, np.inf, 1.0), ])
def test_half_life(): f = StringIO(ensdf3_sample) f.seek(0) hl = ensdf.half_life(f) assert_equal(hl, [ (10030, 0.0, 20030, to_sec(12.32, 'Y'), 1.0), (20030, 0.0, 20030, np.inf, 1.0), (20030, 0.0, 20030, np.inf, 1.0), ])
def parse_decay(build_dir=""): """Builds and returns a list of nuclide decay data. """ build_dir = os.path.join(build_dir, 'ENSDF') decay_data = [] files = sorted([f for f in glob.glob(os.path.join(build_dir, 'ensdf.*'))]) for f in files: print " parsing decay data from {0}".format(f) decay_data += ensdf.half_life(f) ln2 = np.log(2.0) decay_data = [(nucname.name(fn), fn, lvl, nucname.name(tn), tn, hl, ln2/hl, br) for fn, lvl, tn, hl, br in decay_data] decay_array = np.array(decay_data, dtype=atomic_decay_dtype) da, mask = np.unique(decay_array, return_index=True) mask.sort() decay_array = decay_array[mask] return decay_array
def parse_decay(build_dir=""): """Builds and returns a list of nuclide decay data. """ build_dir = os.path.join(build_dir, 'ENSDF') decay_data = [] files = sorted([f for f in glob.glob(os.path.join(build_dir, 'ensdf.*'))]) for f in files: print " parsing decay data from {0}".format(f) decay_data += ensdf.half_life(f) ln2 = np.log(2.0) decay_data = [(fn, lvl, tn, hl, ln2 / hl, br) for fn, lvl, tn, hl, br in decay_data] decay_data = set(decay_data) decay_data = sorted(decay_data, key=lambda x: (x[1], x[4])) decay_array = np.array(decay_data, dtype=atomic_decay_dtype) #da, mask = np.unique(decay_array, return_index=True) #mask.sort() #decay_array = decay_array[mask] return decay_array