Changeset 7790 for trunk/MagicSoft/Cosy/main
- Timestamp:
- 07/14/06 13:19:54 (18 years ago)
- Location:
- trunk/MagicSoft/Cosy/main
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/main/MCaos.cc
r4865 r7790 34 34 cout << " Reading " << name << ":" << endl; 35 35 cout << "------------------------------" << endl; 36 37 36 while (1) 38 37 { … … 336 335 leds.Clear(); 337 336 337 /* 338 //the following lines are just to test the new setup 339 static int i=0; 340 i++; 341 i%=2; 342 if (i==0) 343 ReadResources("leds0.txt"); 344 else 345 ReadResources("leds1.txt"); 346 cout << "LEDs " << i << " " << flush; 347 */ 348 338 349 // img width height radius sigma 339 350 FilterLed f(img, 768, 576, box, cut); … … 378 389 379 390 const Ring ¢er = rings.GetCenter(); 380 381 center.Print(); 391 392 //uncommented for testing 393 // center.Print(); 382 394 383 395 // FIXME! … … 423 435 } 424 436 437 /* 438 //test - give number of rings 439 cout << rings.GetEntries() << " " << flush; 440 */ 441 425 442 if (printl) 426 443 leds.Print(); -
trunk/MagicSoft/Cosy/main/MCosy.cc
r7788 r7790 1537 1537 1538 1538 // This is the full qualified date which is part of the name 1539 const TString clock = time.GetStringFmt("% y%m%d_%H%M%S");1539 const TString clock = time.GetStringFmt("%Y%m%d_%H%M%S"); 1540 1540 1541 1541 // This gives the night in which the date belongs to -
trunk/MagicSoft/Cosy/main/MStarguider.cc
r7788 r7790 13 13 #include <TSystem.h> 14 14 #include <TFile.h> // temp writeout of histos 15 #include <TSocket.h> 16 15 17 #include "MAstro.h" 16 18 #include "MString.h" … … 31 33 32 34 #include "MGStarg.h" 35 #include "MGNumStars.h" 33 36 #include "TGFrame.h" 34 37 … … 90 93 IDM_kPixSize, 91 94 IDM_kAngle, 95 IDM_kCut, 92 96 IDM_kInterpol250, 93 97 IDM_kInterpol125, … … 126 130 127 131 fGStarg->Update(fPos, fD); 132 fGNumStars->Update(fNumStarsDetected, fNumStarsCorrelated); 128 133 129 134 return kTRUE; … … 237 242 fLimMag->AddEntry("8", IDM_kLimMag8); 238 243 fLimMag->AddEntry("9", IDM_kLimMag9); 239 fLimMag->CheckEntry(IDM_kLimMag 8);244 fLimMag->CheckEntry(IDM_kLimMag9); 240 245 fLimMag->Associate(this); 241 246 fList->Add(fLimMag); 242 247 243 fSao->SetLimitMag( 7.0);248 fSao->SetLimitMag(9.0); 244 249 245 250 fInterpol = new MGPopupMenu(p); … … 305 310 fMenu->AddPopup("&WritePics", fWritePictures, NULL); 306 311 fMenu->AddPopup("&Setup", fSetup, NULL); 307 308 312 fMenu->AddPopup("&Operations", fOperations, NULL); 309 313 … … 327 331 328 332 fGStarg = new MGStarg(this, 235); 333 fGStarg->DrawText("0.75'", "1.50'", "3.00'", "Misspointing [min]"); 334 fGStarg->DrawHexagon(); 329 335 fGStarg->Move(530,596+5); 330 336 fList->Add(fGStarg); … … 335 341 fList->Add(fCRaDec); 336 342 337 fCZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);338 fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+5 81+20-4);343 fCZdAz = new MGCoordinates(this, kETypeZdAz, 2); 344 fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+597); 339 345 AddFrame(fCZdAz); 340 346 fList->Add(fCZdAz); 341 347 342 fPZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);343 fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+6 27+2*20-4);348 fPZdAz = new MGCoordinates(this, kETypeZdAz, 2); 349 fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+640); 344 350 AddFrame(fPZdAz); 345 351 fList->Add(fPZdAz); 346 352 347 fDZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);348 fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+6 73+3*20-4);353 fDZdAz = new MGCoordinates(this, kETypeZdAz, 2); 354 fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+683); 349 355 AddFrame(fDZdAz); 350 356 fList->Add(fDZdAz); 351 357 352 fSZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);353 fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+7 19+4*20-4);358 fSZdAz = new MGCoordinates(this, kETypeZdAz, 2); 359 fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+795); 354 360 AddFrame(fSZdAz); 355 361 fList->Add(fSZdAz); 356 362 363 fGNumStars = new MGNumStars(this, 235); 364 fGNumStars->DrawText("Number of stars"); 365 fGNumStars->Move(278, fMenu->GetDefaultHeight()+713); 366 fList->Add(fGNumStars); 367 357 368 fTPoint = new TGTextButton(this, "TPoint"); 358 fTPoint->Move(4, fMenu->GetDefaultHeight()+7 22+3*15+15);369 fTPoint->Move(4, fMenu->GetDefaultHeight()+785); 359 370 fTPoint->AllowStayDown(kTRUE); 360 371 AddFrame(fTPoint); … … 362 373 363 374 fStargTPoint = new TGTextButton(this, "StargTPoint"); 364 fStargTPoint->Move( 240+12+28, fMenu->GetDefaultHeight()+785);375 fStargTPoint->Move(170, fMenu->GetDefaultHeight()+785); 365 376 fStargTPoint->AllowStayDown(kTRUE); 366 377 AddFrame(fStargTPoint); … … 369 380 fFps = new TGLabel(this, "---fps"); 370 381 fFps->SetTextJustify(kTextRight); 371 fFps->Move(650-495, fMenu->GetDefaultHeight()+ 619+13+60+20+2);382 fFps->Move(650-495, fMenu->GetDefaultHeight()+714+23); 372 383 AddFrame(fFps); 373 384 fList->Add(fFps); … … 385 396 fList->Add(fSkyBright); 386 397 387 TGLabel *l = new TGLabel(this, " arcsec/pix");398 TGLabel *l = new TGLabel(this, "deg"); 388 399 l->SetTextJustify(kTextLeft); 389 l->Move(606-412, fMenu->GetDefaultHeight()+6 19+13+60);400 l->Move(606-412, fMenu->GetDefaultHeight()+669); 390 401 AddFrame(l); 391 402 fList->Add(l); 392 403 393 l = new TGLabel(this, " deg");404 l = new TGLabel(this, "arcsec/pix"); 394 405 l->SetTextJustify(kTextLeft); 395 l->Move(606-412, fMenu->GetDefaultHeight()+6 19-10+60);406 l->Move(606-412, fMenu->GetDefaultHeight()+692); 396 407 AddFrame(l); 397 408 fList->Add(l); 398 409 399 l = new TGLabel(this, "Telescope pointing at"); 410 l = new TGLabel(this, "sigma"); 411 l->SetTextJustify(kTextLeft); 412 l->Move(606-412, fMenu->GetDefaultHeight()+715); 413 AddFrame(l); 414 fList->Add(l); 415 416 l = new TGLabel(this, "Zd/Az telescope pointing at"); 400 417 l->SetTextJustify(kTextLeft); 401 418 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+584-5); … … 403 420 fList->Add(l); 404 421 405 l = new TGLabel(this, " Starguider position");422 l = new TGLabel(this, "Zd/Az starguider pointing at"); 406 423 l->SetTextJustify(kTextLeft); 407 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+630+20-5 );424 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+630+20-5-23); 408 425 AddFrame(l); 409 426 fList->Add(l); 410 427 411 l = new TGLabel(this, " Misspointing");428 l = new TGLabel(this, "Zd/Az misspointing"); 412 429 l->SetTextJustify(kTextLeft); 413 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+676+2*20-5 );430 l->Move(240+12+20+7, fMenu->GetDefaultHeight()+676+2*20-5-46); 414 431 AddFrame(l); 415 432 fList->Add(l); … … 422 439 fList->Add(l); 423 440 #endif 441 442 // Set input box for rotation angle 443 const Double_t angle = -0.4; 444 fSao->SetRotationAngle(angle); 424 445 446 TString txt; 447 txt += angle; 448 449 fAngle = new TGTextEntry(this, txt, IDM_kAngle); 450 fAngle->SetAlignment(kTextCenterX); 451 fAngle->Move(547-410, fMenu->GetDefaultHeight()+667); 452 AddFrame(fAngle); 453 fList->Add(fAngle); 454 455 // Set input box for pixel size 425 456 const Double_t pixsize = 48.8; // used to be 23.4 426 457 … … 428 459 fSao->SetRotationAngle(0); 429 460 430 TString txt;461 txt = ""; 431 462 txt += pixsize; 432 463 433 464 fPixSize = new TGTextEntry(this, txt, IDM_kPixSize); 434 465 fPixSize->SetAlignment(kTextCenterX); 435 fPixSize->Move(547-410, fMenu->GetDefaultHeight()+6 17+13+60);466 fPixSize->Move(547-410, fMenu->GetDefaultHeight()+690); 436 467 AddFrame(fPixSize); 437 468 fList->Add(fPixSize); 438 469 439 const Double_t angle = -0.4;440 fSao->SetRotationAngle(angle);470 // Set input box for cleaning cut 471 const Double_t cut = 3.0; 441 472 442 473 txt = ""; 443 txt += angle;444 445 f Angle = new TGTextEntry(this, txt, IDM_kAngle);446 f Angle->SetAlignment(kTextCenterX);447 f Angle->Move(547-410, fMenu->GetDefaultHeight()+617-10+60);448 AddFrame(f Angle);449 fList->Add(f Angle);474 txt += cut; 475 476 fCut = new TGTextEntry(this, txt, IDM_kCut); 477 fCut->SetAlignment(kTextCenterX); 478 fCut->Move(547-410, fMenu->GetDefaultHeight()+713); 479 AddFrame(fCut); 480 fList->Add(fCut); 450 481 451 482 // TGHorizontal3DLine *fLineSep = new TGHorizontal3DLine(this); … … 467 498 fList->Add(fImage); 468 499 500 const Int_t w = 768; 501 const Int_t h = 840; 502 SetWMSizeHints(w, h, w, h, 1, 1); // set the smallest and biggest size of the Main frame 503 469 504 // 470 505 // Make everything visible … … 477 512 fStargTPoint->UnmapWindow(); 478 513 fGStarg->UnmapWindow(); 514 fGNumStars->UnmapWindow(); 479 515 fPZdAz->UnmapWindow(); 480 516 fDZdAz->UnmapWindow(); … … 503 539 fStatus(MDriveCom::kStandby) 504 540 { 505 506 541 cout << " #### FIXME: Make MCaos Thread safe!" << endl; 542 543 fAmcSocket = new TSocket("amc", 7307); 507 544 508 545 fSao = new StarCatalog(obs); … … 573 610 delete fOutRq; 574 611 612 delete fAmcSocket; 613 575 614 cout << "Camera Display destroyed." << endl; 615 } 616 617 bool MStarguider::SendAmcTrigger(const char *msg) 618 { 619 if (!fAmcSocket->IsValid()) 620 return false; 621 622 TString txt("TRIGGER "); 623 txt += msg; 624 625 const Int_t len = fAmcSocket->SendRaw(txt.Data(), txt.Length()); 626 if (len<0) 627 { 628 cout << "ERROR - Sending Trigger to Amc" << endl; 629 return false; 630 } 631 if (len!=txt.Length()) 632 { 633 cout << "Send wrong number (" << len << ") of Bytes to Amc." << endl; 634 return false; 635 } 636 637 return true; 576 638 } 577 639 … … 648 710 fDisplay->CheckEntry(IDM_kCatalog); 649 711 fGStarg->MapWindow(); 712 fGNumStars->MapWindow(); 650 713 651 714 const Int_t ch0 = … … 682 745 fSkyBright->UnmapWindow(); 683 746 fGStarg->UnmapWindow(); 747 fGNumStars->UnmapWindow(); 684 748 685 749 fChannel->EnableEntry(IDM_kChannel2); … … 730 794 fStargTPoint->UnmapWindow(); 731 795 fGStarg->UnmapWindow(); 796 fGNumStars->UnmapWindow(); 732 797 fPZdAz->UnmapWindow(); 733 798 fDZdAz->UnmapWindow(); … … 757 822 cout << "Rotation Angle changed to " << angle << "deg" << endl; 758 823 fSao->SetRotationAngle(angle); 824 return kTRUE; 825 } 826 case IDM_kCut: 827 { 828 const Float_t cut = atof(fCut->GetText()); 829 cout << "Starguider cleaning level changed to " << cut << " sigma." << endl; 759 830 return kTRUE; 760 831 } … … 1292 1363 ZdAz &d, MTime &t, double &bright, Int_t &num) 1293 1364 { 1294 const Int_t max = leds.GetEntries(); 1365 num = leds.GetEntries(); 1366 if (num < 3) //was 1 1367 { 1368 cout << "Sorry, less than 3 detected spot in FOV!" << endl; 1369 if (fStargTPoint->IsDown()) 1370 fStargTPoint->SetDown(kFALSE); 1371 return 0; 1372 } 1373 1295 1374 if (stars.GetRealEntries() < 3) 1296 1375 { … … 1300 1379 return 0; 1301 1380 } 1302 if (max < 3) //was 11303 {1304 cout << "Sorry, less than 3 detected spot in FOV!" << endl;1305 if (fStargTPoint->IsDown())1306 fStargTPoint->SetDown(kFALSE);1307 return 0;1308 }1309 1381 1310 1382 stars.Sort(); // Sort by magnitude … … 1320 1392 TArrayF x, y, mag; 1321 1393 1322 num = 0;1323 1324 1394 // FIXME: Is predefined value 3 a good idea? 1325 1395 1326 1396 MStar *star; 1327 1397 MStarListIter NextStar(&stars); 1328 while ((star=NextStar()) && num++<max+3)1398 while ((star=NextStar())) 1329 1399 { 1330 1400 TIter NextSp(&leds); … … 1441 1511 *fOutStargTp << " " << d.Zd() << " " << d.Az(); 1442 1512 *fOutStargTp << " " << setprecision(11) << t.GetMjd(); 1443 *fOutStargTp << " " << max;1513 *fOutStargTp << " " << num; 1444 1514 *fOutStargTp << " " << bright; 1445 1515 *fOutStargTp << endl; … … 1536 1606 #endif 1537 1607 1538 // Convert from Pixel to millimeter (1pix=2.9mm) 1608 // MAKE SURE THAT THIS VALUE CAN BE SETUP 1609 // (Scalefactor describes the difference between the tpoint (=1) 1610 // and the starguider (!=1) camera 1611 // Convert from Pixel to millimeter (1pix=2.6mm) 1539 1612 x *= (2.58427 * scalefactor); 1540 1613 y *= (2.58427 * scalefactor); … … 1544 1617 y /= 1.0713; 1545 1618 1546 // C alculate Offset1619 // Convert offset from camera plane into local ccordinates 1547 1620 Double_t dzd, daz; 1548 1621 ac.GetDiffZdAz(x, y, dzd, daz); … … 1719 1792 // Find Star at Center---for Tpoint Procedure 1720 1793 if (fDisplay->IsEntryChecked(IDM_kFindStar)) 1794 { 1795 // SCALE FACTOR ASSUMED TO BE 70 1721 1796 FindStar(f, f2, center, t, 3.5, 70); 1797 SendAmcTrigger("TPoint"); 1798 } 1722 1799 1723 1800 byte zimg[kZOOM*kZOOM]; … … 1751 1828 pos = fCosy->GetPointingPos(); 1752 1829 1753 sgcenter = fStargCaos->Run(img, kFALSE, kFALSE, pos, t, 30, 3.0); // [px]1830 sgcenter = fStargCaos->Run(img, kFALSE, kFALSE, pos, t, 19, 3.0); // [px] 1754 1831 1755 1832 //const Float_t pixsize = atof(fPixSize->GetText()); // [arcsec/px] … … 1775 1852 #endif 1776 1853 fSZdAz->SetCoordinates(star); // Misspointing found from Camera 1854 1855 SendAmcTrigger("Starguider"); 1777 1856 } 1778 1857 } … … 1891 1970 1892 1971 // Next we evaluate the offset given by the LEDs. This we obtain 1893 1972 // in Zd/Az and add it to the tracking error. 1894 1973 if (fDisplay->IsEntryChecked(IDM_kStarguider)) 1895 1974 { 1975 const Float_t cut = atof(fCut->GetText()); 1976 1896 1977 Leds spots; 1897 1978 f.SetBox(230); 1898 f.SetCut( 2.5);1979 f.SetCut(cut); 1899 1980 1900 1981 double bright; 1901 1982 f.ExecuteAndMark(spots, 530, 292, bright); 1902 1983 1903 MString txt;1904 txt.Print("Sky Brightness: %.1f", bright);1905 fSkyBright->SetText(txt);1906 1907 const Bool_t brightnessisvalid = bright<1.75*fLastBright &&1908 bright>30 && bright<110;1909 1910 fLastBright = bright;1911 1912 1984 ULong_t color; 1913 gClient->GetColorByName("Green", color); 1985 gClient->GetColorByName("Green", color); 1914 1986 if (bright> 60) 1915 1987 gClient->GetColorByName("Yellow", color); … … 1920 1992 fSkyBright->SetBackgroundColor(color); 1921 1993 1994 MString txt; 1995 txt.Print("Sky Brightness: %.1f", bright); 1996 fSkyBright->SetText(txt); 1997 1998 const Bool_t brightnessisvalid = bright<1.75*fLastBright && 1999 bright>30 && bright<110; 2000 2001 fLastBright = bright; 2002 1922 2003 Int_t numstars = 0; 1923 2004 const Int_t rc = CalcTrackingError(spots, stars, fD, t, bright, numstars); … … 1934 2015 fSao->GetZdAz(), sgcenter, /*sgcenterzdaz,*/ 1935 2016 star, bright, fPos, t); 2017 2018 fNumStarsDetected = numstars; 2019 fNumStarsCorrelated = rc; 1936 2020 1937 2021 if (fCosy) … … 1945 2029 } //kStarguider 1946 2030 1947 if (centerisvalid )2031 if (centerisvalid && fNumStarsCorrelated>2) 1948 2032 { 1949 f2.DrawCircle(skycenter, 2.0, 0x0a); 1950 1951 f2.DrawCircle(skycenter, 7.4, 0x0a); //0.1deg 1952 1953 f2.DrawCircle(skycenter, 2.06*.5*74.0, 0x0a); 1954 f2.DrawCircle(skycenter, 2.32*.5*74.0, 0x0a); 1955 f2.DrawCircle(skycenter, 3.50*.5*74.0, 0x0a); 1956 f2.DrawCircle(skycenter, 3.84*.5*74.0, 0x0a); 2033 f2.DrawCircle(skycenter, 2.0, 0x0a); 2034 2035 const Double_t ap = fSao->GetPixSize()/3600; //[deg/pix] 2036 2037 f2.DrawCircle(skycenter, 0.10/ap, 0x0a); //0.1deg 2038 f2.DrawHexagon(skycenter, 2.06/ap, 0x0a); 2039 f2.DrawHexagon(skycenter, 3.50/ap, 0x0a); 2040 2041 /* 2042 f2.DrawCircle(skycenter, 2.06*.5*74.0, 0x0a); 2043 f2.DrawCircle(skycenter, 2.32*.5*74.0, 0x0a); 2044 f2.DrawCircle(skycenter, 3.50*.5*74.0, 0x0a); 2045 f2.DrawCircle(skycenter, 3.84*.5*74.0, 0x0a); 2046 */ 1957 2047 } 1958 2048 -
trunk/MagicSoft/Cosy/main/MStarguider.h
r7785 r7790 20 20 class TGButton; 21 21 class TString; 22 class TSocket; 22 23 23 24 class TTimer; … … 38 39 // class MStargLeds; 39 40 class MStargHistograms; 41 class MGNumStars; 40 42 class MGStarg; 41 43 class FilterLed; … … 56 58 57 59 MGStarg *fGStarg; 60 MGNumStars *fGNumStars; 58 61 59 62 MGPopupMenu *fDisplay; … … 84 87 TGTextEntry *fPixSize; 85 88 TGTextEntry *fAngle; 89 TGTextEntry *fCut; 86 90 87 91 TGLabel *fFps; … … 95 99 ZdAz fD; 96 100 AltAz fAltAzOffsetFromTp; 97 101 102 Double_t fNumStarsDetected; 103 Double_t fNumStarsCorrelated; 104 98 105 StarCatalog *fSao; 99 106 MCosy *fCosy; 100 107 MCaos *fCaos; 101 108 MCaos *fStargCaos; 102 // MStargLeds *fStargLeds;109 TSocket *fAmcSocket; 103 110 MStargHistograms *fStargHistograms; 104 111 … … 145 152 void InitGui(Int_t channel); 146 153 154 bool SendAmcTrigger(const char *msg); 155 147 156 //void OpenFile(); 148 157
Note:
See TracChangeset
for help on using the changeset viewer.