6.00.x

Binary search on PRE-SORTED text waves

Average rating
(0 votes)

These 2 functions do a binary search on an ALREADY ALPHABETICALLY SORTED text wave, looking for the point in the wave that matches the input text. Either the first matching point in the wave, or the last matching point is searched for.

  1. I'd appreciate feedback on correctness/efficiency.
  2. If there is an Igor function that will do this already, I don't know about it. Maybe it could be a wish list item?
  3. FindLastTextOccurrence and FindFirstTextOccurrence could be combined, with another input parameter to select for first or last occurrence.

Identify Point in Matrix Subrange

Average rating
(1 vote)

Igor allows you to display a subrange of a multi-dimensional wave as a waveform or XY trace in a graph. For example, you can display a column of a 2D wave as a trace:

Make/O/N=(5,5) mat = p + 10*q
Display mat[][2]	// Display all rows of column 2

In the case of a 2D wave, the Y coordinates for a trace can come from any of the following:

Display mat[][2]		// All rows of one column
Display mat[1,3][2]		// Range of rows of one column
Display mat[0,4;2][2]		// Range of rows of one column with increment
Display mat[2][]		// All columns of one row

Control Table Entry with Graph Cursor

Average rating
(0 votes)

I've done a lot of spectral simulations in my career, and one issue that seems to crop up frequently is selecting a line of interest on a graph consisting of 1000s of lines and figuring out what it is by viewing waves of frequency, intensity, quantum number, other label, etc. For occasional use, putting a cursor on the line and reading the point number is sufficient to go find the entries in the respective waves, but for rapid perusal, I came up with this trick.

Remove Extra Line Breaks and Load

Average rating
(1 vote)

#pragma rtGlobals=1		// Use modern global access method.
 
//	This is an illustration of loading data from a weird file format.
//
//	In some cases, the simplest approach is to create a cleaned-up version of the file
//	as a temporary file and then to load the data from that.
//
//	In this example, the file has line unwanted line breaks represented by consecutive
//	carriage returns, linefeeds or carriage-return/linefeed pairs.
//
//	We create a temporary file with the extra line breaks removed and load the temporary file.

Ocean Optics XOP IGOR.6.00.x-1.0

in
Downloaded 36 times
Download: Ocean Optics XOP.zip
Size: 544.53 KB
md5_file hash: e9af68788aefe782fcdce1d644b125c1
First released: November 7, 2011 - 08:52

Initial release

NRFit IGOR.6.00.x-6.10-WIN

in
Downloaded 38 times
Download: NRfit_6_1_win.ipf
Size: 346.26 KB
md5_file hash: 70a3fb00ca798a3f852d9e3d39e36080
First released: October 30, 2011 - 09:54

Windows version
Works for most of the recent IgorPro 5 to 6.22

NRFit IGOR.6.00.x-mac

in
Downloaded 17 times
Download: NRfit_6_0_mac.ipf
Size: 346.73 KB
md5_file hash: 8c1593f22c98dcf6edb7d1ae7ec917d7
First released: October 28, 2011 - 17:42

MAC OSX version for Igor Pro <= 6.0

Fake Waterfall Plot

Average rating
(0 votes)

// Igor can display waterfall plots using the NewWaterfall operation (choose Windows->New->Packages->Waterfall Plot).
// This requires storing your data in a 2D wave. You can also create a 3D waterfall plot using Gizmo.
//
// However, for the common case of displaying a series of spectra, you may find that a "fake waterfall plot"
// is more convenient. And it works with your original waveform or XY data.
//
// A fake waterfall plot is a regular graph with multiple waveform or XY traces where you use Igor's X and Y

Deconstruct date/time value into its component parts

Average rating
(0 votes)

// Deconstructs an Igor date/time value (seconds since 1904-01-01) into
// its component parts (year, month, dayOfMonth, etc.).
// Because it uses pass-by-reference parameters, this function can be called
// only from another user-defined function. See the Demo function below for usage.
 
Function DeconstructDate(dt, year, month, dayOfMonth, dayOfWeek, hour, minute, second)
	Variable dt					// Input date/time value
	Variable& year				// Output
	Variable& month			// Output
	Variable& dayOfMonth		// Output
	Variable& dayOfWeek		// Output
	Variable& hour				// Output

Get Offset of Trace in Graph

Average rating
(0 votes)

Function GetTraceOffset(graphName, traceName, instance, which)
	String graphName	// "" for top graph
	String traceName
	Variable instance 	// Usually 0
	Variable which		// 0 for X, 1 for Y
 
	String info= TraceInfo(graphName,traceName, instance)
 
	String offsets = StringByKey("offset(x)",info,"=",";") // "{xOffset,yOffset}"
 
	Variable xOffset,yOffset
	sscanf offsets, "{%g,%g}",xOffset,yOffset
 
	if (which)
		return yOffset
	endif
	return xOffset
End

Syndicate content

Back to top