Giving desired name to Wave Average wave output - can I modify a read only procedure?

YonatanHo
Posts: 14
Joined: 2014-02-17
Location: United States

Hello,

(I've accidentally posted this in the IgorExchange forum)
In short, I’ve noticed that in the Average Waves package I cannot use a decimal point for the output average wave name, for example: charge0.4_avg (bad).
My question was answered by HJ Drescher and Jim Prouty.
They suggested changing line 833, in the Average waves package to:

String AppCom = "AppendToGraph"+AFlags+" "+PossiblyQuoteName(AveWaveName)+XWaveInfo

However, the package procedure is a read only one.
Can I unlock it somehow to specifically change this line?

Cheers,
Yonatan

Y.H


[ last edited June 26, 2017 - 10:17 ]
HJDrescher
Posts: 342
Joined: 2015-01-20
Location: Germany

Locate the procedure file (start the package, use Windows->Procedure Windows->Waves Averages.ipf, click on the small sheet symbol on the lower left corner [left of the lock symbol], an information window pops up, click on 'Show file in Windows Explorer / Finder')
Open it in your favorite text editor and do the changes.
If you want to do the changes in Igor 6 you will have to start a new experiment, drag the file on the grey background area. In case the pen symbol is ruled out (where the lock symbol has been before) click on it to enable editing.
Igor 7 complains that the file is in use. I'd go for a third party editor in this case.

HJ


JimProuty's picture
Posts: 644
Joined: 2007-07-19
Location: United States

Copy the old file to the desktop and edit it there.

Right-click the file first to make sure it is not marked read-only.

Then copy it back.

Use an Admin account.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.


YonatanHo
Posts: 14
Joined: 2014-02-17
Location: United States

Worked as a charm!

Thank you guys for your time and effort!

Cheers,
Y.H


_sk
Posts: 99
Joined: 2014-10-28
Location: Switzerland

Another option might have been to append the function in the procedure window (to invoke in windows: ctrl+m) and define the override like so:

override Function WaveAverageDoItButtonProc(ctrlName) : ButtonControl

override Function WaveAverageDoItButtonProc(ctrlName) : ButtonControl
	String ctrlName
	SVAR/Z ListExpression=root:Packages:WM_WavesAverage:ListExpression
	if (!SVAR_Exists(ListExpression))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	SVAR/Z ErrorWaveName=root:Packages:WM_WavesAverage:ErrorWaveName
	if (!SVAR_Exists(ErrorWaveName))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	SVAR/Z AveWaveName=root:Packages:WM_WavesAverage:AveWaveName
	if (!SVAR_Exists(AveWaveName))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	SVAR/Z WA_ListOfWaves=root:Packages:WM_WavesAverage:WA_ListOfWaves
	if (!SVAR_Exists(WA_ListOfWaves))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	NVAR/Z nSD=root:Packages:WM_WavesAverage:nSD
	if (!NVAR_Exists(nSD))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	NVAR/Z ConfInterval=root:Packages:WM_WavesAverage:ConfInterval
	if (!NVAR_Exists(ConfInterval))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
	NVAR/Z ErrorMenuSelection=root:Packages:WM_WavesAverage:ErrorMenuSelection
	if (!NVAR_Exists(ErrorMenuSelection))
		DoAlert 0, "Some data required for the operation cannot be found. Try closing the panel and re-opening it."
		return -1
	endif
 
	String theList="", theXList=""
	String aWave
	String TopGraph=WinName(0,1)
	String TopTable=WinName(0,2)
 
	Variable DoConf
	Variable Interval
	Variable AppndGrph=0, numXWaves=0
 
	ControlInfo WaveSourceMenu
	Variable ListSource=V_value
	if (ListSource == 1)		// by Name
		theList = WaveList(ListExpression, ";", "")
	endif
	if (ListSource == 2)		// from Top Graph
		if (strlen(TopGraph) == 0)
			DoAlert 0, "There are no graphs"
			return -1
		endif
//		theList = WaveListfromGraph(ListExpression, ";", TopGraph)
		numXWaves= XYWaveListfromGraph(ListExpression, TopGraph,theList,theXList)
//		if( numXWaves == 0 )
//			theXList=""
//		endif
		ControlInfo AverageAppendToGraphCheck
		AppndGrph = V_value
	endif
	if (ListSource == 3)		// from Top Table
		if (strlen(TopTable) == 0)
			DoAlert 0, "There are no tables"
			return -1
		endif
		theList = WA_TableWaveList("*", ";", TopTable)
	endif
 
	Variable ErrorType = 0
	ControlInfo GenErrorCheck
	if (V_value)
		ErrorType = ErrorMenuSelection
		if (ErrorType == 1)
			Interval = nSD
		endif
		if (ErrorType == 2)
			Interval = ConfInterval
		endif
	endif
 
	Variable numWaves= ItemsInList(theList)
	if (numWaves == 0)
		DoAlert 0, "You have no waves selected. If you have selected From Top Graph, make sure the Wave Name Template is correct."
		return -1
	endif
 
	// Version 6.23: changed to Yes, No DoAlert
	if (numWaves == 1)
		// DoAlert 0, "You have only one wave selected ("+theList+" if you have selected From Top Graph, make sure the Wave Name Template is correct."
		//return -2
		String warning= "Only one wave selected ("+StringFromList(0,theList)+")."
		if (ListSource == 2)		// from Top Graph
			warning += " Make sure the Wave Name Template ( \""+ListExpression+"\" ) is correct."
		endif
		warning += "\r\rContinue anyway?"
		DoAlert 1, warning
		if( V_flag != 1 ) 	// 1 == yes
			return -2
		endif
		ErrorType=0
	endif
 
	Variable/G root:Packages:WM_WavesAverage:numWaves = numWaves		// for the New Graph button proc
 
	ControlInfo print
	if (V_value)
		Print "Averaging "+num2istr(numWaves)+" waves: "+ReplaceString(";",RemoveEnding(theList,";"),", ")
	endif
	Variable wasPointByPoint= fWaveAverage(theList, theXList, ErrorType, Interval, AveWaveName, ErrorWaveName)
	Variable disableXWave= 1	// hide
 
	if( wasPointByPoint >= 0 )	// < 0 means fWaveAverage reported an error
		if (AppndGrph)
			DoWindow/F $(WinName(0,1))
			aWave =  StringFromList(0, theList, ";")
			CheckDisplayed $AveWaveName
			if (V_flag == 0)
				String TInfo = traceinfo("", NameOfWave($(aWave)),0)
				String AFlags=StringByKey("AXISFLAGS",TInfo)
				String XWaveInfo = PossiblyQuoteName(StringByKey("XWAVE", TInfo))
				if (wasPointByPoint && strlen(XWAveInfo) > 0)
					XWaveInfo = " vs "+StringByKey("XWAVEDF", TInfo)+XWaveInfo
				else
					XWaveInfo= ""
				endif
				String AppCom = "AppendToGraph "+AFlags+" "+PossiblyQuoteName(AveWaveName)+XWaveInfo
				Execute AppCom
			endif
			if (ErrorType == 0)
				ErrorBars $AveWaveName, OFF
			else
				ErrorBars $AveWaveName, Y wave=($ErrorWaveName, $ErrorWaveName)
			endif
		endif
		if( wasPointByPoint )
			disableXWave= 0	// enabled and showing
		else
			disableXWave= 2	// disabled but showing
			// force calculated
			PopupMenu WavesAverageGraphXWave, win=WaveAveragePanel, mode=1 
		endif
	endif
	ModifyControl WavesAverageGraphXWave, win=WaveAveragePanel, disable= disableXWave 
	WA_ListOfWaves = theList
End

best,
_sk


Back to top