Gary,
Here's a macro that Tim or Rasmus cooked up for me ages ago. The
nice thing about it is that it works whether there's a picked peak or not.
It might have some object/method calls that need updating due to API
changes since I haven't used it recently. I don't think it pays attention
to .isFolded.
Brian
--
Dr. Brian O. Smith ---------------------- B Smith at bio gla ac uk
Division of Biochemistry & Molecular Biology,
Institute Biomedical & Life Sciences,
Joseph Black Building, University of Glasgow, Glasgow G12 8QQ, UK.
Tel: 0141 330 5167/6459/3089 Fax: 0141 330 8640
from ccpnmr.analysis.UnitConverter import pnt2ppm, ppm2pnt
from ccpnmr.analysis.PeakBasic import findNumAliasing
def gotoFundamentalZ(argServer, spectrum=None):
if not spectrum:
spectra = argServer.getCurrentSpectra()
if not spectra:
argServer.showWarning('No spectra in current window')
return
spectrum = argServer.getSpectrum(spectra)
window = argServer.getCurrentWindow()
numZeds = 0
for axisPanel in window.axisPanels:
if axisPanel.label[0] == 'z':
numZeds += 1
if numZeds == 0:
argServer.showWarning('Window has no Z dimensions')
return
elif numZeds > 1:
v = argServer.askInteger('Which Z dim number do you want to consider?',1)
v = max(1,v)
zLabel = 'z%d' % v
else:
zLabel = 'z1'
dataDim = None
for view in window.spectrumWindowViews:
if view.dataSource is spectrum:
for axisMapping in view.axisMappings:
if axisMapping.label == zLabel:
dataDim = axisMapping.dataDim
break
if dataDim:
popup = argServer.getCurrentWindowPopup()
(x,y) = argServer.getCurrentPosition()
n = argServer.parent.currentStrip
dataDimRef = dataDim.dataDimRefs[0]
posDict = popup.findPosition(x,y,n,returnDict = 1)
point = ppm2pnt(posDict[zLabel], dataDimRef)
numAliasing = findNumAliasing(dataDimRef, point)
if numAliasing != 0:
point = point - numAliasing*dataDim.numPointsOrig
posDict[zLabel] = pnt2ppm(point, dataDimRef)
popup.gotoPosition(posDict)
|