def test_3(): fname = _remove('uti_plot-0.png') up.uti_plot_init(None) x_range = (-.5, +.5, 10) up.uti_plot1d(array.array('f', Line(*x_range)), x_range) up.uti_plot_show() assert not os.path.isfile(fname)
def test_2(): fname_format = 'tuti-{}.png' fname = _remove(fname_format.format(0)) up.uti_plot_init('agg', fname_format) x_range = (-.5, +.5, 10) up.uti_plot1d(array.array('f', Line(*x_range)), x_range) up.uti_plot_show() assert os.path.isfile(fname)
def test_1(): fname = _remove('uti_plot-0.png') json_name = _remove('uti_plot-0.json') if 'DISPLAY' in os.environ: del os.environ['DISPLAY'] up.uti_plot_init('TkAgg', None) x_range = (-.5, +.5, 10) up.uti_plot1d(array.array('f', Line(*x_range)), x_range) up.uti_plot_show() assert os.path.isfile(fname) assert os.path.isfile(json_name)
from numpy import sqrt import sip sip.setapi('QString', 2) from PyQt4 import QtGui, QtCore from radtrack.ui.newsrw import Ui_Form as Ui_newsrw from radtrack.ui.undulatorforthinsrw import Ui_Dialog as und_dlg from radtrack.ui.beamforthinsrw import Ui_Dialog as beam_dlg from radtrack.ui.precisionofsrw import Ui_Dialog as prec_dlg from radtrack.srw.AnalyticCalc import * from xlrd import * import radtrack.util.resource as resource from radtrack.RbUtility import * import uti_plot # Initialize so that SRW doesn't generate files uti_plot.uti_plot_init(backend=uti_plot.DEFAULT_BACKEND, fname_format=None) class rbsrw(QtGui.QWidget): def __init__(self, parent = None): QtGui.QWidget.__init__(self, parent) self.ui = Ui_newsrw() self.ui.setupUi(self) self.up = UP() self.beam = SRWLPartBeam() self.precis = Precis() #load initial values from excel self.workbook = open_workbook(resource.filename('SRWinitialvalues.xls')) self.thin(self.ui.deparg.currentIndex()) #set srw initial values column = self.workbook.sheet_by_name('thin undulator').col(0) units = self.workbook.sheet_by_name('thin undulator').col(1)
def _init(): import uti_plot uti_plot.uti_plot_init()