def half_life_values(hl_hash): half_life_unit = hl_hash['unit'] half_life = hl_hash['value'] uncertainty = hl_hash['uncertainty'] # Fix very small amounts listed as xxe-18 or lower s: if (half_life_unit == 's') and (half_life < 1.0e-15): half_life_unit = 'as' half_life *= 1.0e18 if uncertainty is not None: uncertainty *= 1.0e18 if half_life_unit == 'eV': half_life_unit = 'as' new_half_life = planck_ratio / (1.0 * half_life) if uncertainty is not None: uncertainty *= new_half_life / half_life half_life = new_half_life if half_life_unit == 'keV': half_life_unit = 'as' new_half_life = planck_ratio / (1000.0 * half_life) if uncertainty is not None: uncertainty *= new_half_life / half_life half_life = new_half_life if half_life_unit == 'MeV': half_life_unit = 'as' new_half_life = planck_ratio / (1.0e6 * half_life) if uncertainty is not None: uncertainty *= new_half_life / half_life half_life = new_half_life time_unit_qid = nndc_data.nndc_time_id(half_life_unit) return half_life, uncertainty, time_unit_qid, half_life_unit
if (half_life_unit == 's') and (half_life < 1.0e-15): half_life_unit = 'as' half_life *= 1.0e18 if uncertainty is not None: uncertainty *= 1.0e18 if half_life_unit == 'eV': half_life_unit = 'as' new_half_life = planck_ratio/(1.0*half_life) if uncertainty is not None: uncertainty *= new_half_life/half_life half_life = new_half_life if half_life_unit == 'keV': half_life_unit = 'as' new_half_life = planck_ratio/(1000.0*half_life) if uncertainty is not None: uncertainty *= new_half_life/half_life half_life = new_half_life if half_life_unit == 'MeV': half_life_unit = 'as' new_half_life = planck_ratio/(1.0e6*half_life) if uncertainty is not None: uncertainty *= new_half_life/half_life half_life = new_half_life time_unit_qid = nndc_data.nndc_time_id(half_life_unit) print(u"{0},{1},{2},{3},{4},{5},{6}". format(nuclide.item_id, half_life, uncertainty, time_unit_qid, half_life_unit, nuclide.label, source_url))