I am extremely new to Igor, in fact trying to determine whether to purchase it. In excel I can easily take one column of time series data and bin it according to another column of data. For example having wind speed bins with corresponding power production data. (If wind speed is from 2-4 m/s what is the power produced?) Can this be done in Igor and how?
take one column of time series data and bin it according to another column of data.
I'm not sure I understand the question but . . .
My interpretation is that you want sum the values of powerProduction where windSpeed is between 2 and 4.
How you would do this depends on whether your windSpeed data is waveform data (evenly-spaced) or XY data. If XY data, it also depends on whether your X wave is sorted or not.
If you're not familiar with the concept of a waveform versus XY, execute this and read the corresponding help:
DisplayHelpTopic"The Waveform Model of Data"
It's much easier if it is waveform data. Here is an example:
Make/N=100 power SetScale/Px0, 0.2, "mph", power // X units in wind speed, miles-per-hour, measured every 0.2 mph
power = 100*x// Sample data Display power ModifyGraph mode=8, marker=19 ShowInfo; Cursor A, power, 5; Cursor B power, 10 Edit power.id Printsum(power, 1.0, 2.0)*0.2// Area under curve from windspeed=1.0 to windspeed=2.0, inclusive Print(100 + 120 + 140 + 160 + 180 + 200)* .2 // Same thing but done manually
Note that sum converts its x parameters to point numbers by rounding and then returns an inclusive sum. So if you execute:
Printsum(power, 1.0, 2.0)
you get a sum from point 5 (x=1.0) up to and including point 10 (x=2.0).
You would get the same sum from:
// 1.91 is more than halfway between the X value of point 9 and the X value of point 10 Printsum(power, 1.0, 1.91)// Point 10 included in sum
but a smaller sum from
// 1.89 is less than halfway between the X value of point 9 and the X value of point 10 Printsum(power, 1.0, 1.89)// Point 10 excluded from sum
Now create a wave of binned powers:
Make/O/N=10 binnedPower // power wave binned into 1 mph intervals SetScale/Px, 0, 1.0, "mph", binnedPower AppendToTable binnedPower.id
binnedPower = sum(power, x, x+4*0.2)*0.2 Display binnedPower ModifyGraph mode=5 SetAxis left 0,940
If your data is XY and sorted, you can use the areaXY or faverageXY function instead of sum which assumes waveform.
Quote:
I am extremely new to Igor
I highly recommend that you go through the first half of the Guided Tour of Igor (choose Help->Getting Started). It's an essential introduction to Igor.
Do you by any chance mean a "weighted histogram"? See the description of a weighted histogram in the reference documentation for the Histogram operation:
DisplayHelpTopic "Histogram"
You need to scroll down to the Details section for the discussion and helpful diagram of what it means.
I'm not sure I understand the question but . . .
My interpretation is that you want sum the values of powerProduction where windSpeed is between 2 and 4.
How you would do this depends on whether your windSpeed data is waveform data (evenly-spaced) or XY data. If XY data, it also depends on whether your X wave is sorted or not.
If you're not familiar with the concept of a waveform versus XY, execute this and read the corresponding help:
It's much easier if it is waveform data. Here is an example:
SetScale/P x 0, 0.2, "mph", power // X units in wind speed, miles-per-hour, measured every 0.2 mph
power = 100* x // Sample data
Display power
ModifyGraph mode=8, marker=19
ShowInfo; Cursor A, power, 5; Cursor B power, 10
Edit power.id
Print sum(power, 1.0, 2.0) * 0.2 // Area under curve from windspeed=1.0 to windspeed=2.0, inclusive
Print (100 + 120 + 140 + 160 + 180 + 200) * .2 // Same thing but done manually
Note that sum converts its x parameters to point numbers by rounding and then returns an inclusive sum. So if you execute:
you get a sum from point 5 (x=1.0) up to and including point 10 (x=2.0).
You would get the same sum from:
Print sum(power, 1.0, 1.91) // Point 10 included in sum
but a smaller sum from
Print sum(power, 1.0, 1.89) // Point 10 excluded from sum
Now create a wave of binned powers:
SetScale/P x, 0, 1.0, "mph", binnedPower
AppendToTable binnedPower.id
binnedPower = sum(power, x, x+4*0.2) * 0.2
Display binnedPower
ModifyGraph mode=5
SetAxis left 0,940
If your data is XY and sorted, you can use the areaXY or faverageXY function instead of sum which assumes waveform.
I highly recommend that you go through the first half of the Guided Tour of Igor (choose Help->Getting Started). It's an essential introduction to Igor.
If you prefer videos: http://www.wavemetrics.com/products/igorpro/videotutorials.htm
January 26, 2012 at 01:46 pm - Permalink
DisplayHelpTopic "Histogram"
You need to scroll down to the Details section for the discussion and helpful diagram of what it means.
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
January 27, 2012 at 08:53 am - Permalink