Row Subsets
An useful feature of the TOPCAT is the ability to define
Row Subsets. A Row Subset is effectively a table composed
from some subset of the rows in a whole table being viewed by the TOPCAT
tool. You can define these and use them in several different ways;
the usefulness comes from defining them in one context and using them
in another.
The Subset Window displays the currently
defined Row Subsets and permits some operations on them.
You can define a group of rows in the table
in a number of ways (by writing a boolean expression, selecting
rows in the browser, identifying points in a plot) and view this
subset as a separate table, or display different subsets using different
markers during plotting.
Defining subsets
You can define a Row Subset in one of the following ways:
- Selecting rows in the browser
- You can select a single row in the main table browser window by
clicking on it, or select a group of adjacent rows by dragging
the mouse over them. You can add more rows to the selection by
keeping the <Control> button pressed while you do it.
Once you have a set of rows selected you can use the
Subset From Selected Rows or
Subset From Unselected Rows
items in the browser Subsets menu to create a new subset based
on the set of highlighted rows or their complement.
Combining this with sorting the rows in the table can be
useful; if you do a Sort Up on a given column and then drag out the
top few rows of the table you can easily create a subset consisting
of the highest values of a given field.
- Defining an algebraic expression
- If you select the New Subset Expression
item from the Subsets
menu in the main browser, you will be able to enter an algebraic
expression. This is a java-like expression which can refer to the
values of cells in various columns in a row to produce a boolean
(true/false) result indicating whether the row should be included
in that subset or not. The Expression Syntax
section explains more about how to specify these.
- Boolean columns
- Any column which has a boolean (true/false) type value can be used
as a subset; rows in which it has a true value are in the subset
and others are not.
- Visible plotted points
- In the Plot Window you can plot columns
against each other, and subsequently zoom in and out using the
mouse. If you zoom to display only some of the plotted points and
then use the New Subset From Visible menu item or toolbar button
(
) then a new subset will be
created containing only rows represented by points in the field of
view of the plot at the time.
In all these cases you will be asked to assign a name for the subset.
As for column names, it is a good idea to follow a few rules for these
names. They should be:
- Different from other subset names, even apart from upper/lower case
distinctions
- In the form of a java identifier (starts with a letter, continues with
alphanumerics including underscore)
- Not too long
In the first two subset definition methods above, the newly-defined
subset will be applied immediately in the main browser window.
Using Subsets
Once a Row Subset is defined it can be used in one of the following ways:
- Browser display
- The Apply Subset item in the Subsets
menu of the main browser window
allows you to choose a subset from the list of those defined.
Only rows in the subset that is chosen will show up in the browser
window.
- Exporting Tables
- If a subset has been applied (and hence is active in restricting the
rows which are visible in the main browser window) then saving the table,
or exporting it to a new viewer using the
action,
or launching Mirage from TOPCAT will all cause the restricted set of
rows only to be exported.
- Calculating Statistics
- In the Statistics Window you can calculate
statistics not just for the column values in the whole table, but
for any defined subset of the rows. Use the subset selector
button at the bottom of the window.
- Plotting
- In the Plot Window the plot is drawn with
different markers for points appearing in different subsets.
Use the Subsets to Plot item in the Subsets
menu to select which
subsets should be displayed. Markers are chosen for each subset
automatically, and a key of which subset is represented by which
kind of marker is shown to the right of the plot.
In general markers from earlier subsets in the list
are obscured by ones later in the list. In future versions more
flexibility will be introduced into the display.