Commit f8e464d8 authored by Stephen Smith's avatar Stephen Smith Committed by Smith
Browse files

Remove unused files

parent ce3b5651
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=invalid-name
"""
Script used to start the Test Interface from MantidPlot
"""
from ui.batchwidget import batch_widget_gui
ui = batch_widget_gui.DataProcessorGui()
if ui.setup_layout():
ui.show()
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source
# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +
import sys
from qtpy import PYQT5
from mantid.kernel import config, logger
if not PYQT5:
logger.error('Drill interface is supported only in workbench.')
else:
if config['default.facility'] != 'ILL':
logger.error('Drill is enabled only if the facility is set to ILL.')
else:
from mantidqt.gui_helper import get_qapplication
from Interface.ui.drill.view.DrillView import DrillView
app, within_mantid = get_qapplication()
if 'drillInterface' not in globals():
drillInterface = DrillView()
drillInterface.show()
if not within_mantid:
sys.exit(app.exec_())
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=invalid-name
"""
Script used to start the Test Interface from MantidPlot
"""
import sys
from sans.common.enums import SANSFacility
from sans.gui_logic.models.run_tab_model import RunTabModel
from sans.gui_logic.presenter.run_tab_presenter import RunTabPresenter
from ui.sans_isis import sans_data_processor_gui
if 'workbench' in sys.modules:
from workbench.config import get_window_config
parent, flags = get_window_config()
else:
parent, flags = None, None
main_window_view = sans_data_processor_gui.SANSDataProcessorGui(parent, flags)
run_tab_presenter = RunTabPresenter(SANSFacility.ISIS, run_tab_model=RunTabModel(), view=main_window_view)
# Show
main_window_view.show()
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=invalid-name
"""
Script used to start the Test Interface from MantidPlot
"""
from ui.poldi import poldi_gui
ui = poldi_gui.PoldiGui()
if ui.setup_layout():
ui.show()
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
#pylint: disable=too-many-arguments
import numpy
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
from PyQt4.QtCore import QByteArray, QBuffer
def animate_slice(sliceviewer, name, start, end, filename, num_frames=10, font_size=24):
"""Generate an animated gif of a 2D slice moving through a third dimension.
Args:
sliceviewer (SliceViewer): A sliceviewer instance.
name (str): The name of the third dimension to use.
start (float): The starting value of the third dimension.
end (float): The end value of the third dimension.
filename (str): The file to save the gif to.
Kwargs:
num_frames (int): The number of frames the gif should contain.
font_size: (int): The size of the caption.
Example:
ws = CreateMDWorkspace(3, Extents=[-10,10,-10,10,-10,10], Names=["X","Y","Z"], Units=["u","u","u"])
FakeMDEventData(ws, PeakParams=[10000,0,0,0,1])
sv = plotSlice(ws)
#Resize and configure the slice viewer how you want the output to look
sv.setNormalization(1) # We need to normalize by volume in this case, or the data won't show up
#This will create a gif iterating from Z = -1 to Z = 1
animate_slice(sv, "Z", -1, 1, "output.gif")
"""
#Generate all the individual frames
images = []
for slice_point in numpy.linspace(start, end, num_frames):
sliceviewer.setSlicePoint(name, slice_point)
sliceviewer.refreshRebin()
qimg = sliceviewer.getImage().toImage()
data = QByteArray()
buf = QBuffer(data)
qimg.save(buf, "PNG")
image = Image(blob=str(data))
captionstrip_size = font_size + 10
#To add whitespace to the top, we add a vertical border,
#then crop out the bottom border
image.border(Color("#fff"), 0, captionstrip_size)
image.crop(0, 0, image.width, image.height - captionstrip_size)
#Write the caption into the whitespace
draw = Drawing()
draw.font_size = font_size
draw.text(5, font_size,"%s = %g" % (name,slice_point))
draw(image)
images.append(image)
#Create a new image with the right dimensions
animation = Image(width=images[0].width, height=images[0].height)
#Copy in the frames from all the generated images
for image in images:
animation.sequence.append(image.sequence[0])
#Drop the initial blank frame
del animation.sequence[0]
#Write the animation to disk
animation.save(filename=filename)
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
from PyQt4 import QtGui
import sys
from mantidqtinterfaces.Muon.GUI.Common import message_box
from mantidqtinterfaces.MultiPlotting.multi_plotting_widget import MultiPlotWidget
from mantidqtinterfaces.MultiPlotting.multi_plotting_context import *
from mantidqtinterfaces.MultiPlotting.label import Label
import mantid.simpleapi as mantid
class plotTestGui(QtGui.QMainWindow):
def __init__(self, parent=None):
super(plotTestGui, self).__init__(parent)
self._context = PlottingContext()
self.test = MultiPlotWidget(self._context, self)
ws = setUpSubplot()
self.test.add_subplot("test")
self.test.add_subplot("bob")
self.test.add_subplot("moo")
self.test.add_subplot("baa")
self.test.add_subplot("EXTRA")
self.test.plot("test", ws, spec_num=26)
self.test.plot("test", ws, spec_num=21)
self.test.plot("test", ws, spec_num=22)
# defines position of label
dummy = Label("dummy", 10.1, False, 0.9, True, rotation=-90)
dummy2 = Label(
"protected",
5.1,
False,
0.9,
True,
rotation=-90,
protected=True)
dummy3 = Label("just annotate", 14.1, False, 0.9, True)
# defines position of line
# need to add methods to add just a label
# need to add_vline with a name and if protected but no
# annotation
self.test.add_vline_and_annotate("test", 10, dummy)
self.test.add_vline_and_annotate("test", 5, dummy2)
self.test.add_annotate("bob", dummy3)
self.test.add_vline("bob", 1.2, "just a line")
self.test.plot("bob", ws, spec_num=1)
self.test.plot("EXTRA", ws, spec_num=42)
self.test.plot("moo", ws, spec_num=42)
self.test.plot("baa", ws, spec_num=2)
self.test.set_all_values()
self.test.connectCloseSignal(self.close)
# add button for adding more plots
self.n = 0
self.ws = ws
self.btn = QtGui.QPushButton("add plot")
self.btn.clicked.connect(self.add)
self.grid = QtGui.QSplitter(QtCore.Qt.Vertical)
self.grid.addWidget(self.test)
self.grid.addWidget(self.btn)
self.setCentralWidget(self.grid)
self.setWindowTitle("plot test")
def add(self):
self.n += 1
self.test.add_subplot(str(self.n))
self.test.plot(str(self.n), self.ws, spec_num=self.n)
def setUpSubplot():
ws = mantid.LoadMuonNexus("MUSR00062260", OutputWorkspace="ws")
return ws
def qapp():
if QtGui.QApplication.instance():
_app = QtGui.QApplication.instance()
else:
_app = QtGui.QApplication(sys.argv)
return _app
app = qapp()
try:
window = plotTestGui()
window.show()
app.exec_()
except RuntimeError as error:
message_box.warning(str(error))
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment