def xsTypeNum(self, value): # pylint: disable=method-hidden self._p_xsTypeNum = value # pylint: disable=attribute-defined-outside-init self._p_xsType = crossSectionGroupManager.getXSTypeLabelFromNumber( value ) # pylint: disable=attribute-defined-outside-init xsTypeDef = parameters.ALL_DEFINITIONS["xsType"] xsTypeDef.assigned = parameters.SINCE_ANYTHING
def xsHistoryVsTime(reactor, buGroups, extension=None): r""" Plot cross section history vs. time. Parameters ---------- reactor : armi.reactor.reactors object buGroups : list of float The burnup groups in the problem extension : str, optional The file extention for saving the figure """ extension = extension or settings.Settings()["outputFileExtension"] history = reactor.o.getInterface("history") if not history or not history.xsHistory: return colors = itertools.cycle(["b", "g", "r", "c", "m", "y", "k"]) plt.figure() maxbu = 0.0 for typeNum, dataList in history.xsHistory.items(): times = [d[0] for d in dataList] burnups = [d[1] for d in dataList] maxb = max(burnups) if maxb > maxbu: maxbu = maxb xsType = crossSectionGroupManager.getXSTypeLabelFromNumber(typeNum) color = next(colors) plt.plot(times, burnups, color + ".", label="Type {0} XS".format(xsType)) for upperBu in [0.0] + buGroups: # draw a hline at the limits of each burnup group plt.axhline(y=upperBu) plt.legend() plt.title("Block burnups used to generate XS for {0}".format(reactor.name)) plt.xlabel("Time (years)") plt.ylabel("Burnup (% FIMA)") plt.ylim(0, maxbu * 1.05) figName = reactor.name + ".bugroups." + extension plt.savefig(figName) plt.close(1) report.setData("Xs Plot", os.path.abspath(figName), report.XS_PLOT)
def test_conversion_2digit(self): label = crossSectionGroupManager.getXSTypeLabelFromNumber(6570) self.assertEqual(label, "AF") num = crossSectionGroupManager.getXSTypeNumberFromLabel("ZZ") self.assertEqual(num, 9090)
def test_conversion(self): label = crossSectionGroupManager.getXSTypeLabelFromNumber(65) self.assertEqual(label, "A") num = crossSectionGroupManager.getXSTypeNumberFromLabel("A") self.assertEqual(num, 65)