Пример #1
0
    def test_plotFewIso(self):
        """Test the basic functionality of the depletion plot"""
        mat = self.reader[self.MATERIAL]
        ax = mat.plot('days', 'adens', names='U235')
        plotAttrTest(
            self,
            ax,
            xlabel=DEPLETION_PLOT_LABELS['days'],
            ylabel=DEPLETION_PLOT_LABELS['adens'],
            xscale='linear',
            yscale='linear',
            legendLabels=[],
        )
        # clear the plot for a second go

        ax.clear()
        mat.plot('burnup', 'adens', names=['U235', 'Xe135'], loglog=True)
        plotAttrTest(
            self,
            ax,
            xlabel=DEPLETION_PLOT_LABELS['burnup'],
            xscale='log',
            yscale='log',
            legendLabels=['U235', 'Xe135'],
        )
Пример #2
0
 def test_plotFormatting(self):
     mat = self.reader[self.MATERIAL]
     ax = mat.plot('days',
                   'adens',
                   names='U235',
                   legend=True,
                   labelFmt="{mat}-{iso}")
     plotAttrTest(self, ax, legendLabels=[self.MATERIAL + '-U235'])
Пример #3
0
 def test_rightPlot(self):
     """Test plotting on left and right y axis"""
     left, right = self.reader.plot('absKeff', sigma=0, right='totCpuTime')
     plotAttrTest(
         self, left, ylabel='absKeff',
         legendLabels=['absKeff', 'totCpuTime [right]'],
     )
     plotAttrTest(
         self, right, ylabel='totCpuTime',
     )
Пример #4
0
 def test_formatPlot(self):
     """Test the capabilities of the formatPlot function"""
     ax = self.buildPlot()
     newX = 'new x label'
     newY = 'new y label'
     title = 'plot title'
     formatPlot(ax, xlabel=newX, ylabel=newY, loglog=True, title=title)
     plotAttrTest(self,
                  ax,
                  xlabel=newX,
                  ylabel=newY,
                  xscale='log',
                  yscale='log',
                  title=title)
Пример #5
0
    def test_singlePlot(self):
        """Test the plot capabilities of the ResultsReader"""
        ax = self.reader.plot('absKeff', sigma=3)
        plotAttrTest(
            self,
            ax,
            xlabel=RESULTS_PLOT_XLABELS['burnDays'],
            ylabel="absKeff$ \\pm 3\\sigma$",
        )

        ax.clear()
        newLabel = 'Multiplication factor'
        self.reader.plot('burnup', {'absKeff': newLabel},
                         ax=ax,
                         sigma=0,
                         logx=True)
        plotAttrTest(
            self,
            ax,
            ylabel=newLabel,
            xscale='log',
            xlabel=RESULTS_PLOT_XLABELS['burnup'],
        )
        # plot two quantities
        ax.clear()
        self.reader.plot('burnStep', ['absKeff', 'totCpuTime'],
                         ax=ax,
                         sigma=0,
                         ylabel="ylabel")
        plotAttrTest(
            self,
            ax,
            xlabel=RESULTS_PLOT_XLABELS['burnStep'],
            ylabel="ylabel",
            legendLabels=['absKeff', 'totCpuTime'],
        )
Пример #6
0
 def test_plotAttrs_fail(self):
     """Test the failure modes of the plotAttrTest function"""
     ax = self.buildPlot()
     with self.assertRaisesRegex(AssertionError, 'xlabel'):
         plotAttrTest(self, ax, xlabel="Bad label")
     with self.assertRaisesRegex(AssertionError, 'ylabel'):
         plotAttrTest(self, ax, ylabel="Bad label")
     with self.assertRaisesRegex(AssertionError, 'xscale'):
         plotAttrTest(self, ax, xscale="log")
     with self.assertRaisesRegex(AssertionError, 'yscale'):
         plotAttrTest(self, ax, yscale="log")
     with self.assertRaisesRegex(AssertionError, 'legend text'):
         plotAttrTest(self, ax, legendLabels='bad text')
     with self.assertRaisesRegex(AssertionError, 'legend text'):
         plotAttrTest(self, ax, legendLabels=['1', '2'])
     with self.assertRaisesRegex(AssertionError, 'title'):
         plotAttrTest(self, ax, title='Bad title')
Пример #7
0
 def test_plotAttrs_gca(self):
     """Test the plotAttrTest without passing an axes object"""
     self.buildPlot()
     plotAttrTest(self, xlabel=self.XLABEL, ylabel=self.YLABEL)