Similar to eclip, this is useful when extracting portions of a data set. Suppose we have an array, such as a pretrack array, with a bunch of columns:
IDL> help,pta
PTA FLOAT = Array[6, 717892]
Typically pta(0,*) is the x-coordinate, pta(1,*) is the y-coordinate, pta(2,*) is the brightness of the particle, pta(3,*) is the radius of the particle, pta(4,*) is the eccentricity of the particle, and pta(5,*) is the time step. One thing you typically do when you start data analysis is look at the spread of data in (brightness, radius) space:
![]() |
IDL> plot,pt(2,*),pt(3,*),psym=3
|
![]() |
IDL> ptb=polycut(pt,f1=2,f2=3)
% ECUT: Draw a convex polygon on the data... % GET_POLYGON: Left Button to add vertex, Right to quit As you select vertices, a polygon is drawn around your data. The "f1=2,f2=3" commands select fields 2 and 3 as the relevant fields to plot, in other words, the plot command that polycut is using is IDL> plot,pt(f1,*),pt(f2,*),psym=3 where f1 and f2 are defined when you call polycut. |
![]() |
When you are done, a right-click of your mouse closes the
polygon, then the data within the polygon is selected and
returned. Also, the coordinates of the polygon you drew are
printed out:
2935.66 12.9114 2935.66 8.31852 24465.9 6.80524 37633.2 9.35391 14590.5 12.4070 |
Also, if you want, you can specify a polygon yourself, and polycut will just proceed using that polygon:
IDL> ptb=polycut(pt,mypolygon,f1=2,f2=3)
If you include the "mypolygon" variable but it's undefined, then you can proceed as normal (drawing a polygon using the mouse) and then the variable will contain the polygon you have drawn.
Keywords:
John wrote this routine originally in a different context, and Eric modified the core routine into this particular format. Eric added /INVERT and /WHEREFLAG.