Пример #1
0
 def testPlot(self):
     self.makeWs()
     ok2run = ''
     try:
         import matplotlib
         from distutils.version import LooseVersion
         if LooseVersion(matplotlib.__version__) < LooseVersion("1.2.0"):
             ok2run = 'Wrong version of matplotlib. Required >= 1.2.0'
         matplotlib.use("agg")
         import matplotlib.pyplot as plt
     except:
         ok2run = 'Problem importing matplotlib'
     if ok2run == '':
         simpleapi.SavePlot1D("group", self.plotfile)
         self.assertGreater(os.path.getsize(self.plotfile), 1e4)
     self.cleanup()
Пример #2
0
 def testPlotlyGroup(self):
     self.makeWs()
     div = simpleapi.SavePlot1D(InputWorkspace='group', OutputType='plotly')
     self.cleanup()
     self.assertTrue(len(div) > 0)  # confirm result is non-empty
        if asym1 is not None:
            signal_x = asym1.readX(0)
            signal_y = asym1.readY(0)
            div_r1 = _plot1d(signal_x,
                             signal_y,
                             x_range=None,
                             x_label="Wavelength",
                             y_label=labels[2],
                             title="",
                             x_log=False,
                             y_log=False)
            pol_info += "<td>%s</td>\n" % div_r1
            pol_info += "</tr>\n"
    else:
        pol_info += "<tr>\n"
        div_r1 = api.SavePlot1D(InputWorkspace=ratio1, OutputType='plotly')
        pol_info += "<td>%s</td>\n" % div_r1
        pol_info += "</tr>\n"
except:
    pol_info += "<div>Error: %s</div>\n" % sys.exc_info()[1]
pol_info += "</table>\n"

# Try to reduce the data
reduction_info = ''
if run_number > 0 and ws is not None:
    try:
        ws = api.Rebin(input,
                       params="%s, 50, %s" % (tof_min, tof_max),
                       PreserveEvents=True)
        red = call_reduction(ws, options=options)
        red.pol_state = "SF1"
Пример #4
0
 def testPlotGroup(self):
     self.makeWs()
     simpleapi.SavePlot1D('group', self.plotfile)
     self.assertGreater(os.path.getsize(self.plotfile), 1e4)
     self.cleanup()
Пример #5
0
 def testPlotlySingle(self):
     self.makeWs()
     div = simpleapi.SavePlot1D(InputWorkspace='test1', OutputType='plotly')
     self.cleanup()
     self.assertGreater(len(div), 0)  # confirm result is non-empty