Page 1
©A.‐F.Miller WeightingandLinearPrediction
1
Practicum 4, Fall 2010 The acquisition time: weighting and linear prediction
Strychnine,dissolvedinCDCl3
ThisdemonstrationdevelopstheinverserelationshipbetweentimeandfrequencyaswegobackandforthbetweentheFID,whichoccursintime(itistime‐domaindata)andtheNMRspectrum,whichisdisplayedoverafrequencyaxis(itisfrequency‐domaindata).
Weightingfunctionsaredevelopedasawaytodecreasethecontributiontothespectrumofnoise,andtocorrectfordatatruncation.Theycanalsobeusedtoenhanceresolution,providedthedataareofgoodquality.
Improving signal/noise with weighting Again,webeginbyacquiringanice1‐dimensionalspectrum.
NowclickontheFIDdisplaybutton[1]tolookatthecorrespondingFID(Figure1).
Notethattheaxisisnowatimeaxis[2],anditrunsfromzerotothevalueyouusedastheacquisitiontime(at)[3].
Forbestspectralresolution,theFIDshouldhavedecayedtozerobythetimeatends.Howevermakingatmuchlongercollectsnoiseonly,anddecreasesthequalityofthespectrum,becauseeverypointintheFIDiscombinedtogenerateeachpointinthespectrum,bytheFouriertransformation.LookattheX‐axiswhiledisplayingtheFID.Decideatwhattimethesignalisessentiallygone,andchoosethattimeforuseasyourimprovedacquisitiontime[4].Thus,inthisinstance,abetterchoiceofatis1.6seconds.
Youcanmakethisdecisionatthesametimeasyouadjustthesweepwidth,basedonatrialspectrum.
YoucanalsocausethesoftwaretosimplynotuseallofthedigitizeddataasinputtotheFID,andyoucandosoinataperedway.
UnderProcessing>Weighting(Figure2,[0])activate'InteractiveWeighting'[1].Inthegraphicaldisplaywindow,thebottompanelshowstheFID[2],themiddlepanelshowsthefunctionthatwillbemultipliedpoint‐for‐pointwiththeFID[3]andthetoppanelshowswhattheFouriertransformofthisproductwillbe[4].Neitherofthelattertwopanelsdisplayanythingyet.
Clicknextto'sinebell'toactivateasinefunction[5].
Nowthemiddlepanelshowsasinefunction(Figure3,[1]).ClickintheupperpanelusingtheRightMouse(RM)[2].Theanticipatedspectrumappearsasapreview(notshown).
Page 2
©A.‐F.Miller WeightingandLinearPrediction
2
Thespectrumthatresultshasdistortedpeakshapes(Figure4[1]).GotoProcess>Display,click'Transform'and'DisplaySpectrum'togetabetterview.Clickon'Transform'inordertoperformanewweightedFouriertransformincorporatingtheweightingfunctionyoujustchose(Figure5).
ThestrongnegativeexcursionsoneachsideofeachsignalarebecausethefirstpointoftheweightedFIDwillbezero,becausethefirstpointoftheweightingfunctioniszero.ThevalueofthefirstpointinthetimedomaindeterminesthetotalintegralunderthespectrumafterFouriertransformation.Thusinthesine‐weightedspectrum,allthepeakshaveasmuchnegativeareaaspositivearea,foratotalareaofzero,intheory.
Topreventthefirstpointfromhavingazerovaluewhilenonethelessexploitingthesinefunction'sdecaytozeroatlongtimes,weshiftit.InProcessing>Weightingactivate'InteractiveWeighting'[1]againandactivate'shift'[2](Figure6).ActivatethespectrumpreviewbyclickinginthetoppanelwiththeRM[3].Forshift,enter‐1*thevalueyouhavenextto'sinebell'.Nowyouseethatthepeaksarebroaderbutnolongerhavenegativedipsonbothsides.Theirintegralsarepositive.Toshiftthesinebellsothatitspeakisattime=0,settheshiftequalto‐1*thesinewidth.
Thelinesarebroadenednowbecausedataarebeingsqueezedtozerobytheweightingfunctionattimeequaltothevalueusedforthe'sinebell'parameter(lookatthetimeaxisinthelowerpaneloftheinteractiveweightingdisplay[4]).
Afterprocessingwithyournewweightingfunction,the'shiftedsinebell',determinethewidthathalf‐heightofthesignalsinthefrequency‐domainspectrumbygoingtoProcess>Cursors/LineLists,andclickingon'Transform'(Figure7).UsethetoolsontheRHStozoominonarepresentativepeak[0],placethecursoronitandclick'Placeonnearestline'[1]then'Showlinewidth'[2].Inthespaceabovethecommandline,aswellastheRHresponseboxatthebottom,thelinewidthathalfheightisprovided(2.55Hz)alongwiththedigitalresolution[3].
Notethatthisscreenalsogivesyouthepossibilityofmakingthechosenlinethecenterofthenextspectrumyoucollect,byclickingon'Movetransmitter'[4].Thiswillchangethevalueoftof(carrierfrequency='transmitteroffset')withoutchangingthesweepwidthsw.
GobacktoProcessing>Weightingandactivate'interactiveWeighting'again.Nowsettheshifttoonly‐1*halfthevalueinsinebell.Thisisa45°shiftedsinebell,asopposedtotheprevious90°shiftedsinebell.Thepeakswillnowbealittleshorter,buttheirlinewidthsshouldbealittlelonger.Thisweightingfunctionalsohasthebeneficialeffectofcancellingout'feet'thatoftenaccompanypeaks,complicatingintegralsandcausingstreaksin2Dspectra.Thus,itisoftenused.
Youcanalsoselectotherweightingfunctions.TheGaussianfunctionandthelinebroadening(anexponentialdecrease)bothhavefullamplitudeatthefirstpointandthereforedonotrequireshifting,althoughshiftingisoftenhelpful(seeabove)andispossiblewiththeGaussian.Trythedifferentoptions!
Page 3
©A.‐F.Miller WeightingandLinearPrediction
3
Correcting for short a at with weighting SometimesweintentionallydonotdigitizetheFIDforaslongasittakestodecaytozero.SometimesthisisbecausethesamplecontainsonespecieswithaverylongT2andthatspeciesisnotofinteresttoussowehaveoptimizedtheexperimentparameterinfavourofotherspeciespresent.Sometimesitistokeepthedatasetsizesmallerandeasiertomanipulate(eg.for2Dspectra).TheresultofhavingstoppeddatacollectionbeforetheFIDisreallyoverisshowninFigure8.Inthiscase,theatchosenwaslongerthantheT2ofthemajorconstituentofthesample(strychnine),butitwasshorterthantheT2oftheTMS.Thuswesee'sincwiggles'(feet)atthebaseoftheTMSline[1]whichissharp(longT2).Thesearea'truncationartifact'.(Notethatthelinesofstrychninewhicharebroader(shorterT2)donothavesincwiggles[2].)
Therearetwowaysto'fix'truncationartifactswithoutre‐collectingthedata.Oneistoapplyaweightingfunctionthatcompressesthedatatozeroatthetimewhenthedatacollectionceased.Theotheristoapplylinearpredictiontoextenttheacquireddatawithsynthetic'predicted'data.
Figure9showstheProcesss>WeightinginteractivedisplaywiththetruncatedFID.(Notehowtheoscillationscontinueattheendofthedata.)
ActivateaGaussianweightingfunction(Figure10,[1]),clickinthemiddlepanelusingtheLMtoextendorcompresstheGaussianinteractively[2](thehorizontalpositionofthemousemattersbutnottheverticalpositionwithinthemiddlepanel)andnotetheeffectonthepreviewofthefrequencydomainspectruminthetoppanel[3]oftheinteractiveweightingdisplay.Thesincwigglesaregone,butthesharplineisbroadened.Ineachinstance,youwillhavetodecidewhichismoreimportant:nosincwigglesorsharperlines.
Clickon'Transform'toapplyyournewweightingfunctionandFouriertransformthespectrum.(Figure11[1]).Comparetheresultwiththespectruminfigure8thatwasnotweightedpriortotransformation.
Linear Prediction Iftheatisshorterthanthedecayofthedata,youcanhavesincwiggles.Ifyouwanttoremovethosewithoutbroadeningyourlines,youneedmoretime‐domaindata(narrowerfreq‐domainlinesneedlongertime‐domaindata).
Thesoftware'knows'thatthedatayoucollectedshouldbethesumofmanycosinefunctionseachwiththefrequencyofonepeakandeachdampedaccordingtothatpeak'sT2(1/πΔν).Thus,ifyoutellithowmanystronglinesthereareinyourspectrum(approximately),thesoftwarewillfityouracquireddataintermsofasumofdampedCos'toobtainsetsofνandT2s.(Itwillalsogeneratephasesandamplitudesforeach.)Thenthesoftwareusesthissetofparameterstocalculatewhatthe'ideal'FIDshouldbeforanytimepointsyouwant.IfwewanttoextendashortFID,wewillaskfor'forward'linearpredictionandwewillaskthesoftwaretopredicttheperfectFIDfortimepointsafterwestoppedactuallydigitizingdata.
Page 4
©A.‐F.Miller WeightingandLinearPrediction
4
InFigure12,theactualdataareinblackandthepredicteddataareinblue.
Togeneratesynthetic(predicted)pointsthatdoublethedata,gotoProcess>More1D(Figure13).
Anumberofdecisionsarerequired.Weneedtotellthesoftwarewhethertolinearpredictforwardintimeorbackward(parameterlpop='f'or'b')(Figure13[1]).
WeneedtospecifyhowmanypeaksaretobeassumedinfittingourdataandwhichactualdatapointsaretobethebasisforthefittodeterminepeakνandT2foreachpeak.Havingseenyourspectrum,estimatethenumberofstrongpeaks,forexample16(don'tbetoogreedy).Enterthisnextto'coeff'[2](parameter=lpfilt).Forforwardlinearpredictionwedothisbyspecifyingthenumberofpointstobeused[3](parameterlpnuptscanbeaslargeasnp,thenumberofpointsyouhave),andthelastdatapointtobeused(strtlp,'startlp'inFigure13[4]).Thusifyouwanttousepoints1‐609,give609asthenumberofbasispoints[3]and609asthelastpoint[4].(Thisiscalledthe'startingpoint',butthesoftwarelooksbackwardfromthatpointwhendoingforwardlinearprediction.Justoneofthosethings....)
Ifyouchosetosimulate'n'signalsyouwillneedaminimumof2*ndatapoints,butyoushouldreallyuseatleasttwicethatmany.Ichosetogeneratepointsbasedonamodeldominatedby16signals.ThisrequiresthatIuseatleast32pointsasabasisformysimulation.Inourcase,withnicestrongdata,wecanaffordtousemanymorepointsthanthat.TousetheentirefirsthalfoftheFID,use609points,frompoint609backtothestart.
Enterthenumberof'predictedpoints'youwouldliketoaddtoyourFID[5](parameterlpext).TodoublethelengthofyourFIDenterthesamenumberasyouseebelowinthebox'Acquiredpoints'[6].Thisnumberisfixedatthetimeyoucollectdata,itisreportedhereforyourconvenience(parameternamenp).Ifthesearetobeaddedafterthelastactualdatapoint,thenthefirstpredictedpointis1+np.Enterthisvaluenextto'startingat'[7](parameterstrtext).
ThereisanotherchoicerelatedtoyourFouriertransformationoperation.Eventhoughwehavenp=1218,wecanchooseanypoweroftwofortheoutputofourFouriertransform.Touseall1218inputpoints,wewouldchoosetooutputto2048(nextbiggestpowerof2).Whatisdoneisthattheinputisaugmentedto2048pointstoobyadditionofastringofzerosafterthelastdatapoint(zero‐filling).Whenwelinearpredict,wewillbedoingabetterjob,butputtingsimulateddatathereinstead.HoweverifoursimulatedpointsmaketheFIDsomuchlongerthatitnowexcees2048points,wemayincreasetheFouriertransformsizeto4096,or4k[8](parameterfn,orFouriernumber).
Thiswilldeterminethedigitalresolution,thenumberofHzperpoint.Sinceyouwouldlikedigitalresolutionbetterorequaltoyourspectralresolution(thatistosayasmallernumberofHz/point),makefnlargeenoughthatthedigitalresolutionisasmallernumberthan1/2yoursharpestline'swidthathalfheight.ThesevaluescanbecheckedonalinebygoingtoProcess>Weighting,placingthecursoronthe
Page 5
©A.‐F.Miller WeightingandLinearPrediction
5
lineandclickingon'DisplayLinewidth'(Figure11[4]).(Alternately,typedres).Youdon'tneedtocollectnewdataiffnistoosmall,justincreaseitandFouriertransformagainbyclickingon'Transform'.
Figure14showsthespectrumthatwasacquiredwithaveryshort0.3sat,butaugmentedwithlinearpredictiontodoubletheFIDlength.Inthiscasenoweightingwasappliedinordertoshowtheeffectoflinearpredictionalone.TheanalogousspectrumthatwasnotlinearpredictedisshowninFigure15.
Togetthebestpossiblespectrumfromtheshort‐atdataset,combinetheuseoflinearpredictionandweighting,byactivatingweightinginthelinearpredictionwindow(Figure15[1]).(gotoProcessing>WeightingtodoubletheGaussianlengthinaccordancewithyournewdoubledFIDlength.IfyouusedashiftedGaussian,alsodoubletheshift.)Youcandoubletheseinthecommandlinebytypinggf=2*gf(GaussianfunctionisnowtwicethepreviousGaussianfunction)andgfs=2*gfs(GaussianshiftisnowtwicethepreviousGaussianshift).
Infigures13,14and15compareboththelinewidthsofthesignalsandthemagnitudeoftruncationartifacts(sincwigglesatthebaseofsharpsignals).
Forcompleteness'sake,Figure16showshowthemeaningsofthelinearpredictionparameterschangewhenoneuseslinearpredictiontofixearlypoints,by'backward'linearprediction(blackdataareactualdatatobeusedasthebasisforafitandbluearedatathatarepredictedandwilloverwritebadinitialdatapoints).Inthiscasethechoiceofthenumberofsignalstomodel('coef'orlpfilt)andnumberofactualdataarethesame,butnowthedatapointstobeusedasthebasisforthefitextendfromthefirstpointtobeused('startingat'=strtlp)outtolatertimesbyanumberofpointscalled'basispts'orlpnpts.Thefirstpredictedpointwillbeat'startingat'(strtext)andwillextendbackwardsforanumberofpointsyouenteras'predictedpoints'(lpext)
Page 6
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction[1]
[2]
[3]
1
[4]
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
[3]
[4]
[5]
[0]
2
Page 7
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
3
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
4
Page 8
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
5
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
[3]
[4]
6
Page 9
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
[3]
[0]
[4]
7
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
[2]
8
Page 10
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
9
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1][2]
[3]
10
[4]
[5]
Page 11
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
[1]
11
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
12
Page 12
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
13
[1]
[2][3]
[4][5]
[8]
[6][7]
[8]
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
14
Page 13
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
15
[1]
Figure
© A.-F. Miller 2010
Weighting & Linear Prediction
16