CHAPTER 7: Advanced Topics In This Chapter... About Modes... / 85 Table-Row Format / 90 Creating User-Defined Screens / 91 Using Output Files / 94 Retrieving Files from a List of Datasets / 98 Modifying STARCAT-Created SQL Queries / 99 SQL / 101 Once you are comfortable using STARCAT in menu mode with the pre-existing screens, you may want to try some of the additional STARCAT features. About Modes... STARCAT has three modes: o Menu mode o Prompt mode o Readfile mode Menu Mode Most users will want to use menu mode. In menu mode, a box is displayed at the bottom of the screen that lists all of the available commands. Pressing the single-character keystroke listed to the right of the command name will invoke the command. Figure 7.1 shows a command box. Alternatively, you can move through the command list using the cursor keys. Notice that one command is underlined; pressing will invoke the underlined command. Figure 7.1: Command Box Prompt Mode In prompt mode, the system expects you to type the command name, together with the full name of any parameters or options. Minimum matching is supported in the command name, but not in the names of required parameters and options. The advantage of using prompt mode is that you do not need to step through the hierarchical menu screens. For example, to get to the obs screen directly from the top-level menu, you could press to invoke prompt mode, and then type: select post-obs select obs You could also abbreviate this, using minimum matching, to: s post-obs s obs Readfile Mode In readfile mode, you can create a file containing sequences of STARCAT commands that will be invoked by the system as if you had typed them from the command line (like the batch files used in other systems). Your readfile must contain a sequential listing of commands that appear exactly as you would type them if you were interactively running STARCAT (see the example on the next page). An easy way to write your readfiles is to let STARCAT do it for you. Every time you run STARCAT, it creates a file called starcat.log. This file contains every command you used during your session. You can therefore, perform a commonly-needed job, rename your starcat.log file to something else, and then edit it to suit your own needs, perhaps changing the qualifications or comments. To use readfile mode: 1. Write your readfile (or copy and manipulate a starcat.log file). 2. Start STARCAT. 3. Make sure the system is in prompt mode. 4. Type the filename preceded by @. For example, @starcat.log It is also possible to use readfile mode from the STARCAT Utilities menu, though if you do this, you must remember to take into account that you are one level lower than your initial STARCAT screen, so your first readfile command must be exit. The following listing is an example of a readfile that will simply provide a list of files for a given proposal. ! This is a complete readfile, you can copy or modify it ! Comments are marked with an exclamation point (!) ! Log files produced by STARCAT will be filled with comments ! You can delete extraneous comments ! Enter the HST catalog HST ! choose the general screen select general ! Begin the qualification process Qualify !Select proposid from the DMF table exp exp.proposid ! Enter your proposal number below =3755 ! Write output to a file Outfile ! Choose ASCII format ASCII_out ! Enter the name of the output file myfile.tab ! Select fields to be displayed in output file, clearing all ! fields first clear exp.proposid exp.targname exp.dataset_name dsname.release_date ! Exit output mode exit exit ! Search for all datasets from proposal 3755 scan ! Exit starcat exit exit exit Figure 7.2: Sample readfile Searching an Area Around a Centered Position You can use the Center command to search for observations taken within a given radius of a certain position. To do this: 1. Press to specify center. 2. A pop-up window will appear in which you must specify: - Coordinate system - Radius around which to search - Right ascension and declination of center 3. Press when you are done specifying your centering param- eters 4. Qualify on any additional fields of interest (such as release_date) 5. Scan the archive. When you are specifying the centering parameters, you can press (or use cursor keys) to move to the next field or press to clear any current values from the field. Figure 7.3 shows a sample of how values are specified for the center parameters. When specifying the center: o RA and DEC can be in either sexagesimal or decimal format, but the declination must include a sign. o The radius is assumed to be in degrees o The coordinate system can be: - B for FK4 - J for FK5 - G for Galactic - S for Supergalactic - E for Ecliptic Figure 7.3: Specifying a Centering Position and Radius Remember to clear the qualifications in the center box before proceeding with other queries. Otherwise, subsequent searches will retain the positional qualifications specified within this command. Table-Row Format Rather than viewing one catalog record at a time from the data screens, you can view multiple records simultaneously in a tabular row-column format. To do this, press from any data screen (List in prompt mode). Figure 7.4 shows a sample of the tabular format used by STARCAT. Some of the features of this format include: o Define which columns to display by pressing (SelColumns) o View the full data screen for any record by pressing (View/Edit) o X-terminal and workstation users will find that the number of columns displayed will depend on the size of your window. You can show 48 lines at a time by setting the terminal size to 48 before starting STARCAT. On STDATU, you would type stty rows 48, on STDATA, you would type set term/page=48 and then resize the long window. Figure 7.4: Tabular Row-Column Format (List) Creating User-Defined Screens This feature is complex and you may have difficulty with its use. If none of the data screens provided in STARCAT provides a data base view that suits your needs, you can create your own data screen, which is then accessed through the PERSONAL menu. To do this: 1. Move to the top-level HST catalog 2. Press to begin the screen creation process 3. Choose tables. STARCAT will show you the list of data tables in the archive (Figure 7.5) from which you can choose keywords. Press , move down the list using the cursor keys, and type X next to each table you are interested in. When you are done, press , then press to continue. Figure 7.5: Table Selection Screen. 4. Select fields from each of the tables you chose in step 3. The field selection screen (Figure 7.6) shows you the fields available to you. This step works just like step 3. Press to begin choosing fields, move through the field list using the cursor keys, mark the fields that you want on your personal screen by typing X next to the field name, press to bring the menu back up. You may need to use the , , or keys to move through all of the available keywords. Figure 7.6: Field Selection 5. Press to continue 6. Name and describe your personal screen by filling in the blanks (see Figure 7.7) 7. Press to continue Figure 7.7: Naming Personal Screens Once you name the screen and give it a file name, you are done. Go back to the top-level menu and select the PERSONAL menu. Your new screen appears as an option. You can now select your screen and use it to search the HST catalog. Using Output Files As you search the archives, you may wish to save the results of your queries to a table or text format that can be exported for use with other software and hardware. To specify a file format for your output, press from any data screen. The following file formats are supported: o ASCII text o FITS table o MIDAS table o LaTeX In addition to these options, commands are provided to switch the terminal on or off, force blank lines when generating ASCII files, and close files so that you can create multiple output files. (See the description of the output file command menu in Table 8.7 on page 111). Figure 7.8 shows a sample data screen with the options list displayed. Figure 7.8: Output File Menu Regardless of the file format you use, keep in mind that all files must be closed before you can write to another file or use the file in any other way. To do this, you need to go back to the Output menu and press . This might be more clear from the example below that explains how to create an ASCII output file. ASCII Text When you choose the ASCII text output option, you have two formats from which to choose: o Long headers, with fields separated by a | o One-line header, with fields separated by a TAB The format used is determined by the file name extension you give STARCAT when you prompted for a file name. .LIS writes long headers and |-separated fields, .TAB writes tab-separated fields. After typing a file name, a data screen will be shown that has an "X" in each field. An "X" indicates that the field will be written to the output file. Change these to a space if you don't want them written. (Pressing moves you to the next field.) You may want to be careful not to exceed the maximum line length of your preferred editor-typically either 132 or 255 characters. Example of Creating ASCII Output File Let's look at the process of creating an ASCII output text file, one step at a time. 1. Move to the data screen you are interested in. In this example, we will move to the EXP (Completed Observation) screen under the POST-OBS menu. 2. Press to begin the process of creating an output file 3. Press to select ASCII output 4. Type a file name ending with .tab to choose tab-delimited output 5. Mark fields that you want written to the output table with an X, mark fields that you don't want written with a space. (See Figure 7.9). 6. Qualify the fields to define your search criteria (see page 26). 7. Scan the archive (see page 30). The results of the scan are written both to the screen and to your specified output file. 8. Press to get back to the Output file options. 9. Press to close your file. Figure 7.9: Marking Fields to be Written to an Output File FITS When you write your output to a FITS table, you can write out any number of records without having to know in advance how many you intend to write. You will also be able to use your FITS table in either STSDAS (see "Now That You Have Your Data..." on page 43) or MIDAS, running on any platform. MIDAS If you write your output to a MIDAS table, keep in mind that you must know beforehand how many records you will write, and that the output will be a binary table for use with Portable MIDAS only. LaTeX STARCAT can create a LaTeX file of your query results that can be included in another document. The output file will have no \begin{document} and \end{document} bounds, so these must either be added by the user or the file must be included by another LaTeX file. There are three output modes for different LaTeX environments: o List: Generates an enumerated list of items o Tabular: LaTeX table format o Custom: No macros are defined-the user must define the appearance of the output Retrieving Files from a List of Datasets If you have a list of datasets that you created during a previous session, or by using your favorite editor, you can retrieve the datasets using STARCAT. To do so: 1. Do not mark any screens 2. Press from within a menu screen to begin the retrieval process, this brings up the "Retrieve From a List of Datasets" screen shown in Figure 7.10 3. Type the file name containing your list of datasets 4. Proceed with the normal retrieval process (See "Retrieving Files From the Archive" on page 31.) Figure 7.10: Retrieving Files from a List of Datasets Modifying STARCAT-Created SQL Queries For use only by those experienced in SQL. When you qualify fields from data screens, STARCAT generates an SQL query. You can edit this query to perform more powerful or flexible searches than STARCAT can support through its normal menu-oriented query functions, if you are familiar with SQL. To use this feature: 1. Formulate a query as you normally would, using the Qualify command from a data screen (see "Defining Search Criteria" on page 26). 2. Press to display the query in a query-editing window 3. Make changes to the query 4. Press to return to the data screen and preserve your changes 5. Re-run your query; this time the reformulated query will be used When you are formulating your query, you can use the normal arithmetic operations (i.e., +, -, /, *), relational operators (and or or), as well as the following functions: o abs(numeric_expr) o cos(radians) o sin(radians) o exp(float_expr) o log(float_expr) o log10(float_expr) o pi() o power(numeric_expr,pow) o tan(radians) Note that some fields are internally stored in unusual units, either to save storage space or to allow greater accuracy. Some of the units you might need are: o Coordinates are stored in milli-arcseconds o Magnitudes are stored in hundredths of a magnitude o Dates are stored in number of seconds since January 1, 1980, for exam- ple, September 1, 1992, is stored in the data base as 399772800. SQL For use only by those experienced in SQL. If you are familiar with the SQL language and the DMF table structure (see Chapter 11), you can skip the STARCAT user interface and directly query the data archives. To do this: 1. Enter STARCAT as you would normally 2. Press to bring up the Utilities menu 3. Type SQL to invoke the SQL interpreter 85