### 16 Selecting subsets from a catalogue

Subsets can be extracted from a catalogue according to some criteria using either the catalogue browsers xcatview (see Section 11) and catview (see Section 12) or using application catselect. Whereas the selection options in the catalogue browsers are oriented towards the interactive exploration and display of catalogues, catselect is oriented towards creating ‘one-off’ selections from a catalogue and saving them as a new catalogue. Also, catselect contains options for types of selections which are not available in the catalogue browsers.

The remainder of this section describes catselect. In addition to saving the selected objects as a new catalogue, catselect provides an option to save the rejected objects, which did not meet whatever criteria was specified, to a second catalogue. The types of selection available in catselect are listed in Table 7 and described in Section 16.2.

 Type of selection Option Browser? Arbitrary expression E $\bullet$ Range within a sorted column R $\bullet$ Rows inside a rectangle A ($\bullet$) Rows inside a circle C ($\bullet$) Rows inside a polygon P Every $n$th row N

The ‘Option’ column lists the response to prompt SETYP which corresponds to the type of selection.

The ‘Browser?’ column indicates whether the type of selection is available in the catalogue browsers xcatview and catview. A bullet (‘$\bullet$’) indicates that the type of selection is available. A bullet in parenthesis (‘($\bullet$)’) indicates that the type of selection is available in the browsers by entering the appropriate arbitrary expression.

Table 7: Types of selection available in catselect

#### 16.1 Running catselect

To run catselect simply type:

catselect

The amount of textual information written to the output catalogue is controlled using the command line mechanism described in Section 10.1. You must answer a series of prompts in order to generate a catalogue containing the required selection. Some of these prompts differ depending on the type of selection required, but the first few are always the same. These first few prompts are listed below together with a corresponding explanation. In this list the prompts are identified by the corresponding ADAM parameter name, which appears at the start of the prompt line.

CATIN
Enter the name of the input catalogue from which objects are to be selected.
CATOUT
Enter the name of the output catalogue to contain the selected objects. A catalogue with this name must not already exist. catselect will automatically create the output catalogue in toto.
REJCAT
Specify whether a second output catalogue, containing the objects which did not satisfy the selection criteria, is to be created. The options are:
TRUE
produce a catalogue of rejected objects,
FALSE
(default) do not produce a catalogue of rejected objects.
CATREJ
Enter the name of the output catalogue to contain the rejected objects. Obviously, this prompt is issued only if you specified that such a catalogue was required by replying ‘TRUE’ to the REJCAT prompt. A catalogue with the specified name must not already exist. catselect will automatically create the output catalogue in toto.
SELTYP
Specify the type of selection required. The options are:
E
arbitrary expression,
R
range within a sorted column,
A
rectangular area,
C
circular area,
P
polygonal area,
N
every nth entry,
H
list the options available.

See Section 16.2 for a description of the options. You will be re-prompted until a valid option is given. Similarly, you will be reprompted after giving option ‘H’.

The remaining prompts vary, depending on the type of selection which is being performed. They are discussed with the corresponding type of selection in Section 16.2.

#### 16.2 Types of selections

This section describes the different types of selections available in catselect. The various types of selection are listed in Table 7.

Arbitrary expression
(SELTYP option E).
Select the rows which satisfy an arbitrary mathematical expression. You will be prompted to enter the required expression. Expressions are described in Appendix A. Occasionally you may need to enter an expression which is longer than a single line. Such long expressions can be entered using the continuation line mechanism described in Section 12.2.
Range within a sorted column
(SELTYP option R).
Select rows within a given range of a sorted column. Range selections can be created essentially instantaneously, irrespective of the size of the catalogue. However they can only be created on sorted columns. You will be prompted for the name of the required column and the minimum and maximum values to be included in the range. If the column contains a celestial coordinate in a format that CURSA can recognise (see Appendix B) then the minimum and maximum values can optionally be entered as sexagesimal values in hours or degrees. The usual rules for interpreting sexagesimal values in expressions are followed. For example any of the following three values could be entered and all correspond to the same coordinate:
 3:00:00 (hours) +45:00:00 (degrees) 0.78539816 (radians)
