1funcolumnactivate(3) SAORD Documentation funcolumnactivate(3)
2
3
4
6 FunColumnActivate - activate Funtools columns
7
9 #include <funtools.h>
10
11 void FunColumnActivate(Fun fun, char *s, char *plist)
12
14 The FunColumnActivate() routine determines which columns (set up by
15 FunColumnSelect()) ultimately will be read and/or written. By default,
16 all columns that are selected using FunColumnSelect() are activated.
17 The FunColumnActivate() routine can be used to turn off/off activation
18 of specific columns.
19
20 The first argument is the Fun handle associated with this set of col‐
21 umns. The second argument is a space-delimited list of columns to
22 activate or de-activate. Columns preceded by "+" are activated and col‐
23 umns preceded by a "-" are de-activated. If a column is named without
24 "+" or "-", it is activated. The reserved strings "$region" and '$n'
25 are used to activate a special columns containing the filter region
26 value and row value, respectively, associated with this row. For exam‐
27 ple, if a filter containing two circular regions is specified as part
28 of the Funtools file name, this column will contain a value of 1 or 2,
29 depending on which region that row was in. The reserved strings "$x"
30 and "$y" are used to activate the current binning columns. Thus, if the
31 columns DX and DY are specified as binning columns:
32
33 [sh $] fundisp foo.fits[bincols=(DX,DY)]
34
35 then "$x" and "$y" will refer to these columns in a call to FunColumn‐
36 Activate().
37
38 In addition, if the activation string contains only columns to be acti‐
39 vated, then the routine will de-activate all other columns. Similarly,
40 if the activation string contains only columns to de-activate, then the
41 routine will activate all other columns before activating the list.
42 This makes it simple to change the activation state of all columns
43 without having to know all of the column names. For example:
44
45 · "pi pha time" # only these three columns will be active
46
47 · "-pi -pha -time" # all but these columns will be active
48
49 · "pi -pha" # only pi is active, pha is not, others are not
50
51 · "+pi -pha" # same as above
52
53 · "pi -pha -time" # only pi is active, all others are not
54
55 · "pi pha" # pha and pi are active, all others are not
56
57 · "pi pha -x -y" # pha and pi are active, all others are not
58
59 You can use the column activation list to reorder columns, since col‐
60 umns are output in the order specified. For example:
61
62 # default output order
63 fundisp snr.ev'[cir 512 512 .1]'
64 X Y PHA PI TIME DX DY
65 -------- -------- -------- -------- --------------------- -------- --------
66 512 512 6 7 79493997.45854475 578 574
67 512 512 8 9 79494575.58943175 579 573
68 512 512 5 6 79493631.03866175 578 575
69 512 512 5 5 79493290.86521725 578 575
70 512 512 8 9 79493432.00990875 579 573
71
72 # re-order the output by specifying explicit order
73 fundisp snr.ev'[cir 512 512 .1]' "time x y dy dx pi pha"
74 TIME X Y DY DX PI PHA
75 --------------------- -------- -------- -------- -------- -------- --------
76 79493997.45854475 512 512 574 578 7 6
77 79494575.58943175 512 512 573 579 9 8
78 79493631.03866175 512 512 575 578 6 5
79 79493290.86521725 512 512 575 578 5 5
80 79493432.00990875 512 512 573 579 9 8
81
82 A "+" sign by itself means to activate all columns, so that you can
83 reorder just a few columns without specifying all of them:
84
85 # reorder 3 columns and then output the rest
86 fundisp snr.ev'[cir 512 512 .1]' "time pi pha +"
87 TIME PI PHA Y X DX DY
88 --------------------- -------- -------- -------- -------- -------- --------
89 79493997.45854475 7 6 512 512 578 574
90 79494575.58943175 9 8 512 512 579 573
91 79493631.03866175 6 5 512 512 578 575
92 79493290.86521725 5 5 512 512 578 575
93 79493432.00990875 9 8 512 512 579 573
94
95 The column activation/deactivation is performed in the order of the
96 specified column arguments. This means you can mix "+", "-" (which de-
97 activates all columns) and specific column names to reorder and select
98 columns in one command. For example, consider the following:
99
100 # reorder and de-activate
101 fundisp snr.ev'[cir 512 512 .1]' "time pi pha + -x -y"
102 TIME PI PHA DX DY
103 --------------------- -------- -------- -------- --------
104 79493997.45854475 7 6 578 574
105 79494575.58943175 9 8 579 573
106 79493631.03866175 6 5 578 575
107 79493290.86521725 5 5 578 575
108 79493432.00990875 9 8 579 573
109
110 We first activate "time", "pi", and "pha" so that they are output
111 first. We then activate all of the other columns, and then de-activate
112 "x" and "y". Note that this is different from:
113
114 # probably not what you want ...
115 fundisp snr.ev'[cir 512 512 .1]' "time pi pha -x -y +"
116 TIME PI PHA Y X DX DY
117 --------------------- -------- -------- -------- -------- -------- --------
118 79493997.45854475 7 6 512 512 578 574
119 79494575.58943175 9 8 512 512 579 573
120 79493631.03866175 6 5 512 512 578 575
121 79493290.86521725 5 5 512 512 578 575
122 79493432.00990875 9 8 512 512 579 573
123
124 Here, "x" and "y" are de-activated, but then all columns including "x"
125 and "y" are again re-activated.
126
127 Typically, FunColumnActivate() uses a list of columns that are passed
128 into the program from the command line. For example, the code for
129 funtable contains the following:
130
131 char *cols=NULL;
132
133 /* open the input FITS file */
134 if( !(fun = FunOpen(argv[1], "rc", NULL)) )
135 gerror(stderr, "could not FunOpen input file: %s\n", argv[1]);
136
137 /* set active flag for specified columns */
138 if( argc >= 4 ) cols = argv[3];
139 FunColumnActivate(fun, cols, NULL);
140
141 The FunOpen() call sets the default columns to be all columns in the
142 input file. The FunColumnActivate() call then allows the user to con‐
143 trol which columns ultimately will be activated (i.e., in this case,
144 written to the new file). For example:
145
146 funtable test.ev foo.ev "pi pha time"
147
148 will process only the three columns mentioned, while:
149
150 funtable test.ev foo.ev "-time"
151
152 will process all columns except "time".
153
154 If FunColumnActivate() is called with a null string, then the environ‐
155 ment variable FUN_COLUMNS will be used to provide a global value, if
156 present. This is the reason why we call the routine even if no columns
157 are specified on the command line (see example above), instead of call‐
158 ing it this way:
159
160 /* set active flag for specified columns */
161 if( argc >= 4 ){
162 FunColumnActivate(fun, argv[3], NULL);
163 }
164
166 See funtools(n) for a list of Funtools help pages
167
168
169
170version 1.4.2 January 2, 2008 funcolumnactivate(3)