def test_add_multiple_elements_not_existing(self): res = { "det1": OrderedDict([(PQ.Isotope(3, 1, 0), StoredData(PQ.Activity(10., 2.), PQ.AoverLE(10., 2.), PQ.DoseRate(20., 3.)))]) } self.singleElementData["det1"][PQ.Isotope(3, 1, 0)].append( PQ.AoverLE(10., 2.), PQ.DoseRate(20., 3.)) self.assertEqual(self.singleElementData, res)
def _calc(self, data): """ Performs calculation of A/LE :param data (dict): input data :return: Raises: ValueError if either Isotope or SpecificActivity are not in the input data """ self._check_consistency(data, ['SpecificActivity']) try: self._check_consistency(data, ['SpecificActivity']) except Exception as e: raise e input_variables = zip(data.keys(), map(lambda x: x['SpecificActivity'], data.values())) for isotope, activity in input_variables: try: data[isotope].append(PQ.AoverLE(activity / self._LE[isotope])) except (KeyError, ZeroDivisionError): data[isotope].append(PQ.AoverLE(0.))
def test_check_multiple_element_is_exisiting(self): self.singleElementData["det1"][PQ.Isotope(3, 1, 0)].append( PQ.AoverLE(10., 2.)) self.assertTrue(self.singleElementData["det1"][PQ.Isotope( 3, 1, 0)].has_quantity(["Activity", "AoverLE"]))
def test_add_multiple_elements_not_existing_as_list(self): self.assertRaises( ValueError, self.singleElementData["det1"][PQ.Isotope(3, 1, 0)].append, [PQ.AoverLE(10., 2.), PQ.DoseRate(20., 3.)])