Rectangular area
(SELTYP option A).
Select the rows that lie within a given rectangular area. You will be prompted for the name of the column defining the $x$ axis of the area and then the minimum and maximum $x$ coordinates of the area. Corresponding prompts are then issued for the $y$ axis.
Circular area
(SELTYP option C).
This option, sometimes called a ‘cone search’ (because it finds all the objects in a conical volume), finds all the rows within a specified radius of a given point. It is usually used to find all the rows that lie within a specified angular distance from a given point on the celestial sphere.

You will first be prompted for the names of the column containing the Right Ascension and then the column containing the Declination. Next you will be prompted for the Right Ascension of the central position followed by the central Declination. Finally you will be prompted for the radius of the circle.

The Right Ascension should be entered as a sexagesimal value in hours, the Declination as a sexagesimal value in degrees and the radius as a sexagesimal value in minutes of arc. For example, to specify a search to find objects within twenty-three minutes of arc of Right Ascension $10h\phantom{\rule{0.3em}{0ex}}30m\phantom{\rule{0.3em}{0ex}}00\text{}s\phantom{\rule{0.3em}{0ex}}\phantom{\rule{0.3em}{0ex}}.\text{}0$ and Declination $+35\circ \phantom{\rule{0.3em}{0ex}}2{0}^{\prime }\phantom{\rule{0.3em}{0ex}}00\text{′′}0$ the values entered would be:

 Central Right Ascension: 10:30:00 Central Declination: 35:00:00 Radius: 23:00

If a search radius of twenty-three seconds of arc was required the value entered would be ‘0:23’ (note the leading zero and colon). A decimal point and fractional seconds of arc can be entered if required. For example, twenty-three and a half seconds of arc would be entered as ‘0:23.5’.

Polygonal area
(SELTYP option P).
This option selects all the rows which lie inside a polygon which you specify. The polygon can be of an arbitrary shape and have an arbitrary number of corners. This option might be used to select objects in an irregularly shaped region of sky or to find objects with unusual properties in some two-dimensional space. It could, for example, be used to isolate stars in the red giant branch of a Hertzsprung-Russell diagram.

The coordinates of the polygon corners are read from a CURSA catalogue which you should prepare before running catselect. This polygon catalogue is probably most easily prepared using the STL format (see Appendix C); then it can simply be typed in with a text editor. All that the catalogue needs to contain are the two columns containing the coordinates of the polygon corners. The names of these columns are not fixed; catselect prompts for them. Figure 2 shows an example STL format polygon catalogue. This example is available as file:

/star/share/cursa/polygon.TXT

!+
! Example STL format catalogue of polygon corners.
!
! Each row in the catalogue corresponds to a corner of the polygon.
!
! A C Davenhall (Edinburgh) 31/1/97.
!-

C X REAL 1  ! X coordinates of the polygon corners.
C Y REAL 2  ! Y coordinates of the polygon corners.

BEGINTABLE
35.0   23.0
68.0  122.0
159.0  143.0
174.0   76.0
105.0   68.0

Figure 2: Example STL format catalogue of polygon corners

Once the ‘polygonal area’ option has been selected you will be prompted to enter the names of the columns holding the $x$ and $y$ coordinates in which the polygon is defined in the input catalogue, the name of the polygon catalogue and finally the names of the columns holding the $x$ and $y$ coordinates in the polygon catalogue (X and Y in Figure 2).

Every nth entry
(SELTYP option N).
This option selects every nth row from the input catalogue; you are prompted for the value of n. This simple option is useful for producing a smaller, but representative, sample from a larger catalogue. Such a sample might then be investigated interactively using xcatview (see Section 11) or catview (see Section 12) in the case where the original catalogue was too large for interactive analysis.