Ticket #8561 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Zoom out from peak in report

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: major Milestone: Release 3.1
Component: Diffraction Keywords:
Cc: Blocked By: #8428
Blocking: Tester: Vickie Lynch

Description

A problem with #8428 is that it's not possible to zoom slightly out from a peak. This would be very useful when you want to visually check the edge-of-detector condition, which has been the cause of problems lately.

Change History

comment:1 Changed 7 years ago by Owen Arnold

Would also be good to set the viewing axis. We should do this at the same time. Currently the projection X, Y is always for the first two dimensions. We should just need to expose these options on the PeakReport interface.

comment:2 Changed 7 years ago by Owen Arnold

import PyQt4.QtGui
qLab = CreateMDWorkspace(Dimensions='3',EventType='MDEvent',Extents='-10,10,-10,10,-10,10',Names='Q_lab_x,Q_lab_y,Q_lab_z',Units='A,B,C')
FakeMDEventData(InputWorkspace=qLab, PeakParams=[1000, 1, 1, 1, 1])

SetSpecialCoordinates(qLab, 'Q (lab frame)')

pathToInstrument = os.path.join(config["instrumentDefinition.directory"], 'CRISP_Definition.xml') # Note that the instrument doesn't matter. Choose a small one.
instWS = LoadEmptyInstrument(Filename=pathToInstrument) # Only do this so that we can provide the parameter to CreatePeaksWorkspace
pw = CreatePeaksWorkspace(InstrumentWorkspace=instWS, NumberOfPeaks=1)

peak = pw.getPeak(0)
peak.setQLabFrame(V3D(1, 1, 1), 1)

peaks_qLab_Integrated = IntegratePeaksMD(InputWorkspace=qLab, PeaksWorkspace=pw, PeakRadius=0.2, BackgroundInnerRadius=0.3, BackgroundOuterRadius=0.4)

def doreport(zoom = 1, xdim = 'Q_lab_x', ydim='Q_lab_y', zoom_factor=1):
        
        import CrystalTools.PeakReport 
        from PyQt4 import QtGui
        reload(CrystalTools.PeakReport)
        peakReport = CrystalTools.PeakReport.PeakReport("/Users/spu92482/Desktop/animation/")
        peakReport.set_log_scale(True)
        peakReport.set_background_color(QtGui.QColor(255, 255,255,255))
        peakReport.set_show_background(True)
        peakReport.set_foreground_color(QtGui.QColor(0, 0,0,255))
        
        peakReport.set_xy_dim(xdim, ydim) # Exercise new projection option
        peakReport.set_zoom(zoom) # Exercise new zoom option
        
        peakReport.make_report(qLab, peaks_qLab_Integrated)
        peakReport.clean_files()
        
doreport() # Default
doreport(0.1)
doreport(0.5, 'Q_lab_y', 'Q_lab_z')

comment:3 Changed 7 years ago by Owen Arnold

  • Status changed from new to inprogress

refs #8561. Add new options.

Changeset: 6b86de0f97e5afed2821db6289fe5f806198a032

comment:4 Changed 7 years ago by Owen Arnold

This should be working now. The self-contained script above should demonstrate the zooming in and out working, as well as the ability to switch the x-y axis projected.

using pips install PIL and reportlab first. You may want to set up a virtual environment for these.

comment:5 Changed 7 years ago by Owen Arnold

  • Status changed from inprogress to verify
  • Resolution set to fixed

comment:6 Changed 7 years ago by Wenduo Zhou

  • Status changed from verify to verifying
  • Tester set to Wenduo Zhou

comment:7 Changed 7 years ago by Wenduo Zhou

  • Status changed from verifying to verify
  • Tester Wenduo Zhou deleted

comment:8 Changed 7 years ago by Vickie Lynch

  • Status changed from verify to verifying
  • Tester set to Vickie Lynch

comment:9 Changed 7 years ago by Vickie Lynch

Not sure how this is different from the zoom out that already works in the View menu, but the script does work for me. Are you adding dependencies to mantid since I had to install python-imaging and python-reportlab?

comment:10 Changed 7 years ago by Vickie Lynch

  • Status changed from verifying to closed

Merge remote branch 'origin/feature/8561_pdf_zoom'

Full changeset: be63488852556d6284c91dc8aaa19464987944bb

comment:11 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9405

Note: See TracTickets for help on using tickets.