1 /********************************************************************* 2 Common parameters between all programs. 3 4 IMPORTANT: This header must only be included the programs, not libraries. 5 6 Original author: 7 Mohammad Akhlaghi <mohammad@akhlaghi.org> 8 Contributing author(s): 9 Copyright (C) 2017-2021, Free Software Foundation, Inc. 10 11 Gnuastro is free software: you can redistribute it and/or modify it 12 under the terms of the GNU General Public License as published by the 13 Free Software Foundation, either version 3 of the License, or (at your 14 option) any later version. 15 16 Gnuastro is distributed in the hope that it will be useful, but 17 WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with Gnuastro. If not, see <http://www.gnu.org/licenses/>. 23 **********************************************************************/ 24 #ifndef __GAL_COMMONOPTS_H__ 25 #define __GAL_COMMONOPTS_H__ 26 27 28 29 /* Common options for all programs. 30 31 IMPORTANT NOTE: 32 33 This header should only be included in the programs, not the 34 libraries, and in particular 'options.c'. Because we want each program 35 to have its own allocation of the common options structure. If it is 36 included in options.c, then it will be shared between all the 37 programs. */ 38 struct argp_option gal_commonopts_options[] = 39 { 40 { 41 0, 0, 0, 0, 42 "Input:", 43 GAL_OPTIONS_GROUP_INPUT 44 }, 45 { 46 "hdu", 47 GAL_OPTIONS_KEY_HDU, 48 "STR/INT", 49 0, 50 "Extension name or number of input data.", 51 GAL_OPTIONS_GROUP_INPUT, 52 &cp->hdu, 53 GAL_TYPE_STRING, 54 GAL_OPTIONS_RANGE_ANY, 55 GAL_OPTIONS_NOT_MANDATORY, 56 GAL_OPTIONS_NOT_SET 57 }, 58 { 59 "searchin", 60 GAL_OPTIONS_KEY_SEARCHIN, 61 "STR", 62 0, 63 "Select column(s): 'name', 'unit', 'comment'.", 64 GAL_OPTIONS_GROUP_INPUT, 65 &cp->searchin, 66 GAL_TYPE_STRING, 67 GAL_OPTIONS_RANGE_ANY, 68 GAL_OPTIONS_NOT_MANDATORY, 69 GAL_OPTIONS_NOT_SET, 70 gal_options_read_searchin 71 }, 72 { 73 "ignorecase", 74 GAL_OPTIONS_KEY_IGNORECASE, 75 0, 76 0, 77 "Ignore case in matching/searching columns.", 78 GAL_OPTIONS_GROUP_INPUT, 79 &cp->ignorecase, 80 GAL_OPTIONS_NO_ARG_TYPE, 81 GAL_OPTIONS_RANGE_0_OR_1, 82 GAL_OPTIONS_NOT_MANDATORY, 83 GAL_OPTIONS_NOT_SET 84 }, 85 { 86 "stdintimeout", 87 GAL_OPTIONS_KEY_STDINTIMEOUT, 88 "INT", 89 0, 90 "Micro-seconds to wait for standard input.", 91 GAL_OPTIONS_GROUP_INPUT, 92 &cp->stdintimeout, 93 GAL_TYPE_LONG, 94 GAL_OPTIONS_RANGE_GE_0, 95 GAL_OPTIONS_NOT_MANDATORY, 96 GAL_OPTIONS_NOT_SET 97 }, 98 99 100 101 102 /* Tile grid (tessellation) options. */ 103 { 104 0, 0, 0, 0, 105 "Tessellation (tile grid):", 106 GAL_OPTIONS_GROUP_TESSELLATION 107 }, 108 { 109 "tilesize", 110 GAL_OPTIONS_KEY_TILESIZE, 111 "INT[,INT]", 112 0, 113 "Regular tile size on dim.s (FITS order).", 114 GAL_OPTIONS_GROUP_TESSELLATION, 115 &cp->tl.tilesize, 116 GAL_TYPE_SIZE_T, 117 GAL_OPTIONS_RANGE_GT_0, 118 GAL_OPTIONS_NOT_MANDATORY, 119 GAL_OPTIONS_NOT_SET, 120 gal_options_parse_sizes_reverse 121 }, 122 { 123 "numchannels", 124 GAL_OPTIONS_KEY_NUMCHANNELS, 125 "INT[,..]", 126 0, 127 "No. of channels in dim.s (FITS order).", 128 GAL_OPTIONS_GROUP_TESSELLATION, 129 &cp->tl.numchannels, 130 GAL_TYPE_STRING, 131 GAL_OPTIONS_RANGE_ANY, 132 GAL_OPTIONS_NOT_MANDATORY, 133 GAL_OPTIONS_NOT_SET, 134 gal_options_parse_sizes_reverse 135 }, 136 { 137 "remainderfrac", 138 GAL_OPTIONS_KEY_REMAINDERFRAC, 139 "FLT", 140 0, 141 "Fraction of remainder to split last tile.", 142 GAL_OPTIONS_GROUP_TESSELLATION, 143 &cp->tl.remainderfrac, 144 GAL_TYPE_FLOAT32, 145 GAL_OPTIONS_RANGE_GT_0_LT_1, 146 GAL_OPTIONS_NOT_MANDATORY, 147 GAL_OPTIONS_NOT_SET, 148 }, 149 { 150 "workoverch", 151 GAL_OPTIONS_KEY_WORKOVERCH, 152 0, 153 0, 154 "Work (not tile) over channel edges.", 155 GAL_OPTIONS_GROUP_TESSELLATION, 156 &cp->tl.workoverch, 157 GAL_OPTIONS_NO_ARG_TYPE, 158 GAL_OPTIONS_RANGE_0_OR_1, 159 GAL_OPTIONS_NOT_MANDATORY, 160 GAL_OPTIONS_NOT_SET 161 }, 162 { 163 "checktiles", 164 GAL_OPTIONS_KEY_CHECKTILES, 165 0, 166 0, 167 "Tile IDs in an image, the size of input.", 168 GAL_OPTIONS_GROUP_TESSELLATION, 169 &cp->tl.checktiles, 170 GAL_OPTIONS_NO_ARG_TYPE, 171 GAL_OPTIONS_RANGE_0_OR_1, 172 GAL_OPTIONS_NOT_MANDATORY, 173 GAL_OPTIONS_NOT_SET 174 }, 175 { 176 "oneelempertile", 177 GAL_OPTIONS_KEY_ONEELEMPERTILE, 178 0, 179 0, 180 "Display 1 element/tile, not full input res.", 181 GAL_OPTIONS_GROUP_TESSELLATION, 182 &cp->tl.oneelempertile, 183 GAL_OPTIONS_NO_ARG_TYPE, 184 GAL_OPTIONS_RANGE_0_OR_1, 185 GAL_OPTIONS_NOT_MANDATORY, 186 GAL_OPTIONS_NOT_SET 187 }, 188 { 189 "interponlyblank", 190 GAL_OPTIONS_KEY_INTERPONLYBLANK, 191 0, 192 0, 193 "Only interpolate over the blank tiles.", 194 GAL_OPTIONS_GROUP_TESSELLATION, 195 &cp->interponlyblank, 196 GAL_OPTIONS_NO_ARG_TYPE, 197 GAL_OPTIONS_RANGE_0_OR_1, 198 GAL_OPTIONS_NOT_MANDATORY, 199 GAL_OPTIONS_NOT_SET 200 }, 201 { 202 "interpmetric", 203 GAL_OPTIONS_KEY_INTERPMETRIC, 204 "STR", 205 0, 206 "Interpolation metric (radial, manhattan).", 207 GAL_OPTIONS_GROUP_TESSELLATION, 208 &cp->interpmetric, 209 GAL_TYPE_STRING, 210 GAL_OPTIONS_RANGE_ANY, 211 GAL_OPTIONS_NOT_MANDATORY, 212 GAL_OPTIONS_NOT_SET, 213 gal_options_read_interpmetric 214 }, 215 { 216 "interpnumngb", 217 GAL_OPTIONS_KEY_INTERPNUMNGB, 218 "INT", 219 0, 220 "No. of neighbors to use for interpolation.", 221 GAL_OPTIONS_GROUP_TESSELLATION, 222 &cp->interpnumngb, 223 GAL_TYPE_SIZE_T, 224 GAL_OPTIONS_RANGE_GT_0, 225 GAL_OPTIONS_NOT_MANDATORY, 226 GAL_OPTIONS_NOT_SET 227 }, 228 229 230 231 232 { 233 0, 0, 0, 0, 234 "Output:", 235 GAL_OPTIONS_GROUP_OUTPUT 236 }, 237 { 238 "output", 239 GAL_OPTIONS_KEY_OUTPUT, 240 "STR", 241 0, 242 "Output file name.", 243 GAL_OPTIONS_GROUP_OUTPUT, 244 &cp->output, 245 GAL_TYPE_STRING, 246 GAL_OPTIONS_RANGE_ANY, 247 GAL_OPTIONS_NOT_MANDATORY, 248 GAL_OPTIONS_NOT_SET 249 }, 250 { 251 "type", 252 GAL_OPTIONS_KEY_TYPE, 253 "STR", 254 0, 255 "Type of output: e.g., int16, float32, etc...", 256 GAL_OPTIONS_GROUP_OUTPUT, 257 &cp->type, /* Internally, 'cp->type' is actually an */ 258 GAL_TYPE_STRING, /* 'uint8_t', but the user gives a string. */ 259 GAL_OPTIONS_RANGE_GT_0, /* So for the sanity checks to pass, we */ 260 GAL_OPTIONS_NOT_MANDATORY,/* use 'GAL_TYPE_STRING' for this option. */ 261 GAL_OPTIONS_NOT_SET, 262 gal_options_read_type 263 }, 264 { 265 "tableformat", 266 GAL_OPTIONS_KEY_TABLEFORMAT, 267 "STR", 268 0, 269 "Table fmt: 'fits-ascii', 'fits-binary', 'txt'.", 270 GAL_OPTIONS_GROUP_OUTPUT, 271 &cp->tableformat, 272 GAL_TYPE_STRING, 273 GAL_OPTIONS_RANGE_ANY, 274 GAL_OPTIONS_NOT_MANDATORY, 275 GAL_OPTIONS_NOT_SET, 276 gal_options_read_tableformat 277 }, 278 { 279 "wcslinearmatrix", 280 GAL_OPTIONS_KEY_WCSLINEARMATRIX, 281 "STR", 282 0, 283 "WCS linear matrix of output ('pc' or 'cd').", 284 GAL_OPTIONS_GROUP_OUTPUT, 285 &cp->wcslinearmatrix, 286 GAL_TYPE_STRING, 287 GAL_OPTIONS_RANGE_ANY, 288 GAL_OPTIONS_NOT_MANDATORY, 289 GAL_OPTIONS_NOT_SET, 290 gal_options_read_wcslinearmatrix 291 }, 292 { 293 "dontdelete", 294 GAL_OPTIONS_KEY_DONTDELETE, 295 0, 296 0, 297 "Don't delete output if it exists.", 298 GAL_OPTIONS_GROUP_OUTPUT, 299 &cp->dontdelete, 300 GAL_OPTIONS_NO_ARG_TYPE, 301 GAL_OPTIONS_RANGE_0_OR_1, 302 GAL_OPTIONS_NOT_MANDATORY, 303 GAL_OPTIONS_NOT_SET 304 }, 305 { 306 "keepinputdir", 307 GAL_OPTIONS_KEY_KEEPINPUTDIR, 308 0, 309 0, 310 "Keep input directory for automatic output.", 311 GAL_OPTIONS_GROUP_OUTPUT, 312 &cp->keepinputdir, 313 GAL_OPTIONS_NO_ARG_TYPE, 314 GAL_OPTIONS_RANGE_0_OR_1, 315 GAL_OPTIONS_NOT_MANDATORY, 316 GAL_OPTIONS_NOT_SET 317 }, 318 319 320 321 322 323 { 324 0, 0, 0, 0, 325 "Operating modes:", 326 GAL_OPTIONS_GROUP_OPERATING_MODE 327 }, 328 { 329 "quiet", 330 GAL_OPTIONS_KEY_QUIET, 331 0, 332 0, 333 "Only report errors, remain quiet about steps.", 334 GAL_OPTIONS_GROUP_OPERATING_MODE, 335 &cp->quiet, 336 GAL_OPTIONS_NO_ARG_TYPE, 337 GAL_OPTIONS_RANGE_0_OR_1, 338 GAL_OPTIONS_NOT_MANDATORY, 339 GAL_OPTIONS_NOT_SET 340 }, 341 { 342 "numthreads", 343 GAL_OPTIONS_KEY_NUMTHREADS, 344 "INT", 345 0, 346 "Number of CPU threads to use.", 347 GAL_OPTIONS_GROUP_OPERATING_MODE, 348 &cp->numthreads, 349 GAL_TYPE_SIZE_T, 350 GAL_OPTIONS_RANGE_GE_0, 351 GAL_OPTIONS_NOT_MANDATORY, 352 GAL_OPTIONS_NOT_SET 353 }, 354 { 355 "minmapsize", 356 GAL_OPTIONS_KEY_MINMAPSIZE, 357 "INT", 358 0, 359 "Min. bytes to avoid RAM automatically.", 360 GAL_OPTIONS_GROUP_OPERATING_MODE, 361 &cp->minmapsize, 362 GAL_TYPE_SIZE_T, 363 GAL_OPTIONS_RANGE_GE_0, 364 GAL_OPTIONS_NOT_MANDATORY, 365 GAL_OPTIONS_NOT_SET 366 }, 367 { 368 "quietmmap", 369 GAL_OPTIONS_KEY_QUIETMMAP, 370 0, 371 0, 372 "Don't print mmap'd file's name and size.", 373 GAL_OPTIONS_GROUP_OPERATING_MODE, 374 &cp->quietmmap, 375 GAL_OPTIONS_NO_ARG_TYPE, 376 GAL_OPTIONS_RANGE_0_OR_1, 377 GAL_OPTIONS_NOT_MANDATORY, 378 GAL_OPTIONS_NOT_SET 379 }, 380 { 381 "log", 382 GAL_OPTIONS_KEY_LOG, 383 0, 384 0, 385 "Information about output(s) in a log file.", 386 GAL_OPTIONS_GROUP_OPERATING_MODE, 387 &cp->log, 388 GAL_OPTIONS_NO_ARG_TYPE, 389 GAL_OPTIONS_RANGE_0_OR_1, 390 GAL_OPTIONS_NOT_MANDATORY, 391 GAL_OPTIONS_NOT_SET 392 }, 393 394 395 396 /* Internal (before control goes back to the program). */ 397 { 398 "cite", 399 GAL_OPTIONS_KEY_CITE, 400 0, 401 0, 402 "BibTeX citation for this program.", 403 GAL_OPTIONS_GROUP_OPERATING_MODE, 404 NULL, 405 GAL_OPTIONS_NO_ARG_TYPE, 406 GAL_OPTIONS_RANGE_0_OR_1, 407 GAL_OPTIONS_NOT_MANDATORY, 408 GAL_OPTIONS_NOT_SET, 409 gal_options_print_citation 410 }, 411 { 412 "printparams", 413 GAL_OPTIONS_KEY_PRINTPARAMS, 414 0, 415 0, 416 "Print parameter values to be used and abort.", 417 GAL_OPTIONS_GROUP_OPERATING_MODE, 418 &cp->printparams, 419 GAL_OPTIONS_NO_ARG_TYPE, 420 GAL_OPTIONS_RANGE_0_OR_1, 421 GAL_OPTIONS_NOT_MANDATORY, 422 GAL_OPTIONS_NOT_SET 423 }, 424 { 425 "config", 426 GAL_OPTIONS_KEY_CONFIG, 427 "STR", 428 0, 429 "Read configuration file STR immediately.", 430 GAL_OPTIONS_GROUP_OPERATING_MODE, 431 NULL, 432 GAL_TYPE_STRING, 433 GAL_OPTIONS_RANGE_ANY, 434 GAL_OPTIONS_NOT_MANDATORY, 435 GAL_OPTIONS_NOT_SET, 436 gal_options_call_parse_config_file 437 }, 438 { 439 "checkconfig", 440 GAL_OPTIONS_KEY_CHECKCONFIG, 441 0, 442 0, 443 "List all config files and variables read.", 444 GAL_OPTIONS_GROUP_OPERATING_MODE, 445 &cp->checkconfig, 446 GAL_OPTIONS_NO_ARG_TYPE, 447 GAL_OPTIONS_RANGE_0_OR_1, 448 GAL_OPTIONS_NOT_MANDATORY, 449 GAL_OPTIONS_NOT_SET, 450 gal_options_check_config 451 }, 452 { 453 "setdirconf", 454 GAL_OPTIONS_KEY_SETDIRCONF, 455 0, 456 0, 457 "Set default values for this directory and abort.", 458 GAL_OPTIONS_GROUP_OPERATING_MODE, 459 &cp->setdirconf, 460 GAL_OPTIONS_NO_ARG_TYPE, 461 GAL_OPTIONS_RANGE_0_OR_1, 462 GAL_OPTIONS_NOT_MANDATORY, 463 GAL_OPTIONS_NOT_SET 464 }, 465 { 466 "setusrconf", 467 GAL_OPTIONS_KEY_SETUSRCONF, 468 0, 469 0, 470 "Set default values for this user and abort.", 471 GAL_OPTIONS_GROUP_OPERATING_MODE, 472 &cp->setusrconf, 473 GAL_OPTIONS_NO_ARG_TYPE, 474 GAL_OPTIONS_RANGE_0_OR_1, 475 GAL_OPTIONS_NOT_MANDATORY, 476 GAL_OPTIONS_NOT_SET 477 }, 478 { 479 "lastconfig", 480 GAL_OPTIONS_KEY_LASTCONFIG, 481 0, 482 0, 483 "Do not parse any more configuration files.", 484 GAL_OPTIONS_GROUP_OPERATING_MODE, 485 &cp->lastconfig, 486 GAL_OPTIONS_NO_ARG_TYPE, 487 GAL_OPTIONS_RANGE_0_OR_1, 488 GAL_OPTIONS_NOT_MANDATORY, 489 GAL_OPTIONS_NOT_SET 490 }, 491 { 492 "onlyversion", 493 GAL_OPTIONS_KEY_ONLYVERSION, 494 "STR", 495 0, 496 "Only run if the program version is STR.", 497 GAL_OPTIONS_GROUP_OPERATING_MODE, 498 &cp->onlyversion, 499 GAL_TYPE_STRING, 500 GAL_OPTIONS_RANGE_0_OR_1, 501 GAL_OPTIONS_NOT_MANDATORY, 502 GAL_OPTIONS_NOT_SET, 503 gal_options_check_version 504 }, 505 506 507 508 {0} 509 }; 510 511 #endif 512