def test_irradiation_activate_errors(): """Test NeutronIrradiation.activate() bad args""" iso0 = Isotope("Na-23") iso1 = Isotope("Na-24") iq0 = IsotopeQuantity(iso0, atoms=1e24) iq1 = IsotopeQuantity(iso1, atoms=1e24) start = datetime.datetime.now() stop = start n_cm2 = 1e15 ni = NeutronIrradiation(start, stop, n_cm2=n_cm2) barns = 10 with pytest.raises(NeutronIrradiationError): ni.activate(barns, initial=iq0, activated=iq1) with pytest.raises(NeutronIrradiationError): ni.activate(barns, initial=iso0, activated=iso1) with pytest.raises(TypeError): ni.activate(barns, initial=iq0, activated="asdf") iso2 = Isotope("Na-25") with pytest.raises(NotImplementedError): ni.activate(barns, initial=iq1, activated=iso2)
def test_irradiation_nan_g(): """Regression test for https://github.com/lbl-anp/becquerel/issues/325. From examples/isotopes.ipynb """ iso = Isotope("Na-23") iso2 = Isotope("Na-24") barns = 2.3 # making this up for now irradiation_start = "2017-04-30 10:32:00" irradiation_stop = "2017-04-30 11:32:00" flux = 3.1e11 ni = NeutronIrradiation(irradiation_start, irradiation_stop, n_cm2_s=flux) activated_qty = IsotopeQuantity(iso2, date="2017-05-01", bq=103.2) na23_qty = ni.activate(barns, initial=iso, activated=activated_qty) assert not np.isnan(na23_qty.g_at())
def stable_isotope(request): return Isotope(request.param)
def activation_pair(request): return Isotope(request.param[0]), Isotope(request.param[1])
def radioisotope(request): return Isotope(request.param)