Changeset 46
- Timestamp:
- Feb 14, 2003, 2:03:17 AM (23 years ago)
- Location:
- trunk/Ohana/src/perl/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/perl/src/mkdetrend
r17 r46 1 1 #!/usr/bin/perl 2 $MKDETREND = "mkdetrend2"; 2 3 3 4 # strip off args related to the elixir config system, set env PTOLEMY … … 6 7 # interpret command-line arguments 7 8 if (@ARGV < 1) { 8 print STDOUT "USAGE: mkdetrend(mode) [arguments]\n";9 print STDOUT "mode = help gives a complete list\n";10 &escape;9 print STDOUT "USAGE: $MKDETREND (mode) [arguments]\n"; 10 print STDOUT "mode = help gives a complete list\n"; 11 &escape; 11 12 } 12 13 if ($ARGV[0] eq "help") { &usage; } … … 57 58 if ($ARGV[0] eq "test") { &mk_test; } 58 59 59 &escape ("invalid mkdetrendcommand $ARGV[0]");60 &escape ("invalid $MKDETREND command $ARGV[0]"); 60 61 61 62 ######## top level functions ###################### 63 64 sub mk_test { 65 66 print "Content-type: text/plain\n\n"; 67 68 print "mkdetrend2\n"; 69 exit 0; 70 } 62 71 63 72 ############# define run ############## 64 73 sub mk_create { 65 74 if ($ARGV[1] eq "run") { &mk_createrun; } 66 if (@ARGV != 5) { &escape ("USAGE: mkdetrendcreate (camera) (run) (startdate) (stopdate)"); }75 if (@ARGV != 5) { &escape ("USAGE: $MKDETREND create (camera) (run) (startdate) (stopdate)"); } 67 76 68 77 $camera = $ARGV[1]; … … 115 124 ############# define run ############## 116 125 sub mk_createrun { 117 if (@ARGV != 3) { &escape ("USAGE: mkdetrendcreate run (run)"); }118 if ($ARGV[1] ne "run") { &escape ("USAGE: mkdetrendcreate run (run)"); }126 if (@ARGV != 3) { &escape ("USAGE: $MKDETREND create run (run)"); } 127 if ($ARGV[1] ne "run") { &escape ("USAGE: $MKDETREND create run (run)"); } 119 128 120 129 $run = $ARGV[2]; … … 157 166 ############# change current run ############## 158 167 sub mk_config { 159 if (@ARGV != 3) { &escape ("USAGE: mkdetrendconfig (camera) (run)"); }168 if (@ARGV != 3) { &escape ("USAGE: $MKDETREND config (camera) (run)"); } 160 169 161 170 $camera = $ARGV[1]; … … 177 186 my ($start, $stop, $mode); 178 187 179 if ((@ARGV != 2) && (@ARGV != 3)) { &escape ("USAGE: mkdetrendauto [command]"); }188 if ((@ARGV != 2) && (@ARGV != 3)) { &escape ("USAGE: $MKDETREND auto [command]"); } 180 189 $command = $ARGV[1]; 181 190 182 191 ($start, $stop, $mode) = load_dates (); 183 192 if ($command eq "set") { 184 if (@ARGV != 3) { &escape ("USAGE: mkdetrendauto set (mode)"); }193 if (@ARGV != 3) { &escape ("USAGE: $MKDETREND auto set (mode)"); } 185 194 &save_dates ($start, $stop, $ARGV[2]); 186 195 &goodbye; 187 196 } 188 197 189 if (@ARGV != 2) { &escape ("USAGE: mkdetrendauto [command]"); }198 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND auto [command]"); } 190 199 if ($command eq "show") { 191 200 print STDERR "MODE : $mode\n"; … … 195 204 if ($command eq "run") { 196 205 if ($mode eq "init") { 197 system (" mkdetrendreset hard");198 system (" mkdetrendinit");199 system (" mkdetrendrun");206 system ("$MKDETREND reset hard"); 207 system ("$MKDETREND init"); 208 system ("$MKDETREND run"); 200 209 &save_dates ($start, $stop, "init"); 201 210 &goodbye; … … 203 212 204 213 if ($mode eq "update") { 205 system (" mkdetrendupdate");214 system ("$MKDETREND update"); 206 215 &save_dates ($start, $stop, "update"); 207 216 &goodbye; … … 212 221 } 213 222 } 214 &escape (" mkdetrendauto $command : command not found\n");223 &escape ("$MKDETREND auto $command : command not found\n"); 215 224 } 216 225 217 226 ############# main run ############## 218 227 sub mk_run { 219 if (@ARGV != 1) { &escape ("USAGE: mkdetrendrun"); }220 221 system ("mkdetrendflips");222 system ("mkdetrendnorm");223 system ("mkdetrendmerge");224 225 &goodbye;228 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND run"); } 229 230 system ("$MKDETREND flips"); 231 system ("$MKDETREND norm"); 232 system ("$MKDETREND merge"); 233 234 &goodbye; 226 235 } 227 236 228 237 ############# main init ############## 229 238 sub mk_init { 230 if (@ARGV != 1) { &escape ("USAGE: mkdetrendinit"); }231 232 system ("mkdetrendlist.init");233 system ("mkdetrendsplit");234 235 &goodbye;239 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND init"); } 240 241 system ("$MKDETREND list.init"); 242 system ("$MKDETREND split"); 243 244 &goodbye; 236 245 } 237 246 238 247 ############# main update ############## 239 248 sub mk_update { 240 if (@ARGV != 1) { &escape ("USAGE: mkdetrendupdate"); }241 242 system ("mkdetrendreset update");243 system ("mkdetrendinit");244 system ("mkdetrendupdate.list");245 system ("mkdetrendupdate.stats");246 system ("mkdetrendrun");247 248 &goodbye;249 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND update"); } 250 251 system ("$MKDETREND reset update"); 252 system ("$MKDETREND init"); 253 system ("$MKDETREND update.list"); 254 system ("$MKDETREND update.stats"); 255 system ("$MKDETREND run"); 256 257 &goodbye; 249 258 } 250 259 251 260 ############# show current state ############## 252 261 sub mk_state { 253 if (@ARGV != 1) { &escape ("USAGE: mkdetrendstate"); }254 262 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND state"); } 263 255 264 $file = mkfiles ("dates"); 256 265 if (! -e $file) { … … 268 277 269 278 @list = &load_config; 270 if (@list == 0) { &escape (" mkdetrendnot configured"); }279 if (@list == 0) { &escape ("$MKDETREND not configured"); } 271 280 272 281 for ($i = 0; $i < @list; $i++) { … … 278 287 ############# show current state ############## 279 288 sub mk_list_runs { 280 if (@ARGV != 1) { &escape ("USAGE: mkdetrendlist.runs"); }281 282 system ("ls $root");283 &goodbye;289 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND list.runs"); } 290 291 system ("ls $root"); 292 &goodbye; 284 293 } 285 294 … … 287 296 sub mk_dup { 288 297 if (@ARGV != 2) { &escape ("USAGE: detrend dup (config)"); } 289 290 $key = $ARGV[1];291 @list = load_config ();292 293 # look for entry that matches requested config294 @match = ();295 for ($i = 0; $i < @list; $i++) {296 $config = gtconfig ($list[$i], "config");297 if ($key eq $config) { @match = (@match, $i); }298 }299 if (@match == 0) { &escape ("config $key not found\n"); }300 301 # create new config version based on version 0302 $Nnew = @match;303 $old = $list[$match[0]];304 $new = stconfig ($old, "version", $Nnew);305 @list = (@list, $new);306 save_config (@list);307 308 # now we need to duplicate all of the reference files from the first config309 for ($i = 0; $i < $Nccd; $i++) {310 $fold = mknames ("master", $old, $ccds[$i]);311 $fnew = mknames ("master", $new, $ccds[$i]);312 system ("cp $fold $fnew");313 }314 foreach $name ("stats", "medbin", "tenbin", "imbin") {315 $fold = mknames ($name, $old);316 $fnew = mknames ($name, $new);317 system ("cp $fold $fnew");318 }319 320 &goodbye;321 298 299 $key = $ARGV[1]; 300 @list = load_config (); 301 302 # look for entry that matches requested config 303 @match = (); 304 for ($i = 0; $i < @list; $i++) { 305 $config = gtconfig ($list[$i], "config"); 306 if ($key eq $config) { @match = (@match, $i); } 307 } 308 if (@match == 0) { &escape ("config $key not found\n"); } 309 310 # create new config version based on version 0 311 $Nnew = @match; 312 $old = $list[$match[0]]; 313 $new = stconfig ($old, "version", $Nnew); 314 @list = (@list, $new); 315 save_config (@list); 316 317 # now we need to duplicate all of the reference files from the first config 318 foreach $ccd (@ccds) { 319 $fold = mknames ("master", $old, $ccd); 320 $fnew = mknames ("master", $new, $ccd); 321 system ("cp $fold $fnew"); 322 } 323 foreach $name ("stats", "medbin", "tenbin", "imbin") { 324 $fold = mknames ($name, $old); 325 $fnew = mknames ($name, $new); 326 system ("cp $fold $fnew"); 327 } 328 329 &goodbye; 330 322 331 } 323 332 … … 365 374 } 366 375 367 # delete files names in these files :376 # delete files names in these files (not needed with flips2) 368 377 $name = &mknames ("msplit", $confline, $ccd); 369 378 open (FILE, "$name"); … … 398 407 ############## delete config ############### 399 408 sub mk_del { 400 if (@ARGV != 2) { &escape ("USAGE: mkdetrenddel (config.ver)"); }401 402 $key = $ARGV[1];403 @list = load_config ();404 405 # look for entry that matches requested config406 $match = -1;407 for ($i = 0; $i < @list; $i++) {408 $version = gtconfig ($list[$i], "version");409 if ($key eq $version) {410 $match = $i;411 last;412 }413 }414 if ($match == -1) {415 print STDERR "config.ver $key not found\n";416 &escape;417 }418 419 # create new list without match:420 @newlist = ();421 for ($i = 0; $i < @list; $i++) {422 if ($i == $match) { next; }423 @newlist = (@newlist, $list[$i]);424 }425 426 save_config (@newlist);427 &goodbye;428 409 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND del (config.ver)"); } 410 411 $key = $ARGV[1]; 412 @list = load_config (); 413 414 # look for entry that matches requested config 415 $match = -1; 416 for ($i = 0; $i < @list; $i++) { 417 $version = gtconfig ($list[$i], "version"); 418 if ($key eq $version) { 419 $match = $i; 420 last; 421 } 422 } 423 if ($match == -1) { 424 print STDERR "config.ver $key not found\n"; 425 &escape; 426 } 427 428 # create new list without match: 429 @newlist = (); 430 for ($i = 0; $i < @list; $i++) { 431 if ($i == $match) { next; } 432 @newlist = (@newlist, $list[$i]); 433 } 434 435 save_config (@newlist); 436 &goodbye; 437 429 438 } 430 439 431 440 ############## reset config ############### 432 441 sub mk_reset { 433 if (@ARGV != 2) {434 print STDERR "USAGE: mkdetrendreset (level)\n";435 print STDERR " level = hard || update\n";436 &escape;437 }438 439 $level = $ARGV[1];440 @list = load_config ();441 442 # find specific config:442 if (@ARGV != 2) { 443 print STDERR "USAGE: $MKDETREND reset (level)\n"; 444 print STDERR " level = hard || update\n"; 445 &escape; 446 } 447 448 $level = $ARGV[1]; 449 @list = load_config (); 450 451 # find specific config: 443 452 RESET: 444 foreach $confline (@list) {445 $status = gtconfig ($confline, "status");446 447 if ($level eq "hard" ) {448 $confline = stconfig ($confline, "status", "init");449 }450 if ($level eq "update") {451 if (($status eq "done.merge") || ($status eq "modified") || ($status eq "update")) {452 $confline = stconfig ($confline, "status", "update");453 next RESET;454 }455 if (($status eq "freeze") || ($status eq "accepted")) {456 $confline = stconfig ($confline, "status", "freeze");457 next RESET;458 }459 $confline = stconfig ($confline, "status", "init");460 }461 }462 save_config (@list);463 &goodbye;453 foreach $confline (@list) { 454 $status = gtconfig ($confline, "status"); 455 456 if ($level eq "hard" ) { 457 $confline = stconfig ($confline, "status", "init"); 458 } 459 if ($level eq "update") { 460 if (($status eq "done.merge") || ($status eq "modified") || ($status eq "update")) { 461 $confline = stconfig ($confline, "status", "update"); 462 next RESET; 463 } 464 if (($status eq "freeze") || ($status eq "accepted")) { 465 $confline = stconfig ($confline, "status", "freeze"); 466 next RESET; 467 } 468 $confline = stconfig ($confline, "status", "init"); 469 } 470 } 471 save_config (@list); 472 &goodbye; 464 473 } 465 474 466 475 ############## define config ############### 467 476 sub mk_def { 468 if (@ARGV != 4) { &escape ("USAGE: mkdetrenddef (config.ver) (start) (stop)"); }469 470 $key = $ARGV[1];471 $start = $ARGV[2];472 $stop = $ARGV[3];473 474 @list = load_config ();475 476 # find specific config:477 $match = -1;478 for ($i = 0; $i < @list; $i++) {479 $version = gtconfig ($list[$i], "version");480 if ($key eq $version) {481 $match = $i;482 }483 }484 if (@match == -1) {485 print STDERR "config.ver $key not found\n";486 &escape;487 }488 489 $new = $list[$match];490 $new = stconfig ($new, "start", $start);491 $new = stconfig ($new, "stop", $stop);492 $list[$match] = $new;493 494 save_config (@list);495 &goodbye;496 477 if (@ARGV != 4) { &escape ("USAGE: $MKDETREND def (config.ver) (start) (stop)"); } 478 479 $key = $ARGV[1]; 480 $start = $ARGV[2]; 481 $stop = $ARGV[3]; 482 483 @list = load_config (); 484 485 # find specific config: 486 $match = -1; 487 for ($i = 0; $i < @list; $i++) { 488 $version = gtconfig ($list[$i], "version"); 489 if ($key eq $version) { 490 $match = $i; 491 } 492 } 493 if (@match == -1) { 494 print STDERR "config.ver $key not found\n"; 495 &escape; 496 } 497 498 $new = $list[$match]; 499 $new = stconfig ($new, "start", $start); 500 $new = stconfig ($new, "stop", $stop); 501 $list[$match] = $new; 502 503 save_config (@list); 504 &goodbye; 505 497 506 } 498 507 499 508 ############## list init ############### 500 509 sub mk_list_init { 501 if (@ARGV != 1) { &escape ("USAGE: mkdetrendlist.init"); }502 503 @list = load_config ();504 505 # create namelist506 $Nrun = 0;507 $file = mkfiles ("list");508 open (FILE, ">$file");509 foreach $confline (@list) {510 $status = gtconfig ($confline, "status");511 if ($status ne "init") { next; }512 $Nrun ++;513 $line = gtconfig ($confline, "mosaic");514 print FILE "$line\n";515 $confline = stconfig ($confline, "status", "running.init");516 }517 close (FILE);518 save_config (@list);519 520 if ($Nrun == 0) { &goodbye; }521 522 system ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending imselect.split $file");523 system ("mkdetrendmeval init");524 525 &goodbye;510 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND list.init"); } 511 512 @list = load_config (); 513 514 # create namelist 515 $Nrun = 0; 516 $file = mkfiles ("list"); 517 open (FILE, ">$file"); 518 foreach $confline (@list) { 519 $status = gtconfig ($confline, "status"); 520 if ($status ne "init") { next; } 521 $Nrun ++; 522 $line = gtconfig ($confline, "mosaic"); 523 print FILE "$line\n"; 524 $confline = stconfig ($confline, "status", "running.init"); 525 } 526 close (FILE); 527 save_config (@list); 528 529 if ($Nrun == 0) { &goodbye; } 530 531 vsystem ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending imselect.split $file"); 532 system ("$MKDETREND meval init"); 533 534 &goodbye; 526 535 } 527 536 528 537 ############## split ############### 529 538 sub mk_split { 530 if (@ARGV != 1) { &escape ("USAGE: mkdetrendsplit"); }531 532 @list = load_config ();533 534 # create namelist535 $Nrun = 0;536 $file = mkfiles ("list");537 open (FILE, ">$file");538 foreach $confline (@list) {539 $status = gtconfig ($confline, "status");540 if (($status ne "done.init") && ($status ne "split")) { next; }541 $Nrun ++;542 for ($j = 0; $j < $Nccd; $j++) {543 $line = gtconfig ($confline, "chiprun", $j);544 print FILE "$line\n";545 }546 $confline = stconfig ($confline, "status", "running.split");547 }548 close (FILE);549 save_config (@list);550 551 if ($Nrun == 0) { &goodbye; }552 553 system ("elixir -D DETREND_DIR $det -D mode mkdetrend -D global.pending split.mef$file");554 system ("mkdetrendeval split");555 556 &goodbye;539 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND split"); } 540 541 @list = load_config (); 542 543 # create namelist 544 $Nrun = 0; 545 $file = mkfiles ("list"); 546 open (FILE, ">$file"); 547 foreach $confline (@list) { 548 $status = gtconfig ($confline, "status"); 549 if (($status ne "done.init") && ($status ne "split")) { next; } 550 $Nrun ++; 551 foreach $ccd (@ccds) { 552 $line = gtconfig ($confline, "chiprun", $ccd); 553 print FILE "$line\n"; 554 } 555 $confline = stconfig ($confline, "status", "running.split"); 556 } 557 close (FILE); 558 save_config (@list); 559 560 if ($Nrun == 0) { &goodbye; } 561 562 system ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending merge.lists $file"); 563 system ("$MKDETREND eval split"); 564 565 &goodbye; 557 566 } 558 567 559 568 ############## update lists ############### 560 569 sub mk_update_list { 561 if (@ARGV != 1) { &escape ("USAGE: mkdetrendupdate.list"); }562 563 @list = load_config ();564 565 # create namelist566 $Nrun = 0;567 $file = mkfiles ("list");568 open (FILE, ">$file");569 foreach $confline (@list) {570 $status = gtconfig ($confline, "status");571 if ($status ne "update") { next; }572 $Nrun ++;573 $line = gtconfig ($confline, "mosaic");574 print FILE "$line\n";575 $confline = stconfig ($confline, "status", "running.update.list");576 }577 close (FILE);578 save_config (@list);579 580 if ($Nrun == 0) { &goodbye; }581 582 system ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending update.split $file");583 system ("mkdetrendmeval update.list");584 585 &goodbye;570 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND update.list"); } 571 572 @list = load_config (); 573 574 # create namelist 575 $Nrun = 0; 576 $file = mkfiles ("list"); 577 open (FILE, ">$file"); 578 foreach $confline (@list) { 579 $status = gtconfig ($confline, "status"); 580 if ($status ne "update") { next; } 581 $Nrun ++; 582 $line = gtconfig ($confline, "mosaic"); 583 print FILE "$line\n"; 584 $confline = stconfig ($confline, "status", "running.update.list"); 585 } 586 close (FILE); 587 save_config (@list); 588 589 if ($Nrun == 0) { &goodbye; } 590 591 system ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending update.split $file"); 592 system ("$MKDETREND meval update.list"); 593 594 &goodbye; 586 595 } 587 596 588 597 ############## update stats ############### 589 598 sub mk_update_stats { 590 if (@ARGV != 1) { &escape ("USAGE: mkdetrendupdate.stats"); }591 592 @list = load_config ();593 594 # create namelist595 $Nrun = 0;596 $file = mkfiles ("list");597 open (FILE, ">$file");598 foreach $confline (@list) {599 $status = gtconfig ($confline, "status");600 if (($status ne "done.update.list") && ($status ne "update.stats")) { next; }601 $Nrun ++;602 for ($j = 0; $j < $Nccd; $j++) {603 $line = gtconfig ($confline, "chiprun", $j);604 print FILE "$line\n";605 }606 $confline = stconfig ($confline, "status", "running.update.stats");607 608 }609 close (FILE);610 save_config (@list);611 612 if ($Nrun == 0) { &goodbye; }613 614 system ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending update.msplit $file");615 system ("mkdetrendeval update.stats");616 617 &goodbye;599 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND update.stats"); } 600 601 @list = load_config (); 602 603 # create namelist 604 $Nrun = 0; 605 $file = mkfiles ("list"); 606 open (FILE, ">$file"); 607 foreach $confline (@list) { 608 $status = gtconfig ($confline, "status"); 609 if (($status ne "done.update.list") && ($status ne "update.stats")) { next; } 610 $Nrun ++; 611 foreach $ccd (@ccds) { 612 $line = gtconfig ($confline, "chiprun", $ccd); 613 print FILE "$line\n"; 614 } 615 $confline = stconfig ($confline, "status", "running.update.stats"); 616 617 } 618 close (FILE); 619 save_config (@list); 620 621 if ($Nrun == 0) { &goodbye; } 622 623 system ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending update.msplit $file"); 624 system ("$MKDETREND eval update.stats"); 625 626 &goodbye; 618 627 } 619 628 620 629 ############## set state ############### 621 630 sub mk_set { 622 if (@ARGV != 3) { &escape ("USAGE: mkdetrendset (config number) (state)"); }623 624 @list = load_config ();625 626 $key = $ARGV[1];627 $state = $ARGV[2];628 629 $new = stconfig ($list[$key], "status", "$state");630 $list[$key] = $new;631 save_config (@list);632 633 &goodbye;631 if (@ARGV != 3) { &escape ("USAGE: $MKDETREND set (config number) (state)"); } 632 633 @list = load_config (); 634 635 $key = $ARGV[1]; 636 $state = $ARGV[2]; 637 638 $new = stconfig ($list[$key], "status", "$state"); 639 $list[$key] = $new; 640 save_config (@list); 641 642 &goodbye; 634 643 } 635 644 636 645 ############## flips run ############### 637 646 sub mk_flips { 638 if (@ARGV != 1) { &escape ("USAGE: mkdetrendflips"); }647 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND flips"); } 639 648 640 649 @list = load_config (); … … 648 657 if (($status ne "done.split") && ($status ne "modified") && ($status ne "flips")) { next; } 649 658 $Nrun ++; 650 for ($j = 0; $j < $Nccd; $j++) {651 $line = gtconfig ($confline, "chiprun", $ j);659 foreach $ccd (@ccds) { 660 $line = gtconfig ($confline, "chiprun", $ccd); 652 661 print FILE "$line\n"; 653 662 } … … 659 668 if ($Nrun == 0) { &goodbye; } 660 669 661 system ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending create.subset $file");662 system (" mkdetrendeval flips");670 system ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending create.subset $file"); 671 system ("$MKDETREND eval flips"); 663 672 664 673 &goodbye; … … 667 676 ############## norm run ############### 668 677 sub mk_norm { 669 if (@ARGV != 1) { &escape ("USAGE: mkdetrendnorm"); }678 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND norm"); } 670 679 671 680 @list = load_config (); … … 679 688 if (($status ne "done.flips") && ($status ne "norm")) { next; } 680 689 $Nrun ++; 681 for ($j = 0; $j < $Nccd; $j++) {682 $line = gtconfig ($confline, "chiprun", $ j);690 foreach $ccd (@ccds) { 691 $line = gtconfig ($confline, "chiprun", $ccd); 683 692 print FILE "$line\n"; 684 693 } … … 690 699 if ($Nrun == 0) { &goodbye; } 691 700 692 vsystem ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending normal $file");693 vsystem (" mkdetrendeval norm");701 vsystem ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending normal $file"); 702 vsystem ("$MKDETREND eval norm"); 694 703 695 704 &goodbye; … … 698 707 ############## merge run ############### 699 708 sub mk_merge { 700 if (@ARGV != 1) { &escape ("USAGE: mkdetrendmerge"); }709 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND merge"); } 701 710 702 711 @list = load_config (); … … 719 728 if ($Nrun == 0) { &goodbye; } 720 729 721 vsystem ("elixir -D DETREND_DIR $det -D mode mkdetrend-D global.pending stats $file");722 vsystem (" mkdetrendmeval merge");730 vsystem ("elixir -D DETREND_DIR $det -D mode $MKDETREND -D global.pending stats $file"); 731 vsystem ("$MKDETREND meval merge"); 723 732 724 733 &goodbye; … … 727 736 ############## reg run ############### 728 737 sub mk_reg { 729 if (@ARGV != 1) { &escape ("USAGE: mkdetrend reg"); } 730 731 @list = load_config (); 732 738 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND reg"); } 739 740 @list = load_config (); 741 742 # create directory for fhtool to work in 743 $links = mkfiles ("links"); 744 if (! -e $links) { mkdir ($links); } 745 733 746 # create namelist for those with appropriate status 734 747 foreach $confline (@list) { … … 740 753 $success = 1; 741 754 $ID = gtconfig ($confline, "ID"); 742 for ($j = 0; $j < $Nccd; $j++) { 743 $file = mknames ("norm", $confline, $ccds[$j]); 744 $line = "detregister $file -label elixir -ID $ID"; 745 $status = system ($line); 746 if ($status) { 747 print STDERR "error registering $file\n"; 748 $success = 0; 755 756 $DBmode = `gconfig DETREND-DB-MODE`; chop $DBmode; 757 $DBmode = "\U$DBmode\E"; 758 759 if ($DBmode eq "SPLIT") { 760 for ($j = 0; $j < $Nccd; $j++) { 761 $file = mknames ("norm", $confline, $ccds[$j]); 762 $line = "detregister $file -label elixir -ID $ID"; 763 $status = system ($line); 764 if ($status) { 765 print STDERR "error registering $file\n"; 766 $success = 0; 767 } 749 768 } 750 } 751 if ($success) { 769 goto registered; 770 } 771 772 if ($DBmode eq "MEF") { 773 # make links 774 foreach $ccd (@ccds) { 775 $file = mknames ("norm", $confline, $ccd); 776 $link = mknames ("link", $confline, $ccd); 777 symlink $file, $link; 778 } 779 780 # mef, register 781 $mef = mknames ("mef", $confline); 782 vsystem ("fhtool -P $links $mef"); 783 if ($status) { $success = 0; } 784 vsystem ("detregister $mef -label elixir -ID $ID"); 785 if ($status) { $success = 0; } 786 787 # remove links 788 foreach $ccd (@ccds) { 789 $link = mknames ("link", $confline, $ccd); 790 unlink $link; 791 } 792 goto registered; 793 } 794 print STDERR "DB mode not defined?\n"; 795 $success = 0; 796 797 registered: 798 if ($success) { 752 799 $confline = stconfig ($confline, "status", "done.reg"); 753 800 } else { 801 print STDERR "error registering $file\n"; 754 802 $confline = stconfig ($confline, "status", "fail.reg"); 755 803 } 756 804 save_config (@list); 757 } 758 759 # detregister is sequential anyway, run serial 760 # system ("elixir -D DETREND_DIR $det -D mode mkdetrend -D global.pending detregister $file"); 761 # system ("mkdetrend eval reg"); 805 806 } 762 807 763 808 # use recipe file to decide if we apply 'scat' or not! 764 765 809 $file = mkfiles ("list"); 766 810 # create list of images to apply scattered-light correction: … … 775 819 776 820 open (FILE, ">$file"); 777 for ($j = 0; $j < $Nccd; $j++) {778 $line = mknames ("norm", $confline, $ccd s[$j]);821 foreach $ccd (@ccds) { 822 $line = mknames ("norm", $confline, $ccd); 779 823 print FILE "$line\n"; 780 824 } … … 805 849 ############## html modify ############### 806 850 sub mk_fixmasters { 807 if (@ARGV != 1) { &escape ("USAGE: mkdetrendfix.masters"); }851 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND fix.masters"); } 808 852 809 853 @list = load_config (); … … 853 897 ############## html modify ############### 854 898 sub mk_checksplits { 855 if (@ARGV != 2) { &escape ("USAGE: mkdetrendcheck.splits (config)"); }899 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND check.splits (config)"); } 856 900 857 901 $Nconfig = $ARGV[1]; … … 860 904 861 905 # re-create all masters to match master for chip 00 862 for ($i = 0; $i < $Nccd; $i++) {906 foreach $ccd (@ccds) { 863 907 864 908 # load existing master file 865 $master = mknames ("master", $name, $ccd s[$i]);909 $master = mknames ("master", $name, $ccd); 866 910 open (FILE, $master); 867 911 @master = <FILE>; … … 882 926 ############## html duplicate ############### 883 927 sub mk_htmldup { 884 if (@ARGV != 2) { &escape ("USAGE: mkdetrendhtmldup (config)"); }885 886 $config = $ARGV[1];887 # we are just calling the "mkdetrend dup" function and then calling "mkdetrendhtml1"888 889 system ("mkdetrenddup $config");890 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">\n";891 892 &goodbye;893 928 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND htmldup (config)"); } 929 930 $config = $ARGV[1]; 931 # we are just calling the "mkdetrend dup" function and then calling "$MKDETREND html1" 932 933 system ("$MKDETREND dup $config"); 934 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">\n"; 935 936 &goodbye; 937 894 938 } 895 939 896 940 ############## html delete ############### 897 941 sub mk_htmldel { 898 if (@ARGV != 2) { &escape ("USAGE: mkdetrendhtmldel (config.ver)"); }899 900 $config = $ARGV[1];901 # we are just calling the "mkdetrend del" function and then calling "mkdetrend html1"902 903 system ("mkdetrenddel $config");904 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">\n";905 906 &goodbye;;907 942 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND htmldel (config.ver)"); } 943 944 $config = $ARGV[1]; 945 # we are just calling the "mkdetrend del" function and then calling "mkdetrend html1" 946 947 system ("$MKDETREND del $config"); 948 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">\n"; 949 950 &goodbye;; 951 908 952 } 909 953 910 954 ############## html define ############### 911 955 sub mk_htmldef { 912 if (@ARGV != 2) { &escape ("USAGE: mkdetrend htmldef (config.ver)"); } 913 914 $key = $ARGV[1]; 915 916 # find (config.ver) in list: 917 918 @list = load_config (); 919 920 $match = -1; 921 for ($i = 0; $i < @list; $i++) { 922 $version = gtconfig ($list[$i], "version"); 923 if ($key eq $version) { 924 $match = $i; 925 last; 926 } 927 } 928 if ($match == -1) { &escape ("error: can't find config entry"); } 929 930 # show the complete list for reference 931 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 932 print STDOUT "<BODY BGCOLOR=#fff0e0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 933 print STDOUT "<table border>\n"; 934 for ($i = 0; $i < @list; $i++) { 935 $config = gtconfig ($list[$i], "config"); 936 $version = gtconfig ($list[$i], "version"); 937 $status = gtconfig ($list[$i], "status"); 938 $from = gtconfig ($list[$i], "from"); 939 $to = gtconfig ($list[$i], "to"); 940 print STDOUT "<tr><td> $version </td>\n"; 941 print STDOUT "<td> $from </td><td> $to </td>\n"; 942 print STDOUT "<td> <a href=$CGI/elixir2?$version&elconf=$elconf> $status </a></td>\n"; 943 print STDOUT "<td> <a href=$CGI/split?$config&elconf=$elconf> split </a></td>\n"; 944 print STDOUT "<td> <a href=$CGI/delete?$version&elconf=$elconf> delete </a></td>\n"; 945 print STDOUT "<td> <a href=$CGI/redef?$version&elconf=$elconf> redefine </a></td>\n"; 946 print STDOUT "</tr>\n"; 947 } 948 print STDOUT "</table></body><br><br>\n"; 949 950 $version = gtconfig ($list[$match], "version"); 951 $status = gtconfig ($list[$match], "status"); 952 $from = gtconfig ($list[$match], "from"); 953 $to = gtconfig ($list[$match], "to"); 954 print STDOUT "redefining <b> $key: </b> <br>\n"; 955 print STDOUT "<table border>\n"; 956 print STDOUT "<tr><td> $version </td>\n"; 957 print STDOUT "<td> $from </td><td> $to </td><td> $status </a></td>\n"; 958 print STDOUT "</tr></table>\n"; 959 960 961 # create a simple form for redefine: 962 print STDOUT "<form method=post action=$CGI/redefine&elconf=$elconf>\n"; 963 print STDOUT "start: <input type=text value=$from name=start size=40 maxlength=40> <br>\n"; 964 print STDOUT "stop: <input type=text value=$to name=stop size=40 maxlength=40> <br>\n"; 965 print STDOUT "<input type=hidden name=config value=\"$key\">\n"; 966 print STDOUT "<input type=\"submit\" value=\"submit\"><input type=\"reset\" value=\"reset\">\n"; 967 print STDOUT "</form>\n"; 968 print STDOUT "</body>\n"; 969 970 &goodbye;; 971 972 } 973 974 ############## html modify ############### 975 sub mk_htmlmod { 976 if (@ARGV != 1) { &escape ("USAGE: mkdetrend htmlmod"); } 977 978 $key = $ENV{'WWW_config'}; 979 $Nimage = $ENV{'WWW_Nimage'}; 956 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND htmldef (config.ver)"); } 957 958 $key = $ARGV[1]; 959 960 # find (config.ver) in list: 980 961 981 962 @list = load_config (); … … 991 972 if ($match == -1) { &escape ("error: can't find config entry"); } 992 973 974 # show the complete list for reference 975 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 976 print STDOUT "<BODY BGCOLOR=#fff0e0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 977 print STDOUT "<table border>\n"; 978 for ($i = 0; $i < @list; $i++) { 979 $config = gtconfig ($list[$i], "config"); 980 $version = gtconfig ($list[$i], "version"); 981 $status = gtconfig ($list[$i], "status"); 982 $from = gtconfig ($list[$i], "from"); 983 $to = gtconfig ($list[$i], "to"); 984 print STDOUT "<tr><td> $version </td>\n"; 985 print STDOUT "<td> $from </td><td> $to </td>\n"; 986 print STDOUT "<td> <a href=$CGI/elixir2?$version&elconf=$elconf> $status </a></td>\n"; 987 print STDOUT "<td> <a href=$CGI/split?$config&elconf=$elconf> split </a></td>\n"; 988 print STDOUT "<td> <a href=$CGI/delete?$version&elconf=$elconf> delete </a></td>\n"; 989 print STDOUT "<td> <a href=$CGI/redef?$version&elconf=$elconf> redefine </a></td>\n"; 990 print STDOUT "</tr>\n"; 991 } 992 print STDOUT "</table></body><br><br>\n"; 993 994 $version = gtconfig ($list[$match], "version"); 995 $status = gtconfig ($list[$match], "status"); 996 $from = gtconfig ($list[$match], "from"); 997 $to = gtconfig ($list[$match], "to"); 998 print STDOUT "redefining <b> $key: </b> <br>\n"; 999 print STDOUT "<table border>\n"; 1000 print STDOUT "<tr><td> $version </td>\n"; 1001 print STDOUT "<td> $from </td><td> $to </td><td> $status </a></td>\n"; 1002 print STDOUT "</tr></table>\n"; 1003 1004 1005 # create a simple form for redefine: 1006 print STDOUT "<form method=post action=$CGI/redefine&elconf=$elconf>\n"; 1007 print STDOUT "start: <input type=text value=$from name=start size=40 maxlength=40> <br>\n"; 1008 print STDOUT "stop: <input type=text value=$to name=stop size=40 maxlength=40> <br>\n"; 1009 print STDOUT "<input type=hidden name=config value=\"$key\">\n"; 1010 print STDOUT "<input type=\"submit\" value=\"submit\"><input type=\"reset\" value=\"reset\">\n"; 1011 print STDOUT "</form>\n"; 1012 print STDOUT "</body>\n"; 1013 1014 &goodbye;; 1015 1016 } 1017 1018 ############## html modify ############### 1019 sub mk_htmlmod { 1020 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND htmlmod"); } 1021 1022 $key = $ENV{'WWW_config'}; 1023 $Nimage = $ENV{'WWW_Nimage'}; 1024 1025 @list = load_config (); 1026 1027 $match = -1; 1028 for ($i = 0; $i < @list; $i++) { 1029 $version = gtconfig ($list[$i], "version"); 1030 if ($key eq $version) { 1031 $match = $i; 1032 last; 1033 } 1034 } 1035 if ($match == -1) { &escape ("error: can't find config entry"); } 1036 993 1037 # re-create $master to match selections 994 1038 # depends on the format of data in the 'master' file 995 for ($i = 0; $i < $Nccd; $i++) {1039 foreach $ccd (@ccds) { 996 1040 997 1041 # load existing master file 998 $master = mknames ("master", $list[$match], $ccd s[$i]);1042 $master = mknames ("master", $list[$match], $ccd); 999 1043 open (FILE, $master); 1000 1044 @master = <FILE>; … … 1002 1046 1003 1047 if ($Nimage != @master) { 1004 print STDOUT "error: mis-match in image lists ccd $ i\n";1048 print STDOUT "error: mis-match in image lists ccd $ccd\n"; 1005 1049 &escape; 1006 1050 } … … 1028 1072 ############## html accept ############### 1029 1073 sub mk_htmlkeep { 1030 if (@ARGV != 2) { &escape ("USAGE: mkdetrendhtmlkeep (config.ver)"); }1031 1032 $key = $ARGV[1];1033 @list = load_config ();1034 1035 $match = -1;1036 for ($i = 0; $i < @list; $i++) {1037 $version = gtconfig ($list[$i], "version");1038 if ($key eq $version) {1039 $match = $i;1040 last;1041 }1042 }1043 if ($match == -1) {1044 print STDERR "error: can't find config entry\n";1045 &escape;1046 }1047 1048 # adjust the config file: convert status to 'accepted'1049 $list[$match] = stconfig ($list[$match], "status", "accepted");1050 save_config (@list);1051 1052 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">";1053 &goodbye;1074 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND htmlkeep (config.ver)"); } 1075 1076 $key = $ARGV[1]; 1077 @list = load_config (); 1078 1079 $match = -1; 1080 for ($i = 0; $i < @list; $i++) { 1081 $version = gtconfig ($list[$i], "version"); 1082 if ($key eq $version) { 1083 $match = $i; 1084 last; 1085 } 1086 } 1087 if ($match == -1) { 1088 print STDERR "error: can't find config entry\n"; 1089 &escape; 1090 } 1091 1092 # adjust the config file: convert status to 'accepted' 1093 $list[$match] = stconfig ($list[$match], "status", "accepted"); 1094 save_config (@list); 1095 1096 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/elixir1?&elconf=$elconf\">"; 1097 &goodbye; 1054 1098 } 1055 1099 1056 1100 ############## html config ############### 1057 1101 sub mk_htmlconfig { 1058 if (@ARGV != 1) { &escape ("USAGE: mkdetrendhtmlconfig"); }1059 1060 ## html headers1061 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n";1062 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n";1063 1064 # create a simple form for redefine:1065 print STDOUT "<form method=post action=$CGI/newconfig>\n";1066 if ($elconf) {1067 print STDOUT "enter new config: <input type=text value=$elconf name=config size=40 maxlength=40> <br>\n";1068 } else {1069 print STDOUT "enter new config: <input type=text name=config size=40 maxlength=40> <br>\n";1070 }1071 print STDOUT "<input type=\"submit\" value=\"submit\"><input type=\"reset\" value=\"reset\">\n";1072 print STDOUT "</form>\n";1073 print STDOUT "</body>\n";1074 1075 &goodbye;1102 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND htmlconfig"); } 1103 1104 ## html headers 1105 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1106 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1107 1108 # create a simple form for redefine: 1109 print STDOUT "<form method=post action=$CGI/newconfig>\n"; 1110 if ($elconf) { 1111 print STDOUT "enter new config: <input type=text value=$elconf name=config size=40 maxlength=40> <br>\n"; 1112 } else { 1113 print STDOUT "enter new config: <input type=text name=config size=40 maxlength=40> <br>\n"; 1114 } 1115 print STDOUT "<input type=\"submit\" value=\"submit\"><input type=\"reset\" value=\"reset\">\n"; 1116 print STDOUT "</form>\n"; 1117 print STDOUT "</body>\n"; 1118 1119 &goodbye; 1076 1120 } 1077 1121 1078 1122 ############## html level 1 ############### 1079 1123 sub mk_html1 { 1080 if (@ARGV != 1) { &escape ("USAGE: mkdetrendhtml1"); }1081 1082 @list = load_config ();1083 1084 ## html headers1085 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n";1086 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n";1087 1088 print STDOUT "<table border>\n";1089 for ($i = 0; $i < @list; $i++) {1090 $config = gtconfig ($list[$i], "config");1091 $version = gtconfig ($list[$i], "version");1092 $from = gtconfig ($list[$i], "from");1093 $to = gtconfig ($list[$i], "to");1094 $status = gtconfig ($list[$i], "status");1095 print STDOUT "<tr><td> $version </td>\n";1096 print STDOUT "<td> $from </td><td> $to </td>\n";1097 print STDOUT "<td> <a href=$CGI/elixir2?$version&elconf=$elconf> $status </a></td>\n";1098 print STDOUT "<td> <a href=$CGI/split?$config&elconf=$elconf> split </a></td>\n";1099 print STDOUT "<td> <a href=$CGI/delete?$version&elconf=$elconf> delete </a></td>\n";1100 print STDOUT "<td> <a href=$CGI/redef?$version&elconf=$elconf> redefine </a></td>\n";1101 print STDOUT "</tr>\n";1102 }1103 1104 print STDOUT "</table><br><br>\n";1105 if ($elconf eq "") {1106 print STDOUT "Current Config: <b>default</b><br>\n";1107 } else {1108 print STDOUT "Current Config: <b>$elconf</b><br>\n";1109 }1110 print STDOUT "<a href=$CGI/config?&elconf=$elconf>Change Config</a></td>\n";1111 print STDOUT "</body>\n";1112 &goodbye;;1124 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND html1"); } 1125 1126 @list = load_config (); 1127 1128 ## html headers 1129 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1130 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1131 1132 print STDOUT "<table border>\n"; 1133 for ($i = 0; $i < @list; $i++) { 1134 $config = gtconfig ($list[$i], "config"); 1135 $version = gtconfig ($list[$i], "version"); 1136 $from = gtconfig ($list[$i], "from"); 1137 $to = gtconfig ($list[$i], "to"); 1138 $status = gtconfig ($list[$i], "status"); 1139 print STDOUT "<tr><td> $version </td>\n"; 1140 print STDOUT "<td> $from </td><td> $to </td>\n"; 1141 print STDOUT "<td> <a href=$CGI/elixir2?$version&elconf=$elconf> $status </a></td>\n"; 1142 print STDOUT "<td> <a href=$CGI/split?$config&elconf=$elconf> split </a></td>\n"; 1143 print STDOUT "<td> <a href=$CGI/delete?$version&elconf=$elconf> delete </a></td>\n"; 1144 print STDOUT "<td> <a href=$CGI/redef?$version&elconf=$elconf> redefine </a></td>\n"; 1145 print STDOUT "</tr>\n"; 1146 } 1147 1148 print STDOUT "</table><br><br>\n"; 1149 if ($elconf eq "") { 1150 print STDOUT "Current Config: <b>default</b><br>\n"; 1151 } else { 1152 print STDOUT "Current Config: <b>$elconf</b><br>\n"; 1153 } 1154 print STDOUT "<a href=$CGI/config?&elconf=$elconf>Change Config</a></td>\n"; 1155 print STDOUT "</body>\n"; 1156 &goodbye;; 1113 1157 } 1114 1158 1115 1159 ############## html level 2 ############### 1116 1160 sub mk_html2 { 1117 if (@ARGV != 2) { &escape ("USAGE: mkdetrend html2 (config.ver)"); } 1118 1119 @list = load_config (); 1120 1121 # entry on line will be either config.ver (== key) or config.ver.col for sorting 1122 # grab just the key portion 1123 $status = "none"; 1124 ($key) = $ARGV[1] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1125 $arg = $ARGV[1]; 1126 1127 # find appropriate config.ver entry: 1128 for ($i = 0; $i < @list; $i++) { 1129 $version = gtconfig ($list[$i], "version"); 1130 if ($key eq $version) { 1131 $confline = $list[$i]; 1132 $status = gtconfig ($confline, "status"); 1133 last; 1134 } 1135 } 1136 1137 $from = gtconfig ($confline, "from"); 1138 $to = gtconfig ($confline, "to"); 1139 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1140 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1141 print STDOUT "<center><table border>\n"; 1142 print STDOUT "<tr><th>config </th><th> from </th><th> to </th></tr>\n"; 1143 print STDOUT "<tr><td>$version </td><td> $from </td><td> $to</td></tr>\n"; 1144 print STDOUT "</table></center><hr>\n"; 1145 1146 $master = mknames ("master", $confline, $ccds[0]); 1147 1148 if ($status eq "modified") { flips_report ($arg, $confline, "modified"); } 1149 if ($status eq "accepted") { flips_report ($arg, $confline, "accepted"); } 1150 if ($status eq "done.merge") { flips_report ($arg, $confline, "merged"); } 1151 # if ($status eq "done.update") { flips_report ($arg, $confline, "updated"); } 1152 if ($status eq "done.reg") { flips_report_done ($key, $confline, "registered"); } 1153 if ($status eq "clean") { flips_report ($key, $confline, "registered"); } 1154 1155 if ($status eq "none") { $message = "not found"; } 1156 if ($status eq "init") { $message = "initialized, not yet run."; } 1157 if ($status eq "not.available") { $message = "has no images available for detrend creation."; } 1158 1159 foreach $step (init, flips, norm, merge) { 1160 if ($status eq "running.$step") { $message = "running step $step"; } 1161 if ($status eq "fail.$step") { $message = "failed step $step"; } 1162 if ($status eq "done.$step") { $message = "has finished $step"; } 1163 } 1164 1165 print STDOUT "config <b> $key </b> $message <br>\n"; 1166 1167 print STDOUT "<table border>\n"; 1168 open (FILE, "$master"); 1169 while ($line = <FILE>) { 1170 chop ($line); 1171 @entry = split ("/", $line); 1172 $N = @entry - 1; 1173 print STDOUT "<tr><td>$entry[$N]</td></tr>\n"; 1174 } 1175 print STDOUT "</table>\n"; 1176 1177 print STDOUT "</body>\n"; 1178 &goodbye; 1179 } 1180 1181 ############## html level 3 ############### 1182 sub mk_html3 { 1183 if (@ARGV != 2) { &escape ("USAGE: mkdetrend html3 (entry.config.ver)"); } 1184 1185 @list = load_config (); 1186 1187 # extract the entry and key values from $ARGV[1] 1188 ($entry, $key) = $ARGV[1] =~ /(\d+)\Q.\E(.*)/; 1189 1190 $status = "none"; 1191 # find appropriate config.ver entry: 1192 for ($i = 0; $i < @list; $i++) { 1193 $version = gtconfig ($list[$i], "version"); 1194 if ($key eq $version) { 1195 $confline = $list[$i]; 1196 $status = gtconfig ($confline, "status"); 1197 last; 1198 } 1199 } 1200 1201 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1202 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1203 1204 if ($status eq "none") { print STDOUT "config <b> $key </b> not found\n </body>\n"; &goodbye; } 1205 if ($status eq "init") { print STDOUT "config <b> $key </b> initialized, not yet run\n </body>\n"; &goodbye; } 1206 if ($status eq "not.available") { print STDOUT "config <b> $key </b> has no images available for detrend creation\n </body>\n"; &goodbye; } 1207 1208 # if ($status eq "done.update") { flips_entry ($key, $entry, $confline); } 1209 if ($status eq "done.merge") { flips_entry ($key, $entry, $confline); } 1210 if ($status eq "accepted") { flips_entry ($key, $entry, $confline); } 1211 if ($status eq "modified") { flips_entry ($key, $entry, $confline); } 1212 if ($status eq "done.reg") { flips_entry ($key, $entry, $confline); } 1213 1214 foreach $step (init, flips, norm, merge) { 1215 # print "step: $step, $status: $status\n"; 1216 if ($status eq "running.$step") { print STDOUT "config <b> $key </b> running step $step \n </body>\n"; &goodbye; } 1217 if ($status eq "fail.$step") { print STDOUT "config <b> $key </b> failed step $step\n </body>\n"; &goodbye; } 1218 1219 if ($status eq "done.$step") { 1220 print STDOUT "config <b> $key </b> has finished $step\n"; 1221 1222 # load image names from CCD 0 list: 1223 $master = mknames ("master", $confline, $ccds[0]); 1224 print STDOUT "<table border>\n"; 1225 open (FILE, "$master"); 1226 while ($line = <FILE>) { 1161 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND html2 (config.ver)"); } 1162 1163 @list = load_config (); 1164 1165 # entry on line will be either config.ver (== key) or config.ver.col for sorting 1166 # grab just the key portion 1167 $status = "none"; 1168 ($key) = $ARGV[1] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1169 $arg = $ARGV[1]; 1170 1171 # find appropriate config.ver entry: 1172 for ($i = 0; $i < @list; $i++) { 1173 $version = gtconfig ($list[$i], "version"); 1174 if ($key eq $version) { 1175 $confline = $list[$i]; 1176 $status = gtconfig ($confline, "status"); 1177 last; 1178 } 1179 } 1180 1181 $from = gtconfig ($confline, "from"); 1182 $to = gtconfig ($confline, "to"); 1183 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1184 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1185 print STDOUT "<center><table border>\n"; 1186 print STDOUT "<tr><th>config </th><th> from </th><th> to </th></tr>\n"; 1187 print STDOUT "<tr><td>$version </td><td> $from </td><td> $to</td></tr>\n"; 1188 print STDOUT "</table></center><hr>\n"; 1189 1190 $master = mknames ("master", $confline, $ccds[0]); 1191 1192 if ($status eq "modified") { flips_report ($arg, $confline, "modified"); } 1193 if ($status eq "accepted") { flips_report ($arg, $confline, "accepted"); } 1194 if ($status eq "done.merge") { flips_report ($arg, $confline, "merged"); } 1195 if ($status eq "done.reg") { flips_report_done ($key, $confline, "registered"); } 1196 if ($status eq "done") { flips_report_done ($key, $confline, "registered"); } 1197 if ($status eq "clean") { flips_report ($key, $confline, "registered"); } 1198 1199 if ($status eq "none") { $message = "not found"; } 1200 if ($status eq "init") { $message = "initialized, not yet run."; } 1201 if ($status eq "not.available") { $message = "has no images available for detrend creation."; } 1202 1203 foreach $step (init, flips, norm, merge) { 1204 if ($status eq "running.$step") { $message = "running step $step"; } 1205 if ($status eq "fail.$step") { $message = "failed step $step"; } 1206 if ($status eq "done.$step") { $message = "has finished $step"; } 1207 } 1208 1209 print STDOUT "config <b> $key </b> $message <br>\n"; 1210 1211 print STDOUT "<table border>\n"; 1212 open (FILE, "$master"); 1213 while ($line = <FILE>) { 1227 1214 chop ($line); 1228 1215 @entry = split ("/", $line); 1229 1216 $N = @entry - 1; 1230 1217 print STDOUT "<tr><td>$entry[$N]</td></tr>\n"; 1231 } 1232 print STDOUT "</table>\n"; 1233 } 1234 } 1235 1236 # print STDOUT "</body>\n"; 1237 &goodbye; 1218 } 1219 print STDOUT "</table>\n"; 1220 1221 print STDOUT "</body>\n"; 1222 &goodbye; 1223 } 1224 1225 ############## html level 3 ############### 1226 sub mk_html3 { 1227 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND html3 (entry.config.ver)"); } 1228 1229 @list = load_config (); 1230 1231 # extract the entry and key values from $ARGV[1] 1232 ($entry, $key) = $ARGV[1] =~ /(\d+)\Q.\E(.*)/; 1233 1234 $status = "none"; 1235 # find appropriate config.ver entry: 1236 for ($i = 0; $i < @list; $i++) { 1237 $version = gtconfig ($list[$i], "version"); 1238 if ($key eq $version) { 1239 $confline = $list[$i]; 1240 $status = gtconfig ($confline, "status"); 1241 last; 1242 } 1243 } 1244 1245 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1246 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1247 1248 if ($status eq "none") { print STDOUT "config <b> $key </b> not found\n </body>\n"; &goodbye; } 1249 if ($status eq "init") { print STDOUT "config <b> $key </b> initialized, not yet run\n </body>\n"; &goodbye; } 1250 if ($status eq "not.available") { print STDOUT "config <b> $key </b> has no images available for detrend creation\n </body>\n"; &goodbye; } 1251 1252 # if ($status eq "done.update") { flips_entry ($key, $entry, $confline); } 1253 if ($status eq "done.merge") { flips_entry ($key, $entry, $confline); } 1254 if ($status eq "accepted") { flips_entry ($key, $entry, $confline); } 1255 if ($status eq "modified") { flips_entry ($key, $entry, $confline); } 1256 if ($status eq "done.reg") { flips_entry ($key, $entry, $confline); } 1257 1258 foreach $step (init, flips, norm, merge) { 1259 # print "step: $step, $status: $status\n"; 1260 if ($status eq "running.$step") { print STDOUT "config <b> $key </b> running step $step \n </body>\n"; &goodbye; } 1261 if ($status eq "fail.$step") { print STDOUT "config <b> $key </b> failed step $step\n </body>\n"; &goodbye; } 1262 1263 if ($status eq "done.$step") { 1264 print STDOUT "config <b> $key </b> has finished $step\n"; 1265 1266 # load image names from CCD 0 list: 1267 $master = mknames ("master", $confline, $ccds[0]); 1268 print STDOUT "<table border>\n"; 1269 open (FILE, "$master"); 1270 while ($line = <FILE>) { 1271 chop ($line); 1272 @entry = split ("/", $line); 1273 $N = @entry - 1; 1274 print STDOUT "<tr><td>$entry[$N]</td></tr>\n"; 1275 } 1276 print STDOUT "</table>\n"; 1277 } 1278 } 1279 1280 # print STDOUT "</body>\n"; 1281 &goodbye; 1238 1282 } 1239 1283 … … 1242 1286 ############## evaluate chip run ############### 1243 1287 sub mk_eval { 1244 if (@ARGV != 2) { &escape ("USAGE: mkdetrend eval (step)"); } 1245 1246 $step = $ARGV[1]; 1247 @list = load_config (); 1248 1249 # load success fifo info: 1250 $file = `gconfig -D mode mkdetrend global.success`; chop $file; 1251 open (FILE, "$file"); 1252 @success = <FILE>; 1253 close (FILE); 1254 1255 # load failure fifo info: 1256 $file = `gconfig -D mode mkdetrend global.failure`; chop $file; 1257 open (FILE, "$file"); 1258 @failure = <FILE>; 1259 close (FILE); 1260 1261 # entry must be in state 'running.$step' 1262 # possible states: 1263 # 1 all 12 chips in success == done.$step 1264 # 2 any chips in failure == fail.$step 1265 # 3 any chips missing == fail.$step 1266 # 4 any chips in failure, merge.list == not.available (only for $step eq init) 1267 # valid steps: init flips norm 1268 1269 CONFIG: 1270 foreach $confline (@list) { 1271 $status = gtconfig ($confline, "status"); 1272 if ($status ne "running.$step") { next; } 1273 $state = 1; 1274 1275 CCD: 1276 for ($j = 0; $j < $Nccd; $j++) { 1277 $entry = gtconfig ($confline, "chiprun", $j); 1278 1279 # search for entry in success fifo: 1280 foreach $value (@success) { 1281 if ($value =~ /^$entry/) { next CCD; } 1282 } 1283 1284 # search for entry in failure fifo: note the special ending state for 'init' 1285 foreach $value (@failure) { 1286 if ($value =~ /^$entry/) { 1287 $state = 2; 1288 if ($step eq "split") { 1289 ($status) = $value =~ /$entry\s+\S+\s+(\S+)/; 1290 if ($status eq "merge.lists") { 1291 $state = 4; 1292 } 1288 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND eval (step)"); } 1289 1290 $step = $ARGV[1]; 1291 @list = load_config (); 1292 1293 # load success fifo info: 1294 $file = `gconfig -D mode $MKDETREND global.success`; chop $file; 1295 open (FILE, "$file"); 1296 @success = <FILE>; 1297 close (FILE); 1298 1299 # load failure fifo info: 1300 $file = `gconfig -D mode $MKDETREND global.failure`; chop $file; 1301 open (FILE, "$file"); 1302 @failure = <FILE>; 1303 close (FILE); 1304 1305 # entry must be in state 'running.$step' 1306 # possible states: 1307 # 1 all 12 chips in success == done.$step 1308 # 2 any chips in failure == fail.$step 1309 # 3 any chips missing == fail.$step 1310 # 4 any chips in failure, merge.list == not.available (only for $step eq init) 1311 # valid steps: init flips norm 1312 1313 CONFIG: 1314 foreach $confline (@list) { 1315 $status = gtconfig ($confline, "status"); 1316 if ($status ne "running.$step") { next; } 1317 $state = 1; 1318 1319 CCD: 1320 foreach $ccd (@ccds) { 1321 $entry = gtconfig ($confline, "chiprun", $ccd); 1322 1323 # search for entry in success fifo: 1324 foreach $value (@success) { 1325 if ($value =~ /^$entry/) { next CCD; } 1293 1326 } 1327 1328 # search for entry in failure fifo: note the special ending state for 'init' 1329 foreach $value (@failure) { 1330 if ($value =~ /^$entry/) { 1331 $state = 2; 1332 if ($step eq "split") { 1333 ($status) = $value =~ /$entry\s+\S+\s+(\S+)/; 1334 if ($status eq "merge.lists") { 1335 $state = 4; 1336 } 1337 } 1338 last CCD; 1339 } 1340 } 1341 1342 # if we make it here, it wasn't in either fifo.success or fifo.failure... 1343 $state = 3; 1294 1344 last CCD; 1295 } 1296 } 1297 1298 # if we make it here, it wasn't in either fifo.success or fifo.failure... 1299 $state = 3; 1300 last CCD; 1301 } 1302 1303 if ($state == 1) { $confline = stconfig ($confline, "status", "done.$step"); } 1304 if ($state == 2) { $confline = stconfig ($confline, "status", "fail.$step"); } 1305 if ($state == 3) { $confline = stconfig ($confline, "status", "fail.$step"); } 1306 if ($state == 4) { $confline = stconfig ($confline, "status", "not.available"); } 1307 } 1308 save_config (@list); 1309 1310 system ("mkdetrend state"); 1311 &goodbye; 1345 } 1346 1347 if ($state == 1) { $confline = stconfig ($confline, "status", "done.$step"); } 1348 if ($state == 2) { $confline = stconfig ($confline, "status", "fail.$step"); } 1349 if ($state == 3) { $confline = stconfig ($confline, "status", "fail.$step"); } 1350 if ($state == 4) { $confline = stconfig ($confline, "status", "not.available"); } 1351 } 1352 save_config (@list); 1353 1354 system ("$MKDETREND state"); 1355 &goodbye; 1312 1356 } 1313 1357 1314 1358 ############## evaluate mosaic run ############### 1315 1359 sub mk_meval { 1316 if (@ARGV != 2) { &escape ("USAGE: mkdetrend meval (step)"); } 1317 1318 $step = $ARGV[1]; 1319 @list = load_config (); 1320 1321 # load success fifo info: 1322 $file = `gconfig -D mode mkdetrend global.success`; chop $file; 1323 open (FILE, "$file"); 1324 @success = <FILE>; 1325 close (FILE); 1326 1327 # load failure fifo info: 1328 $file = `gconfig -D mode mkdetrend global.failure`; chop $file; 1329 open (FILE, "$file"); 1330 @failure = <FILE>; 1331 close (FILE); 1332 1333 # entry must be in state 'running.$step' 1334 # possible states: 1335 # 1 entry in success == done.$step 1336 # 2 entry in failure == fail.$step 1337 # 3 entry missing == fail.$step 1338 # valid steps: merge 1339 1340 foreach $confline (@list) { 1341 $status = gtconfig ($confline, "status"); 1342 if ($status ne "running.$step") { next; } 1343 $state = 3; 1344 $entry = gtconfig ($confline, "mosaic"); 1345 1346 MCHECK: 1347 { 1348 foreach $value (@success) { 1349 if ($value =~ /^$entry/) { 1350 $state = 1; 1351 last MCHECK; 1352 } 1353 } 1354 1355 foreach $value (@failure) { 1356 if ($value =~ /^$entry/) { 1357 $state = 2; 1358 next MCHECK; 1360 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND meval (step)"); } 1361 1362 $step = $ARGV[1]; 1363 @list = load_config (); 1364 1365 # load success fifo info: 1366 $file = `gconfig -D mode $MKDETREND global.success`; chop $file; 1367 open (FILE, "$file"); 1368 @success = <FILE>; 1369 close (FILE); 1370 1371 # load failure fifo info: 1372 $file = `gconfig -D mode $MKDETREND global.failure`; chop $file; 1373 open (FILE, "$file"); 1374 @failure = <FILE>; 1375 close (FILE); 1376 1377 # entry must be in state 'running.$step' 1378 # possible states: 1379 # 1 entry in success == done.$step 1380 # 2 entry in failure == fail.$step 1381 # 3 entry missing == fail.$step 1382 # valid steps: merge 1383 1384 foreach $confline (@list) { 1385 $status = gtconfig ($confline, "status"); 1386 if ($status ne "running.$step") { next; } 1387 $state = 3; 1388 $entry = gtconfig ($confline, "mosaic"); 1389 1390 MCHECK: 1391 { 1392 foreach $value (@success) { 1393 if ($value =~ /^$entry/) { 1394 $state = 1; 1395 last MCHECK; 1396 } 1359 1397 } 1360 } 1361 } 1362 1363 if ($state == 1) { $confline = stconfig ($confline, "status", "done.$step"); } 1364 if ($state == 2) { $confline = stconfig ($confline, "status", "fail.$step"); } 1365 if ($state == 3) { $confline = stconfig ($confline, "status", "fail.$step"); } 1366 } 1367 1368 save_config (@list); 1369 system ("mkdetrend state"); 1370 1371 &goodbye; 1398 1399 foreach $value (@failure) { 1400 if ($value =~ /^$entry/) { 1401 $state = 2; 1402 next MCHECK; 1403 } 1404 } 1405 } 1406 1407 if ($state == 1) { $confline = stconfig ($confline, "status", "done.$step"); } 1408 if ($state == 2) { $confline = stconfig ($confline, "status", "fail.$step"); } 1409 if ($state == 3) { $confline = stconfig ($confline, "status", "fail.$step"); } 1410 } 1411 1412 save_config (@list); 1413 system ("$MKDETREND state"); 1414 1415 &goodbye; 1372 1416 } 1373 1417 1374 1418 ############## html for dads ############### 1375 1419 sub mk_dads { 1376 if (@ARGV != 2) { &escape ("USAGE: mkdetrenddads (config.ver)"); }1420 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND dads (config.ver)"); } 1377 1421 1378 1422 # options: mkdetrend dads (config.ver) … … 1452 1496 ############## html for dads ############### 1453 1497 sub mk_dads_html { 1454 if (@ARGV != 2) { &escape ("USAGE: mkdetrenddads (config.ver)"); }1498 if (@ARGV != 2) { &escape ("USAGE: $MKDETREND dads (config.ver)"); } 1455 1499 1456 1500 @list = load_config (); … … 1511 1555 print STDOUT "Total Counts: $Ncnt<br> r.m.s. median sigma: $Sigma% <br><br>\n"; 1512 1556 print STDOUT "</td><td align=right><img src=$imbin></td></tr></table>\n"; 1513 1557 1514 1558 print STDOUT "<center><b>Statistics on each available input image.</b></center> 1515 1559 Time is in UT, light background means dawn, grey means dusk.\n"; … … 1567 1611 ############## dads level 1 ############### 1568 1612 sub mk_dads_top { 1569 if (@ARGV != 1) { &escape ("USAGE: mkdetrenddads.top"); }1570 1571 @list = load_config ();1572 1573 ## html headers1574 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n";1575 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n";1576 1577 print STDOUT "<table border>\n";1578 for ($i = 0; $i < @list; $i++) {1579 $config = gtconfig ($list[$i], "config");1580 $version = gtconfig ($list[$i], "version");1581 $from = gtconfig ($list[$i], "from");1582 $to = gtconfig ($list[$i], "to");1583 $status = gtconfig ($list[$i], "status");1584 print STDOUT "<tr><td> $version </td>\n";1585 print STDOUT "<td> $from </td><td> $to </td>\n";1586 print STDOUT "<td> <a href=$version.html> $status </a></td>\n";1587 print STDOUT "</tr>\n";1588 }1589 1590 print STDOUT "</table></body>\n";1591 &goodbye;;1592 1613 if (@ARGV != 1) { &escape ("USAGE: $MKDETREND dads.top"); } 1614 1615 @list = load_config (); 1616 1617 ## html headers 1618 print STDOUT "<HEADER> <TITLE>Elixir Mkdetrend Report</TITLE> </HEADER>\n"; 1619 print STDOUT "<BODY BGCOLOR=#fff0f0 TEXT=#000000 LINK=#0000ff VLINK=#6600ff ALINK=#a0a0a0>\n"; 1620 1621 print STDOUT "<table border>\n"; 1622 for ($i = 0; $i < @list; $i++) { 1623 $config = gtconfig ($list[$i], "config"); 1624 $version = gtconfig ($list[$i], "version"); 1625 $from = gtconfig ($list[$i], "from"); 1626 $to = gtconfig ($list[$i], "to"); 1627 $status = gtconfig ($list[$i], "status"); 1628 print STDOUT "<tr><td> $version </td>\n"; 1629 print STDOUT "<td> $from </td><td> $to </td>\n"; 1630 print STDOUT "<td> <a href=$version.html> $status </a></td>\n"; 1631 print STDOUT "</tr>\n"; 1632 } 1633 1634 print STDOUT "</table></body>\n"; 1635 &goodbye;; 1636 1593 1637 } 1594 1638 1595 1639 sub by_col { 1596 @word = split (" ", $statdata[$a]); $va = $word[$col];1597 @word = split (" ", $statdata[$b]); $vb = $word[$col];1598 $va <=> $vb;1640 @word = split (" ", $statdata[$a]); $va = $word[$col]; 1641 @word = split (" ", $statdata[$b]); $vb = $word[$col]; 1642 $va <=> $vb; 1599 1643 } 1600 1644 1601 1645 sub flips_report { 1602 1603 $col = 0; 1604 ($config) = $_[0] =~ /(\w+.\w+.\w+)/; 1605 ($key) = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1606 1607 # look for optional sort key (config.ver[.key]) 1608 if ($_[0] =~ /$key.(\d+)/) { 1609 ($col) = $_[0] =~ /$key.(\d+)/; 1610 } else { 1611 $col = 0; 1612 } 1613 1614 $line = $_[1]; 1615 $message = $_[2]; 1616 1617 open (FILE, mknames ("stats", $line)); @statdata = <FILE>; close (FILE); 1618 open (FILE, mknames ("medbin", $line)); @medndata = <FILE>; close (FILE); 1619 open (FILE, mknames ("master", $line, $ccds[0])); @mastdata = <FILE>; close (FILE); 1620 1621 $Nkeep = 0; 1622 $Ncnt = 0; 1623 $Sigma = 0; 1624 $Nimage = @statdata; 1625 for ($i = 0; $i < $Nimage; $i++) { 1626 @tmpw = split (" ", $mastdata[$i]); 1627 @tmps = split (" ", $statdata[$i]); 1628 if ($tmpw[1]) { $Nkeep++; $Ncnt += $tmps[3]; $Sigma += $tmps[8]*$tmps[8]; } 1629 } 1630 if ($Nkeep > 0) { 1631 $Sigma = sprintf "%5.3f", 100*sqrt ($Sigma/$Nkeep); 1632 } else { 1633 $Sigma = 100.0; 1634 } 1635 1636 $imbin = mknames ("imbin", $line); 1637 print STDOUT "<table><tr><td width=300px valign=top>\n"; 1638 print STDOUT "<b>this config has been $message. </b><br>\n"; 1639 print STDOUT "there are $Nimage images, $Nkeep used. <br>\n"; 1640 print STDOUT "Total Counts: $Ncnt<br> r.m.s. median sigma: $Sigma% <br><br>\n"; 1641 print STDOUT "you have the following choices: <br>\n"; 1642 print STDOUT "<a href=$CGI/elixir1?&elconf=$elconf> <b> return to top level </b><br></a>\n"; 1643 print STDOUT "<a href=$CGI/split?$config&elconf=$elconf> <b> split config </b><br></a>\n"; 1644 print STDOUT "<a href=$CGI/accept?$key&elconf=$elconf> <b> accept config </b><br></a>\n"; 1645 print STDOUT "</td><td width=640px align=right><img width=100% src=$imbin></td></tr></table>\n"; 1646 1647 print STDOUT "<form method=post action=$CGI/modify?&elconf=$elconf>\n"; 1648 1649 print STDOUT "<center><b>Statistics on each available input image.</b></center> 1646 1647 $col = 0; 1648 ($type) = $_[0] =~ /\w+.(\w+).\w+/; 1649 ($config) = $_[0] =~ /(\w+.\w+.\w+)/; 1650 ($key) = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1651 1652 # look for optional sort key (config.ver[.key]) 1653 if ($_[0] =~ /$key.(\d+)/) { 1654 ($col) = $_[0] =~ /$key.(\d+)/; 1655 } else { 1656 $col = 0; 1657 } 1658 1659 $line = $_[1]; 1660 $message = $_[2]; 1661 1662 open (FILE, mknames ("stats", $line)); @statdata = <FILE>; close (FILE); 1663 open (FILE, mknames ("medbin", $line)); @medndata = <FILE>; close (FILE); 1664 open (FILE, mknames ("master", $line, $ccds[0])); @mastdata = <FILE>; close (FILE); 1665 1666 $Nkeep = 0; 1667 $Ncnt = 0; 1668 $Sigma = 0; 1669 $Nimage = @statdata; 1670 for ($i = 0; $i < $Nimage; $i++) { 1671 @tmpw = split (" ", $mastdata[$i]); 1672 @tmps = split (" ", $statdata[$i]); 1673 if ($tmpw[1]) { $Nkeep++; $Ncnt += $tmps[3]; $Sigma += $tmps[8]*$tmps[8]; } 1674 } 1675 if ($Nkeep > 0) { 1676 if ($type eq "flat") { 1677 $Sigma = sprintf "%5.3f", 100*sqrt ($Sigma/$Nkeep); 1678 $statline = "Total Counts: $Ncnt<br> r.m.s. median sigma: $Sigma% <br><br>\n"; 1679 } else { 1680 $Sigma = sprintf "%5.3f", sqrt ($Sigma/$Nkeep); 1681 $Ncnt = sprintf "%5.3f", ($Ncnt / $Nkeep); 1682 $statline = "Mean Counts: $Ncnt<br> r.m.s. median sigma: $Sigma <br><br>\n"; 1683 } 1684 } else { 1685 $statline = ""; 1686 } 1687 1688 $imbin = mknames ("imbin", $line); 1689 print STDOUT "<table><tr><td width=300px valign=top>\n"; 1690 print STDOUT "<b>this config has been $message. </b><br>\n"; 1691 print STDOUT "there are $Nimage images, $Nkeep used. <br>\n"; 1692 print STDOUT "$statline\n"; 1693 print STDOUT "you have the following choices: <br>\n"; 1694 print STDOUT "<a href=$CGI/elixir1?&elconf=$elconf> <b> return to top level </b><br></a>\n"; 1695 print STDOUT "<a href=$CGI/split?$config&elconf=$elconf> <b> split config </b><br></a>\n"; 1696 print STDOUT "<a href=$CGI/accept?$key&elconf=$elconf> <b> accept config </b><br></a>\n"; 1697 print STDOUT "</td><td width=640px align=right><img width=100% src=$imbin></td></tr></table>\n"; 1698 1699 print STDOUT "<form method=post action=$CGI/modify?&elconf=$elconf>\n"; 1700 1701 print STDOUT "<center><b>Statistics on each available input image.</b></center> 1650 1702 Time is in UT, light background means dawn, grey means dusk. Click 1651 1703 on the column heading to sort by that entry\n"; 1652 1704 1653 print STDOUT "<table bgcolor=#fff0e0 border=1 cellspacing=0 cellpadding=3>\n"; 1654 print STDOUT "<tr bgcolor=#00aaaa>\n"; 1655 print STDOUT "<th > <a href=$CGI/elixir2?$key.0&elconf=$elconf> image </a></th>\n"; 1656 print STDOUT "<th > Date </th>\n"; 1657 print STDOUT "<th > Time </th>\n"; 1658 print STDOUT "<th > <a href=$CGI/elixir2?$key.3&elconf=$elconf> Mean </a></th>\n"; 1659 print STDOUT "<th > <a href=$CGI/elixir2?$key.5&elconf=$elconf> Sigma (raw) </a></th>\n"; 1660 print STDOUT "<th > <a href=$CGI/elixir2?$key.6&elconf=$elconf> Sigma (clipped) </a></th>\n"; 1661 print STDOUT "<th > <a href=$CGI/elixir2?$key.8&elconf=$elconf> Sigma (med) </a></th>\n"; 1662 print STDOUT "<th > image </th>\n"; 1663 print STDOUT "<th > used? </th>\n"; 1664 print STDOUT "<th > keep? </th></tr>\n\n"; 1665 1666 @order = (); 1667 for ($i = 0; $i < $Nimage; $i++) { @order = (@order, $i); } 1668 1669 @entry = sort by_col @order; 1670 1671 for ($i = 0; $i < $Nimage; $i++) { 1672 $N = $entry[$i]; 1673 1674 @word = split (" ", $statdata[$N]); 1675 $used = $word[12]; 1676 $dawn = $word[11]; 1677 1678 @tmpw = split (" ", $mastdata[$N]); 1679 $keep = $tmpw[1]; 1680 1681 @tmpw = split ("/", $medndata[$N]); 1682 $medname = $tmpw[-1]; 1683 1684 # $sig1 = sprintf "%5.3f", $word[4]; 1685 # $sig2 = sprintf "%5.3f", $word[5]; 1686 # $sig3 = sprintf "%5.3f", $word[6]; 1687 # $sig4 = sprintf "%5.3f", $word[7]; 1688 # $mean = sprintf "%8.1f", $word[3]; 1689 1690 print STDOUT "<tr><td> <a href=$CGI/elixir3?$N.$key&elconf=$elconf> $word[0] </a></td><td> $word[1] </td>\n"; 1691 if ($dawn) { print STDOUT "<td bgcolor=#cccccc> $word[2] </td>\n"; } 1692 else { print STDOUT "<td> $word[2] </td>\n"; } 1693 print STDOUT "<td> $word[3] </td>\n"; 1694 print STDOUT "<td> $word[5] </td><td> $word[6] </td><td> $word[8] </td>\n"; 1695 print STDOUT "<td> <a border=0 href=$CGI/elixir3?$N.$key&elconf=$elconf>\n"; 1696 print STDOUT "<img src=$www/$medname></a></td>\n"; 1697 if ($used) { print STDOUT "<td>yes</td>\n"; } 1698 else { print STDOUT "<td>no</td>\n"; } 1699 if ($keep) { print STDOUT "<td bgcolor=#00c000><input type=checkbox checked name=image.$N value=$N size=1></td></tr>\n\n"; } 1700 else { print STDOUT "<td bgcolor=#d00000><input type=checkbox name=image.$N value=$N size=1></td></tr>\n\n"; } 1701 1702 } 1703 1704 print STDOUT "</table>\n"; 1705 print STDOUT "<input type=hidden name=Nimage value=\"$Nimage\">\n"; 1706 print STDOUT "<input type=hidden name=config value=\"$key\">\n"; 1707 print STDOUT "<input type=submit value=\"apply changes\">\n"; 1708 print STDOUT "<input type=reset value=Reset>\n"; 1709 # print STDOUT "<select name=status size=1> \n"; 1710 print STDOUT "</form></body>\n"; 1711 &goodbye; 1712 1705 print STDOUT "<table bgcolor=#fff0e0 border=1 cellspacing=0 cellpadding=3>\n"; 1706 print STDOUT "<tr bgcolor=#00aaaa>\n"; 1707 print STDOUT "<th > <a href=$CGI/elixir2?$key.0&elconf=$elconf> image </a></th>\n"; 1708 print STDOUT "<th > Date </th>\n"; 1709 print STDOUT "<th > Time </th>\n"; 1710 print STDOUT "<th > <a href=$CGI/elixir2?$key.3&elconf=$elconf> Mean </a></th>\n"; 1711 print STDOUT "<th > <a href=$CGI/elixir2?$key.5&elconf=$elconf> Sigma (raw) </a></th>\n"; 1712 print STDOUT "<th > <a href=$CGI/elixir2?$key.6&elconf=$elconf> Sigma (clipped) </a></th>\n"; 1713 print STDOUT "<th > <a href=$CGI/elixir2?$key.8&elconf=$elconf> Sigma (med) </a></th>\n"; 1714 print STDOUT "<th > image </th>\n"; 1715 print STDOUT "<th > used? </th>\n"; 1716 print STDOUT "<th > keep? </th></tr>\n\n"; 1717 1718 @order = (); 1719 for ($i = 0; $i < $Nimage; $i++) { @order = (@order, $i); } 1720 1721 @entry = sort by_col @order; 1722 1723 for ($i = 0; $i < $Nimage; $i++) { 1724 $N = $entry[$i]; 1725 1726 @word = split (" ", $statdata[$N]); 1727 $used = $word[12]; 1728 $dawn = $word[11]; 1729 1730 @tmpw = split (" ", $mastdata[$N]); 1731 $keep = $tmpw[1]; 1732 1733 @tmpw = split ("/", $medndata[$N]); 1734 $medname = $tmpw[-1]; 1735 1736 print STDOUT "<tr><td> <a href=$CGI/elixir3?$N.$key&elconf=$elconf> $word[0] </a></td><td> $word[1] </td>\n"; 1737 if ($dawn) { print STDOUT "<td bgcolor=#cccccc> $word[2] </td>\n"; } 1738 else { print STDOUT "<td> $word[2] </td>\n"; } 1739 print STDOUT "<td> $word[3] </td>\n"; # mean 1740 print STDOUT "<td> $word[5] </td>\n"; # Sigma (raw) 1741 print STDOUT "<td> $word[6] </td>\n"; # Sigma (clip) 1742 print STDOUT "<td> $word[8] </td>\n"; # Sigma (med) 1743 print STDOUT "<td> <a border=0 href=$CGI/elixir3?$N.$key&elconf=$elconf>\n"; 1744 print STDOUT "<img src=$www/$medname></a></td>\n"; 1745 if ($used) { print STDOUT "<td>yes</td>\n"; } 1746 else { print STDOUT "<td>no</td>\n"; } 1747 if ($keep) { print STDOUT "<td bgcolor=#00c000><input type=checkbox checked name=image.$N value=$N size=1></td></tr>\n\n"; } 1748 else { print STDOUT "<td bgcolor=#d00000><input type=checkbox name=image.$N value=$N size=1></td></tr>\n\n"; } 1749 1750 } 1751 1752 print STDOUT "</table>\n"; 1753 print STDOUT "<input type=hidden name=Nimage value=\"$Nimage\">\n"; 1754 print STDOUT "<input type=hidden name=config value=\"$key\">\n"; 1755 print STDOUT "<input type=submit value=\"apply changes\">\n"; 1756 print STDOUT "<input type=reset value=Reset>\n"; 1757 # print STDOUT "<select name=status size=1> \n"; 1758 print STDOUT "</form></body>\n"; 1759 &goodbye; 1760 1761 } 1762 1763 sub flips_report_done { 1764 1765 $col = 0; 1766 ($type) = $_[0] =~ /\w+.(\w+).\w+/; 1767 ($config) = $_[0] =~ /(\w+.\w+.\w+)/; 1768 ($key) = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1769 1770 # look for optional sort key (config.ver[.key]) 1771 if ($_[0] =~ /$key.(\d+)/) { 1772 ($col) = $_[0] =~ /$key.(\d+)/; 1773 } else { 1774 $col = 0; 1775 } 1776 1777 $line = $_[1]; 1778 $message = $_[2]; 1779 1780 open (FILE, mknames ("stats", $line)); @statdata = <FILE>; close (FILE); 1781 open (FILE, mknames ("medbin", $line)); @medndata = <FILE>; close (FILE); 1782 open (FILE, mknames ("master", $line, $ccds[0])); @mastdata = <FILE>; close (FILE); 1783 1784 $Nkeep = 0; 1785 $Ncnt = 0; 1786 $Sigma = 0; 1787 $Nimage = @statdata; 1788 for ($i = 0; $i < $Nimage; $i++) { 1789 @tmpw = split (" ", $mastdata[$i]); 1790 @tmps = split (" ", $statdata[$i]); 1791 if ($tmpw[1]) { $Nkeep++; $Ncnt += $tmps[3]; $Sigma += $tmps[8]*$tmps[8]; } 1792 } 1793 if ($Nkeep > 0) { 1794 if ($type eq "flat") { 1795 $Sigma = sprintf "%5.3f", 100*sqrt ($Sigma/$Nkeep); 1796 $statline = "Total Counts: $Ncnt<br> r.m.s. median sigma: $Sigma% <br><br>\n"; 1797 } else { 1798 $Sigma = sprintf "%5.3f", sqrt ($Sigma/$Nkeep); 1799 $Ncnt = sprintf "%5.3f", ($Ncnt / $Nkeep); 1800 $statline = "Mean Counts: $Ncnt<br> r.m.s. median sigma: $Sigma <br><br>\n"; 1801 } 1802 } else { 1803 $statline = ""; 1804 } 1805 1806 $imbin = mknames ("imbin", $line); 1807 print STDOUT "<table><tr><td width=300px valign=top>\n"; 1808 print STDOUT "<b>this config has been $message. </b><br>\n"; 1809 print STDOUT "there are $Nimage images, $Nkeep used. <br>\n"; 1810 print STDOUT "$statline\n"; 1811 print STDOUT "you have the following choices: <br>\n"; 1812 print STDOUT "<a href=$CGI/elixir1?&elconf=$elconf> <b> return to top level </b><br></a>\n"; 1813 print STDOUT "<a href=$CGI/split?$config&elconf=$elconf> <b> split config </b><br></a>\n"; 1814 print STDOUT "<a href=$CGI/accept?$key&elconf=$elconf> <b> accept config </b><br></a>\n"; 1815 print STDOUT "</td><td width=640px align=right><img width=100% src=$imbin></td></tr></table>\n"; 1816 1817 print STDOUT "<center><b>Statistics on each available input image.</b></center> 1818 Time is in UT, light background means dawn, grey means dusk. Click 1819 on the column heading to sort by that entry\n"; 1820 1821 print STDOUT "<table bgcolor=#fff0e0 border=1 cellspacing=0 cellpadding=3>\n"; 1822 print STDOUT "<tr bgcolor=#00aaaa>\n"; 1823 print STDOUT "<th > <a href=$CGI/elixir2?$key.0&elconf=$elconf> image </a></th>\n"; 1824 print STDOUT "<th > Date </th>\n"; 1825 print STDOUT "<th > Time </th>\n"; 1826 print STDOUT "<th > <a href=$CGI/elixir2?$key.3&elconf=$elconf> Mean </a></th>\n"; 1827 print STDOUT "<th > <a href=$CGI/elixir2?$key.5&elconf=$elconf> Sigma (raw) </a></th>\n"; 1828 print STDOUT "<th > <a href=$CGI/elixir2?$key.6&elconf=$elconf> Sigma (clipped) </a></th>\n"; 1829 print STDOUT "<th > <a href=$CGI/elixir2?$key.8&elconf=$elconf> Sigma (med) </a></th>\n"; 1830 print STDOUT "<th > image </th>\n"; 1831 print STDOUT "<th > used? </th></tr>\n\n"; 1832 1833 @order = (); 1834 for ($i = 0; $i < $Nimage; $i++) { @order = (@order, $i); } 1835 1836 @entry = sort by_col @order; 1837 1838 for ($i = 0; $i < $Nimage; $i++) { 1839 $N = $entry[$i]; 1840 1841 @word = split (" ", $statdata[$N]); 1842 $used = $word[12]; 1843 $dawn = $word[11]; 1844 1845 @tmpw = split (" ", $mastdata[$N]); 1846 $keep = $tmpw[1]; 1847 1848 @tmpw = split ("/", $medndata[$N]); 1849 $medname = $tmpw[-1]; 1850 1851 print STDOUT "<tr><td> <a href=$CGI/elixir3?$N.$key&elconf=$elconf> $word[0] </a></td><td> $word[1] </td>\n"; 1852 if ($dawn) { print STDOUT "<td bgcolor=#cccccc> $word[2] </td>\n"; } 1853 else { print STDOUT "<td> $word[2] </td>\n"; } 1854 print STDOUT "<td> $word[3] </td>\n"; # mean 1855 print STDOUT "<td> $word[5] </td>\n"; # Sigma (raw) 1856 print STDOUT "<td> $word[6] </td>\n"; # Sigma (clip) 1857 print STDOUT "<td> $word[8] </td>\n"; # Sigma (med) 1858 print STDOUT "<td> <a border=0 href=$CGI/elixir3?$N.$key&elconf=$elconf>\n"; 1859 print STDOUT "<img src=$www/$medname></a></td>\n"; 1860 if ($used) { print STDOUT "<td>yes</td>\n"; } 1861 else { print STDOUT "<td>no</td>\n"; } 1862 print STDOUT "</tr>\n"; 1863 } 1864 1865 print STDOUT "</table></body>\n"; 1866 &goodbye; 1867 1713 1868 } 1714 1869 1715 1870 #### process report for html2 ########## 1716 sub flips_report_done { 1717 1718 ($config) = $_[0] =~ /(\w+.\w+.\w+)/; 1719 ($key) = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1720 $line = $_[1]; 1721 1722 open (STAT, mknames ("stats", $line)); 1723 open (MED, mknames ("medbin", $line)); 1724 open (MASTER, mknames ("master", $line, $ccds[0])); 1725 1726 print STDOUT "<table border>\n"; 1727 print STDOUT "<tr><th> image </th><th> Date </th><th> Time </th><th> Mean </th>\n"; 1728 print STDOUT "<th> Sigma (raw) </th><th> Sigma (clipped) </th><th> Sigma (med) </th><th> image </th><th> used? </th></tr>\n\n"; 1729 1730 for ($i = 0; $line = <STAT>; $i++) { 1871 sub flips_report_done_old { 1872 1873 ($config) = $_[0] =~ /(\w+.\w+.\w+)/; 1874 ($key) = $_[0] =~ /(\w+.\w+.\w+.\w+)/; # (config.ver) 1875 $line = $_[1]; 1876 1877 open (STAT, mknames ("stats", $line)); 1878 open (MED, mknames ("medbin", $line)); 1879 open (MASTER, mknames ("master", $line, $ccds[0])); 1880 1881 print STDOUT "<table border>\n"; 1882 print STDOUT "<tr><th> image </th><th> Date </th><th> Time </th><th> Mean </th>\n"; 1883 print STDOUT "<th> Sigma (raw) </th><th> Sigma (clipped) </th><th> Sigma (med) </th><th> image </th><th> used? </th></tr>\n\n"; 1884 1885 for ($i = 0; $line = <STAT>; $i++) { 1886 1887 chop ($line); 1888 # print STDOUT "$line<br>\n"; 1889 @word = split (" ",$line); 1890 $used = $word[12]; 1891 $dawn = $word[11]; 1892 1893 $line = <MASTER>; 1894 chop ($line); 1895 # print STDOUT "$line<br>\n"; 1896 @tmpw = split (" ",$line); 1897 $keep = $tmpw[1]; 1898 1899 # mkdetrend works with files in the user's paths, but the web page needs 1900 # to work with files visible to the web server 1901 $line = <MED>; 1902 chop ($line); 1903 @tmpw = split ("/", $line); 1904 $N = @tmpw - 1; 1905 $medname = $tmpw[$N]; 1906 1907 $sig1 = sprintf "%5.3f", $word[4]; 1908 $sig2 = sprintf "%5.3f", $word[5]; 1909 $sig3 = sprintf "%5.3f", $word[6]; 1910 $sig4 = sprintf "%5.3f", $word[7]; 1911 $mean = sprintf "%8.1f", $word[3]; 1912 1913 print STDOUT "<tr><td> <a href=$CGI/elixir3?$i.$key&elconf=$elconf> $word[0] </a></td><td> $word[1] </td>\n"; 1914 if ($dawn) { print STDOUT "<td bgcolor=#cccccc> $word[2] </td>\n"; } 1915 else { print STDOUT "<td> $word[2] </td>\n"; } 1916 print STDOUT "<td> $word[3] </td>\n"; 1917 print STDOUT "<td> $word[5] </td><td> $word[6] </td><td> $word[8] </td><td><img src=$www/$medname></td>\n"; 1918 if ($used) { print STDOUT "<td bgcolor=#00c000>yes</td>\n"; } 1919 else { print STDOUT "<td bgcolor=#d00000>no</td>\n"; } 1920 } 1921 $Nimage = $i; 1922 1923 print STDOUT "</table>\n"; 1924 print STDOUT "</body>\n"; 1925 1926 &goodbye; 1927 1928 } 1929 1930 #### process report for html3 ########## 1931 sub flips_entry { 1932 1933 my($version)= $_[0]; # version of desired entry 1934 my($entry) = $_[1]; # desired entry in list 1935 my($line) = $_[2]; # list of image stats 1936 1937 open (STAT, mknames ("stats", $line)); 1938 open (TEN, mknames ("tenbin", $line)); 1939 1940 for ($i = 0; ($i < $entry + 1) && ($line = <STAT>) && ($tenline = <TEN>); $i++) {} 1941 if ($i != $entry + 1) { &escape ("</table> selected entry out of range"); } 1942 1943 $first = ($entry == 0); 1944 $tmp = <STAT>; 1945 $last = ($tmp == ""); 1946 $next = $entry + 1; 1947 $prev = $entry - 1; 1731 1948 1732 1949 chop ($line); 1733 # print STDOUT "$line<br>\n";1734 1950 @word = split (" ",$line); 1735 $used = $word[12]; 1736 $dawn = $word[11]; 1737 1738 $line = <MASTER>; 1739 chop ($line); 1740 # print STDOUT "$line<br>\n"; 1741 @tmpw = split (" ",$line); 1742 $keep = $tmpw[1]; 1951 $keep = $word[12]; 1743 1952 1744 1953 # mkdetrend works with files in the user's paths, but the web page needs 1745 1954 # to work with files visible to the web server 1746 $line = <MED>; 1747 chop ($line); 1748 @tmpw = split ("/", $line); 1955 chop ($tenline); 1956 @tmpw = split ("/", $tenline); 1749 1957 $N = @tmpw - 1; 1750 $ medname = $tmpw[$N];1958 $name = $tmpw[$N]; 1751 1959 1752 1960 $sig1 = sprintf "%5.3f", $word[4]; … … 1756 1964 $mean = sprintf "%8.1f", $word[3]; 1757 1965 1758 print STDOUT "<tr><td> <a href=$CGI/elixir3?$i.$key&elconf=$elconf> $word[0] </a></td><td> $word[1] </td>\n"; 1759 if ($dawn) { print STDOUT "<td bgcolor=#cccccc> $word[2] </td>\n"; } 1760 else { print STDOUT "<td> $word[2] </td>\n"; } 1761 print STDOUT "<td> $word[3] </td>\n"; 1762 print STDOUT "<td> $word[5] </td><td> $word[6] </td><td> $word[8] </td><td><img src=$www/$medname></td>\n"; 1763 if ($used) { print STDOUT "<td bgcolor=#00c000>yes</td>\n"; } 1764 else { print STDOUT "<td bgcolor=#d00000>no</td>\n"; } 1765 } 1766 $Nimage = $i; 1767 1768 print STDOUT "</table>\n"; 1769 print STDOUT "</body>\n"; 1770 1771 &goodbye; 1772 1773 } 1774 1775 #### process report for html3 ########## 1776 sub flips_entry { 1777 1778 my($version)= $_[0]; # version of desired entry 1779 my($entry) = $_[1]; # desired entry in list 1780 my($line) = $_[2]; # list of image stats 1781 1782 open (STAT, mknames ("stats", $line)); 1783 open (TEN, mknames ("tenbin", $line)); 1784 1785 for ($i = 0; ($i < $entry + 1) && ($line = <STAT>) && ($tenline = <TEN>); $i++) {} 1786 if ($i != $entry + 1) { &escape ("</table> selected entry out of range"); } 1787 1788 $first = ($entry == 0); 1789 $tmp = <STAT>; 1790 $last = ($tmp == ""); 1791 $next = $entry + 1; 1792 $prev = $entry - 1; 1793 1794 chop ($line); 1795 @word = split (" ",$line); 1796 $keep = $word[12]; 1797 1798 # mkdetrend works with files in the user's paths, but the web page needs 1799 # to work with files visible to the web server 1800 chop ($tenline); 1801 @tmpw = split ("/", $tenline); 1802 $N = @tmpw - 1; 1803 $name = $tmpw[$N]; 1804 1805 $sig1 = sprintf "%5.3f", $word[4]; 1806 $sig2 = sprintf "%5.3f", $word[5]; 1807 $sig3 = sprintf "%5.3f", $word[6]; 1808 $sig4 = sprintf "%5.3f", $word[7]; 1809 $mean = sprintf "%8.1f", $word[3]; 1810 1811 print STDOUT "<img width=100% src=$www/$name>\n"; 1812 1813 print STDOUT "<table><tr><td>\n"; 1814 print STDOUT "<table border>\n"; 1815 print STDOUT "<tr><th> image </th><th> Date </th><th> Time </th><th> Mean </th>\n"; 1816 print STDOUT "<th> Sigma (raw) </th><th> Sigma (clipped) </th><th> Sigma (med) </th><th> used? </th></tr>\n\n"; 1817 1818 print STDOUT "<tr><td> $word[0] </a></td><td> $word[1] </td><td> $word[2] </td><td> $word[3] </td>\n"; 1819 print STDOUT "<td> $word[5] </td><td> $word[6] </td><td> $word[8] </td>\n"; 1820 if ($keep) { 1821 print STDOUT "<td>yes</td>\n"; 1822 } else { 1823 print STDOUT "<td bgcolor=#ff0000>no</td>\n"; 1824 } 1825 print STDOUT "</tr>\n\n"; 1826 print STDOUT "</table>\n"; 1827 1828 print STDOUT "</td></tr>\n"; 1829 1830 print STDOUT "<tr><td> return to <a href=$CGI/elixir1&elconf=$elconf> config list </a></tr></td>\n"; 1831 print STDOUT "<tr><td> return to <a href=$CGI/elixir2?$version&elconf=$elconf> $version </a></tr></td>\n"; 1832 if (!$first) { print STDOUT "<tr><td> goto <a href=$CGI/elixir3?$prev.$version&elconf=$elconf> prev </a> image </td></tr>\n"; } 1833 if (!$last) { print STDOUT "<tr><td> goto <a href=$CGI/elixir3?$next.$version&elconf=$elconf> next </a> image </td></tr>\n"; } 1834 print STDOUT "</table>\n"; 1835 1836 print STDOUT "</body>\n"; 1837 &goodbye; 1966 print STDOUT "<img width=100% src=$www/$name>\n"; 1967 1968 print STDOUT "<table><tr><td>\n"; 1969 print STDOUT "<table border>\n"; 1970 print STDOUT "<tr><th> image </th><th> Date </th><th> Time </th><th> Mean </th>\n"; 1971 print STDOUT "<th> Sigma (raw) </th><th> Sigma (clipped) </th><th> Sigma (med) </th><th> used? </th></tr>\n\n"; 1972 1973 print STDOUT "<tr><td> $word[0] </a></td><td> $word[1] </td><td> $word[2] </td><td> $word[3] </td>\n"; 1974 print STDOUT "<td> $word[5] </td><td> $word[6] </td><td> $word[8] </td>\n"; 1975 if ($keep) { 1976 print STDOUT "<td>yes</td>\n"; 1977 } else { 1978 print STDOUT "<td bgcolor=#ff0000>no</td>\n"; 1979 } 1980 print STDOUT "</tr>\n\n"; 1981 print STDOUT "</table>\n"; 1982 1983 print STDOUT "</td></tr>\n"; 1984 1985 print STDOUT "<tr><td> return to <a href=$CGI/elixir1&elconf=$elconf> config list </a></tr></td>\n"; 1986 print STDOUT "<tr><td> return to <a href=$CGI/elixir2?$version&elconf=$elconf> $version </a></tr></td>\n"; 1987 if (!$first) { print STDOUT "<tr><td> goto <a href=$CGI/elixir3?$prev.$version&elconf=$elconf> prev </a> image </td></tr>\n"; } 1988 if (!$last) { print STDOUT "<tr><td> goto <a href=$CGI/elixir3?$next.$version&elconf=$elconf> next </a> image </td></tr>\n"; } 1989 print STDOUT "</table>\n"; 1990 1991 print STDOUT "</body>\n"; 1992 &goodbye; 1838 1993 } 1839 1994 … … 1945 2100 close (FILE); 1946 2101 } 1947 2102 1948 2103 # $root/detrend.config - current run 1949 2104 # $det/config.dat - config info for specific run, 1 line per setup … … 1994 2149 last; 1995 2150 } 2151 if ($type eq "links") { 2152 $value = "$det/flips/links"; 2153 last; 2154 } 1996 2155 if ($type eq "split") { 1997 2156 $value = "$det/split"; … … 2075 2234 last; 2076 2235 } 2236 if ($type eq "link") { 2237 $dir = mkfiles ("links"); 2238 $ccd = $_[2]; 2239 if ($ccd eq "") { &escape ("missing CCD for mknames fits"); } 2240 $value = "$dir/$words[0].$words[1].$words[2].$ccd.$words[3].fits"; 2241 last; 2242 } 2243 if ($type eq "mef") { 2244 $dir = mkfiles ("flips"); 2245 $value = "$dir/$words[0].$words[1].$words[2].$words[3].fits"; 2246 last; 2247 } 2077 2248 if ($type eq "proc.medbin") { 2078 2249 $dir = mkfiles ("flips"); … … 2106 2277 #************************** 2107 2278 sub gtconfig { 2108 my ($value, $type, @words);2109 # in: (config line) (type)2110 @words = split (" ", $_[0]);2111 $type = $_[1];2112 2113 {2114 if ($type eq "elixir") {2115 $value = "$words[0] $words[1] $words[2] $words[3]";2116 last;2117 }2118 if ($type eq "mosaic") {2119 $ccd = "xx";2120 $value = "$words[0] $words[1] $words[2] $ccd $words[3] $words[4] $words[5]";2121 last;2122 }2123 if ($type eq "chiprun") {2124 $ccd = sprintf "%02d",$_[2];2125 $value = "$words[0] $words[1] $words[2] $ccd $words[3] $words[4] $words[5]";2126 last;2127 }2128 if ($type eq "config") {2129 $value = "$words[0].$words[1].$words[2]";2130 last;2131 }2132 if ($type eq "version") {2133 $value = "$words[0].$words[1].$words[2].$words[3]";2134 last;2135 }2136 if ($type eq "ID") {2137 $value = "$words[0]";2138 last;2139 }2140 if ($type eq "type") {2141 $value = "$words[1]";2142 last;2143 }2144 if ($type eq "filter") {2145 $value = "$words[2]";2146 last;2147 }2148 if ($type eq "from") {2149 $value = "$words[4]";2150 last;2151 }2152 if ($type eq "to") {2153 $value = "$words[5]";2154 last;2155 }2156 if ($type eq "status") {2157 $value = "$words[6]";2158 last;2159 }2160 &escape ("unknown type for gtconfig: $type");2161 }2162 2163 return $value;2279 my ($value, $type, @words); 2280 # in: (config line) (type) 2281 @words = split (" ", $_[0]); 2282 $type = $_[1]; 2283 2284 { 2285 if ($type eq "elixir") { 2286 $value = "$words[0] $words[1] $words[2] $words[3]"; 2287 last; 2288 } 2289 if ($type eq "mosaic") { 2290 $ccd = "xx"; 2291 $value = "$words[0] $words[1] $words[2] $ccd $words[3] $words[4] $words[5]"; 2292 last; 2293 } 2294 if ($type eq "chiprun") { 2295 $ccd = $_[2]; 2296 $value = "$words[0] $words[1] $words[2] $ccd $words[3] $words[4] $words[5]"; 2297 last; 2298 } 2299 if ($type eq "config") { 2300 $value = "$words[0].$words[1].$words[2]"; 2301 last; 2302 } 2303 if ($type eq "version") { 2304 $value = "$words[0].$words[1].$words[2].$words[3]"; 2305 last; 2306 } 2307 if ($type eq "ID") { 2308 $value = "$words[0]"; 2309 last; 2310 } 2311 if ($type eq "type") { 2312 $value = "$words[1]"; 2313 last; 2314 } 2315 if ($type eq "filter") { 2316 $value = "$words[2]"; 2317 last; 2318 } 2319 if ($type eq "from") { 2320 $value = "$words[4]"; 2321 last; 2322 } 2323 if ($type eq "to") { 2324 $value = "$words[5]"; 2325 last; 2326 } 2327 if ($type eq "status") { 2328 $value = "$words[6]"; 2329 last; 2330 } 2331 &escape ("unknown type for gtconfig: $type"); 2332 } 2333 2334 return $value; 2164 2335 } 2165 2336 … … 2214 2385 if ($run eq "") { 2215 2386 $run = `gconfig RUNID.MKDETREND`; chop $run; 2216 if ($?) { &escape ("run is not defined: use ' mkdetrendconfig' or 'mkrun sys'\n"); }2217 if ($run eq "") { &escape ("run is not defined: use ' mkdetrendconfig' or 'mkrun sys'\n"); }2387 if ($?) { &escape ("run is not defined: use '$MKDETREND config' or 'mkrun sys'\n"); } 2388 if ($run eq "") { &escape ("run is not defined: use '$MKDETREND config' or 'mkrun sys'\n"); } 2218 2389 push @opt, "-D RUNID.MKDETREND $run -D RUNID $run"; 2219 2390 } … … 2244 2415 if ($?) { &escape ("error with elixir camera configuration"); } 2245 2416 2246 $answer = `cameraconfig -ccds`; 2247 @ccds = split (" ", $answer); 2417 @ccds = split (" ", `cameraconfig -ccdn`); 2248 2418 if ($?) { &escape ("error with elixir camera configuration"); } 2249 2419 … … 2271 2441 return (@argv); 2272 2442 } 2273 2443 2274 2444 sub vsystem { 2275 print STDERR "@_\n";2276 $status = system ("@_");2277 $status;2445 print STDERR "@_\n"; 2446 $status = system ("@_"); 2447 $status; 2278 2448 } 2279 2449 … … 2290 2460 2291 2461 sub usage { 2292 if (@ARGV == 1) { 2293 print STDERR "\n --- user modes ---\n"; 2294 print STDERR "create (run) (startdate) (stopdate)\n"; 2295 print STDERR "config (run)\n"; 2296 print STDERR "init\n"; 2297 print STDERR "run\n"; 2298 print STDERR "list.runs\n"; 2299 print STDERR "set (config.ver) (state)\n"; 2300 print STDERR "reg\n"; 2301 print STDERR "state \n"; 2302 print STDERR "help \n"; 2303 print STDERR "\n --- internal modes --- \n"; 2304 print STDERR "flips\n"; 2305 print STDERR "norm\n"; 2306 print STDERR "update\n"; 2307 print STDERR "merge\n"; 2308 print STDERR "dup (config)\n"; 2309 print STDERR "del (config)\n"; 2310 print STDERR "def (config.ver) (start) (stop)\n"; 2311 print STDERR "eval (step)\n"; 2312 print STDERR "mevel (step)\n"; 2313 print STDERR "htmldup\n"; 2314 print STDERR "htmldel\n"; 2315 print STDERR "htmldef\n"; 2316 print STDERR "htmlmod\n"; 2317 print STDERR "htmlkeep\n"; 2318 print STDERR "html1\n"; 2319 print STDERR "html2 (config.ver)\n"; 2320 print STDERR "html3 (entry.config.ver)\n"; 2462 if (@ARGV == 1) { 2463 print STDERR "\n --- user modes ---\n"; 2464 print STDERR "create (run) (startdate) (stopdate)\n"; 2465 print STDERR "config (run)\n"; 2466 print STDERR "init\n"; 2467 print STDERR "run\n"; 2468 print STDERR "list.runs\n"; 2469 print STDERR "set (config.ver) (state)\n"; 2470 print STDERR "reg\n"; 2471 print STDERR "state \n"; 2472 print STDERR "help \n"; 2473 print STDERR "\n --- internal modes --- \n"; 2474 print STDERR "flips\n"; 2475 print STDERR "norm\n"; 2476 print STDERR "update\n"; 2477 print STDERR "merge\n"; 2478 print STDERR "dup (config)\n"; 2479 print STDERR "del (config)\n"; 2480 print STDERR "def (config.ver) (start) (stop)\n"; 2481 print STDERR "eval (step)\n"; 2482 print STDERR "mevel (step)\n"; 2483 print STDERR "htmldup\n"; 2484 print STDERR "htmldel\n"; 2485 print STDERR "htmldef\n"; 2486 print STDERR "htmlmod\n"; 2487 print STDERR "htmlkeep\n"; 2488 print STDERR "html1\n"; 2489 print STDERR "html2 (config.ver)\n"; 2490 print STDERR "html3 (entry.config.ver)\n"; 2491 &escape; 2492 } 2493 2494 if (@ARGV > 2) { print STDERR "USAGE: $MKDETREND (help) [mode]\n"; &escape; } 2495 2496 if ($ARGV[1] eq "config") { 2497 print STDERR "set up initial configuration\n"; 2498 &escape; 2499 } 2500 2501 if ($ARGV[1] eq "save") { 2502 print STDERR "save results from current configuration\n"; 2503 &escape; 2504 } 2505 2506 print STDERR "help for $ARGV[1] no defined\n"; 2321 2507 &escape; 2322 } 2323 2324 if (@ARGV > 2) { print STDERR "USAGE: mkdetrend (help) [mode]\n"; &escape; } 2325 2326 if ($ARGV[1] eq "config") { 2327 print STDERR "set up initial configuration\n"; 2328 &escape; 2329 } 2330 2331 if ($ARGV[1] eq "save") { 2332 print STDERR "save results from current configuration\n"; 2333 &escape; 2334 } 2335 2336 print STDERR "help for $ARGV[1] no defined\n"; 2337 &escape; 2338 } 2508 } -
trunk/Ohana/src/perl/src/mkfringe
r17 r46 1 1 #!/usr/bin/perl 2 $MKFRINGE = mkfringe2; 2 3 3 4 # strip off args related to the elixir config system, set env PTOLEMY … … 6 7 # interpret command-line arguments 7 8 if (@ARGV < 1) { 8 print STDOUT "USAGE: mkfringe(mode) [arguments]\n";9 print STDOUT "USAGE: $MKFRINGE (mode) [arguments]\n"; 9 10 print STDOUT "mode = help gives a complete list\n"; 10 11 &escape; … … 62 63 63 64 if ($ARGV[1] eq "run") { &mk_createrun; } 64 if (@ARGV != 5) { &escape ("USAGE: mkfringecreate (camera) (run) (startdate) (stopdate)"); }65 if (@ARGV != 5) { &escape ("USAGE: $MKFRINGE create (camera) (run) (startdate) (stopdate)"); } 65 66 66 67 # setting $run & $start here overrides default values loaded by set_globals() … … 109 110 sub mk_createrun { 110 111 111 if (@ARGV != 3) { &escape ("USAGE: mkfringecreate run (run)"); }112 if (@ARGV != 3) { &escape ("USAGE: $MKFRINGE create run (run)"); } 112 113 if ($ARGV[1] ne "run") { &escape ("USAGE: mkdetrend create run (run)"); } 113 114 … … 148 149 sub mk_config { 149 150 150 if (@ARGV != 3) { &escape ("USAGE: mkfringeconfig (camera) (run)"); }151 if (@ARGV != 3) { &escape ("USAGE: $MKFRINGE config (camera) (run)"); } 151 152 152 153 $camera = $ARGV[1]; … … 167 168 sub mk_init { 168 169 169 if (@ARGV != 1) { &escape ("USAGE: mkfringerun"); }170 171 system " mkfringelist.init\n";172 system " mkfringedetrend\n";173 system " mkfringemerge\n";170 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE run"); } 171 172 system "$MKFRINGE list.init\n"; 173 system "$MKFRINGE detrend\n"; 174 system "$MKFRINGE merge\n"; 174 175 &goodbye; 175 176 } … … 178 179 sub mk_run { 179 180 180 if (@ARGV != 1) { &escape ("USAGE: mkfringerun"); }181 182 system " mkfringemkrough";183 system " mkfringedefringe";184 system " mkfringemerge";181 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE run"); } 182 183 system "$MKFRINGE mkrough"; 184 system "$MKFRINGE defringe"; 185 system "$MKFRINGE merge"; 185 186 186 187 &goodbye; … … 190 191 sub mk_reg { 191 192 192 if (@ARGV != 1) { &escape ("USAGE: mkfringereg"); }193 194 system " mkfringemksmooth";195 system " mkfringeregimage";193 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE reg"); } 194 195 system "$MKFRINGE mksmooth"; 196 system "$MKFRINGE regimage"; 196 197 197 198 &goodbye; … … 201 202 sub mk_state { 202 203 203 if (@ARGV != 1) { &escape ("USAGE: mkfringestate"); }204 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE state"); } 204 205 205 206 ($start, $stop, $mode) = &load_dates; … … 212 213 213 214 @list = &load_config; 214 if (@list == 0) { &escape (" mkfringenot configured"); }215 if (@list == 0) { &escape ("$MKFRINGE not configured"); } 215 216 216 217 for ($i = 0; $i < @list; $i++) { … … 223 224 sub mk_list_runs { 224 225 225 if (@ARGV != 1) { &escape ("USAGE: mkfringelist.runs"); }226 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE list.runs"); } 226 227 227 228 system ("ls $root"); … … 233 234 234 235 # create mkfringe config file from existing date entries 235 if (@ARGV != 1) { &escape ("USAGE: mkfringemkconfig"); }236 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE mkconfig"); } 236 237 237 238 # if new run, need to create the new detdir … … 244 245 245 246 ($start, $stop, $mode) = &load_dates; 246 if (($start eq "") || ($stop eq "")) { &escape ("dates are not defined: use ' mkfringeconfig'"); }247 if (($start eq "") || ($stop eq "")) { &escape ("dates are not defined: use '$MKFRINGE config'"); } 247 248 248 249 # create run-specific config file … … 259 260 sub mk_dup { 260 261 261 if (@ARGV != 2) { &escape ("USAGE: mkfringedup (config)"); }262 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE dup (config)"); } 262 263 263 264 $key = $ARGV[1]; … … 286 287 sub mk_cleanup { 287 288 288 if ((@ARGV != 1) && (@ARGV != 2)) { &escape ("USAGE: mkfringecleanup [mode]"); }289 if ((@ARGV != 1) && (@ARGV != 2)) { &escape ("USAGE: $MKFRINGE cleanup [mode]"); } 289 290 290 291 $DEBUG = 0; … … 343 344 sub mk_del { 344 345 345 if (@ARGV != 2) { &escape ("USAGE: mkfringedel (config.ver)"); }346 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE del (config.ver)"); } 346 347 347 348 $key = $ARGV[1]; … … 376 377 sub mk_def { 377 378 378 if (@ARGV != 4) { &escape ("USAGE: mkfringedef (config.ver) (start) (stop)"); }379 if (@ARGV != 4) { &escape ("USAGE: $MKFRINGE def (config.ver) (start) (stop)"); } 379 380 380 381 $key = $ARGV[1]; … … 408 409 sub mk_set { 409 410 410 if (@ARGV != 3) { &escape ("USAGE: mkfringeset (config number) (state)"); }411 if (@ARGV != 3) { &escape ("USAGE: $MKFRINGE set (config number) (state)"); } 411 412 412 413 @list = load_config (); … … 429 430 sub mk_list_init { 430 431 431 if (@ARGV != 1) { &escape ("USAGE: mkfringelist.init"); }432 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE list.init"); } 432 433 433 434 # create necessary directories … … 457 458 458 459 vsystem ("elixir -D DETREND_DIR $det -D mode fringe1 $file"); 459 vsystem (" mkfringeeval $file init");460 vsystem ("$MKFRINGE eval $file init"); 460 461 461 462 open (FILE, "$file.eval"); … … 484 485 sub mk_list_reinit { 485 486 486 if (@ARGV != 1) { &escape ("USAGE: mkfringelist.init"); }487 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE list.init"); } 487 488 488 489 # create necessary directories … … 509 510 510 511 vsystem ("elixir -D DETREND_DIR $det -D mode fringe1 -D global.pending master.lists $file"); 511 vsystem (" mkfringeeval $file init");512 vsystem ("$MKFRINGE eval $file init"); 512 513 513 514 open (FILE, "$file.eval"); … … 536 537 sub mk_detrend { 537 538 538 if (@ARGV != 1) { &escape ("USAGE: mkfringedetrend"); }539 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE detrend"); } 539 540 540 541 @list = load_config (); … … 563 564 564 565 vsystem ("elixir -D DETREND_DIR $det -D mode fringe2 $file"); 565 vsystem (" mkfringeeval $file detrend");566 vsystem ("$MKFRINGE eval $file detrend"); 566 567 567 568 open (FILE, "$file.eval"); … … 602 603 sub mk_map { 603 604 604 if (@ARGV != 1) { &escape ("USAGE: mkfringemap"); }605 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE map"); } 605 606 606 607 @list = load_config (); … … 635 636 sub mk_map_reg { 636 637 637 if (@ARGV != 1) { &escape ("USAGE: mkfringemap.reg"); }638 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE map.reg"); } 638 639 639 640 @list = load_config (); … … 666 667 sub mk_mkrough { 667 668 668 if (@ARGV != 1) { &escape ("USAGE: mkfringemkrough"); }669 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE mkrough"); } 669 670 670 671 @list = load_config (); … … 689 690 $CONFIG = mknames ("config", $confline); 690 691 692 # extract the selected subset of detrend images from master & statlist to sublist 691 693 vsystem ("fr.mklists -subset $CONFIG.master $CONFIG.med.statlist $CONFIG.med.sublist"); 692 694 if ($?) { &escape ("failure running fr.mklists -subset"); } 693 695 696 # extract the selected subset of defringed images from master & statlist to sublist 694 697 vsystem ("fr.mklists -subset $CONFIG.master $CONFIG.def.statlist $CONFIG.def.sublist"); 695 698 if ($?) { &escape ("failure running fr.mklists -subset"); } 696 699 700 # calculate fit parameters based on subset 697 701 vsystem ("fr.frstats -fitpars $CONFIG.med.sublist $CONFIG.fitpar"); 698 702 if ($?) { &escape ("failure running fr.frstats -fitpars"); } 699 703 704 # calculate optimal per-image fringe statistics based on fit parameters 700 705 vsystem ("fr.frstats -frstats $CONFIG.med.statlist $CONFIG.fitpar $CONFIG.med.imstats"); 701 706 if ($?) { &escape ("failure running fr.frstats -frstats"); } 702 707 708 # calculate per-image residual fringe stats 703 709 vsystem ("fr.frstats -dfstats $CONFIG.def.statlist $CONFIG.fitpar $CONFIG.def.imstats"); 704 710 if ($?) { &escape ("failure running fr.frstats -dfstats"); } 705 711 712 # assemble master fringe statistic file needed by web tools 706 713 vsystem ("fr.mklists -imstats $CONFIG.master $CONFIG.med.imstats $CONFIG.def.imstats $CONFIG.datlist $CONFIG.imstats"); 707 714 if ($?) { &escape ("failure running fr.mklists -imstats"); } … … 714 721 715 722 vsystem ("elixir -D DETREND_DIR $det -D mode fringe4 $file"); 716 vsystem (" mkfringeeval $file mkrough");723 vsystem ("$MKFRINGE eval $file mkrough"); 717 724 718 725 open (FILE, "$file.eval"); … … 744 751 sub mk_defringe { 745 752 746 if (@ARGV != 1) { &escape ("USAGE: mkfringedefringe"); }753 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE defringe"); } 747 754 748 755 @list = load_config (); … … 770 777 771 778 vsystem ("elixir -D DETREND_DIR $det -D mode fringe3 $file"); 772 vsystem (" mkfringeeval $file defringe");779 vsystem ("$MKFRINGE eval $file defringe"); 773 780 774 781 open (FILE, "$file.eval"); … … 805 812 sub mk_merge { 806 813 807 if (@ARGV != 1) { &escape ("USAGE: mkfringemerge"); }814 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE merge"); } 808 815 809 816 @list = load_config (); … … 830 837 831 838 vsystem ("fr.frstats -plotstats $CONFIG.med.statlist $CONFIG.fitpar $CONFIG.stats.png"); 832 if ($?) { &escape ("failure running fr.frstats - fitpars"); }839 if ($?) { &escape ("failure running fr.frstats -plotstats"); } 833 840 834 841 vsystem ("fr.frstats -frstats $CONFIG.med.statlist $CONFIG.fitpar $CONFIG.med.imstats"); … … 887 894 sub mk_smooth { 888 895 889 if (@ARGV != 1) { &escape ("USAGE: mkfringemksmooth"); }896 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE mksmooth"); } 890 897 891 898 @list = load_config (); … … 914 921 915 922 vsystem ("elixir -D DETREND_DIR $det -D mode fringe4 -D global.pending mksmooth $file"); 916 vsystem (" mkfringeeval $file smooth");923 vsystem ("$MKFRINGE eval $file smooth"); 917 924 918 925 open (FILE, "$file.eval"); … … 944 951 sub mk_regimage { 945 952 946 if (@ARGV != 1) { &escape ("USAGE: mkfringeregimage"); }953 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE regimage"); } 947 954 948 955 @list = load_config (); … … 957 964 $success = 1; 958 965 $ID = gtconfig ($confline, "ID"); 959 for ($j = 0; $j < $Nccd; $j++) { 960 $file = mknames ("smfile", $confline, $ccds[$j]); 961 $line = "detregister $file -label fringe-2.1 -ID $ID"; 962 $status = system ($line); 963 if ($status) { 964 print STDERR "error registering $file\n"; 965 $success = 0; 966 967 $DBmode = `gconfig DETREND-DB-MODE`; chop $DBmode; 968 $DBmode = "\U$DBmode\E"; 969 970 if ($DBmode eq "SPLIT") { 971 for ($j = 0; $j < $Nccd; $j++) { 972 $file = mknames ("smfile", $confline, $ccds[$j]); 973 $line = "detregister $file -label fringe-2.1 -ID $ID"; 974 $status = system ($line); 975 if ($status) { 976 print STDERR "error registering $file\n"; 977 $success = 0; 978 } 966 979 } 967 } 980 goto registered; 981 } 982 983 if ($DBmode eq "MEF") { 984 # make links 985 foreach $ccd (@ccds) { 986 $file = mknames ("smfile", $confline, $ccd); 987 $link = mknames ("link", $confline, $ccd); 988 symlink $file, $link; 989 } 990 991 # mef, register 992 $mef = mknames ("mef", $confline); 993 vsystem ("fhtool -P $links $mef"); 994 if ($status) { $success = 0; } 995 vsystem ("detregister $mef -label fringe-2.1 -ID $ID"); 996 if ($status) { $success = 0; } 997 998 # remove links 999 foreach $ccd (@ccds) { 1000 $link = mknames ("link", $confline, $ccd); 1001 unlink $link; 1002 } 1003 goto registered; 1004 } 1005 print STDERR "DB mode not defined?\n"; 1006 $success = 0; 1007 1008 registered: 968 1009 if ($success) { 969 1010 $confline = stconfig ($confline, "status", "done"); 970 1011 } else { 1012 print STDERR "error registering $file\n"; 971 1013 $confline = stconfig ($confline, "status", "fail.reg"); 972 1014 } … … 979 1021 sub mk_eval { 980 1022 981 if (@ARGV != 3) { &escape ("USAGE: mkfringemeval (file) (step)"); }1023 if (@ARGV != 3) { &escape ("USAGE: $MKFRINGE meval (file) (step)"); } 982 1024 983 1025 $infile = $ARGV[1]; … … 1049 1091 sub mk_htmldup { 1050 1092 1051 if (@ARGV != 2) { &escape ("USAGE: mkfringehtmldup (config)"); }1093 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE htmldup (config)"); } 1052 1094 1053 1095 $config = $ARGV[1]; 1054 system (" mkfringedup $config");1096 system ("$MKFRINGE dup $config"); 1055 1097 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/fr.elixir1?&elconf=$elconf\">\n"; 1056 1098 … … 1061 1103 sub mk_htmldel { 1062 1104 1063 if (@ARGV != 2) { &escape ("USAGE: mkfringehtmldel (config.ver)"); }1105 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE htmldel (config.ver)"); } 1064 1106 1065 1107 $config = $ARGV[1]; 1066 system (" mkfringedel $config");1108 system ("$MKFRINGE del $config"); 1067 1109 print STDOUT "<meta http-equiv=refresh content=\"0; url=$CGI/fr.elixir1?&elconf=$elconf\">\n"; 1068 1110 … … 1073 1115 sub mk_htmldef { 1074 1116 1075 if (@ARGV != 2) { &escape ("USAGE: mkfringehtmldef (config.ver)"); }1117 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE htmldef (config.ver)"); } 1076 1118 1077 1119 $key = $ARGV[1]; … … 1137 1179 sub mk_htmlmod { 1138 1180 1139 if (@ARGV != 1) { &escape ("USAGE: mkfringehtmlmod"); }1181 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE htmlmod"); } 1140 1182 1141 1183 # images which are marked for exclusion are included in the … … 1217 1259 sub mk_htmlmodes { 1218 1260 1219 if (@ARGV != 1) { &escape ("USAGE: mkfringehtmlmodes"); }1261 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE htmlmodes"); } 1220 1262 1221 1263 # modes which are marked for exclusion are included in the … … 1271 1313 sub mk_htmlmaps { 1272 1314 1273 if (@ARGV != 1) { &escape ("USAGE: mkfringehtmlmaps"); }1315 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE htmlmaps"); } 1274 1316 1275 1317 # maps which are marked for inclusion are given in the … … 1321 1363 sub mk_htmlkeep { 1322 1364 1323 if (@ARGV != 2) { &escape ("USAGE: mkfringehtmlkeep (config.ver)"); }1365 if (@ARGV != 2) { &escape ("USAGE: $MKFRINGE htmlkeep (config.ver)"); } 1324 1366 1325 1367 $key = $ARGV[1]; … … 1372 1414 1373 1415 1374 if (@ARGV != 1) { &escape ("USAGE: mkfringehtml1"); }1416 if (@ARGV != 1) { &escape ("USAGE: $MKFRINGE html1"); } 1375 1417 1376 1418 @list = load_config (); … … 1414 1456 1415 1457 if (@ARGV != 2) { 1416 print STDERR "USAGE: mkfringehtml2 (config.ver)\n";1458 print STDERR "USAGE: $MKFRINGE html2 (config.ver)\n"; 1417 1459 &goodbye; 1418 1460 } … … 1489 1531 1490 1532 if (@ARGV != 3) { 1491 print STDERR "USAGE: mkfringehtml3 (entry.config.ver) (mode)\n";1533 print STDERR "USAGE: $MKFRINGE html3 (entry.config.ver) (mode)\n"; 1492 1534 &goodbye; 1493 1535 } … … 1557 1599 1558 1600 if (@ARGV != 2) { 1559 print STDERR "USAGE: mkfringedads (config.ver)\n";1601 print STDERR "USAGE: $MKFRINGE dads (config.ver)\n"; 1560 1602 &goodbye; 1561 1603 } … … 1680 1722 1681 1723 if (@ARGV != 1) { 1682 print STDERR "USAGE: mkfringedads.top\n";1724 print STDERR "USAGE: $MKFRINGE dads.top\n"; 1683 1725 &goodbye; 1684 1726 } … … 1921 1963 1922 1964 if (($mode ne "def") && ($mode ne "med")) { 1923 print STDOUT "error in mkfringemode\n";1965 print STDOUT "error in $MKFRINGE mode\n"; 1924 1966 &goodbye; 1925 1967 } … … 2069 2111 } 2070 2112 2071 print STDOUT "error: invalid mkfringecommand\n";2113 print STDOUT "error: invalid $MKFRINGE command\n"; 2072 2114 2073 2115 # run: $root/detrend.config - current run … … 2123 2165 last; 2124 2166 } 2167 if ($type eq "links") { 2168 $value = "$det/flips/links"; 2169 last; 2170 } 2125 2171 if ($type eq "html") { 2126 2172 $value = "$det/html"; … … 2172 2218 $dir = mkfiles ("fringe"); 2173 2219 $value = sprintf "$dir/$words[0].$words[1].$words[2].$words[3].master"; 2220 last; 2221 } 2222 # output link file for fhtool 2223 if ($type eq "link") { 2224 $dir = mkfiles ("links"); 2225 if ($ccd eq "") { &escape ("missing CCD for mknames link"); } 2226 $value = "$dir/$words[0].$words[1].$words[2].$ccd.$words[3].fits"; 2227 last; 2228 } 2229 # output mef file name 2230 if ($type eq "mef") { 2231 $dir = mkfiles ("fringe"); 2232 $value = "$dir/$words[0].$words[1].$words[2].$words[3].fits"; 2174 2233 last; 2175 2234 } … … 2538 2597 if ($?) { &escape ("error with elixir camera configuration"); } 2539 2598 2540 $answer = `cameraconfig -ccds`; 2541 @ccds = split (" ", $answer); 2599 @ccds = split (" ", `cameraconfig -ccdn`); 2542 2600 if ($?) { &escape ("error with elixir camera configuration"); } 2543 2601 … … 2589 2647 } 2590 2648 2591 if (@ARGV > 2) { print STDERR "USAGE: mkfringe(help) [mode]\n"; &goodbye; }2649 if (@ARGV > 2) { print STDERR "USAGE: $MKFRINGE (help) [mode]\n"; &goodbye; } 2592 2650 2593 2651 if ($ARGV[1] eq "config") {
Note:
See TracChangeset
for help on using the changeset viewer.
