Changeset 7790 for trunk/MagicSoft/Cosy
- Timestamp:
- 07/14/06 13:19:54 (18 years ago)
- Location:
- trunk/MagicSoft/Cosy
- Files:
-
- 2 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/Changelog
r7788 r7790 1 1 -*-*- END -*-*- 2 2006/07/14 Thomas Bretz (La Palma) 3 4 * stargleds.txt: 5 - changed positions slightly 6 7 * gui/GuiLinkDef.h, gui/Makefile: 8 - added MGNumStars 9 10 * gui/MGStars.[h,cc]: 11 - addde 12 13 * gui/MGAccuracy.[h,cc], gui/MGStarg.[h,cc]: 14 - unified 15 - slight changes to layout 16 17 * gui/MGCoordinate.[h,cc], MGCoordinated.[h,cc]: 18 - added a new mode which allows to suppress the title 19 20 * gui/MGCosy.[h,cc]: 21 - added new status box (armed) currently switched on by default 22 - adapted to changes in MGAccuracy 23 - disallow changing the size of the window 24 25 * main/MCaos.cc: 26 - removed an obsolete Print() 27 28 * main/MCosy.cc: 29 - fixed the name of the log-files (2006 instead of 06) 30 31 * main/MStarguider.[h,cc]: 32 - implemented new socket to send triggers to Amc (port 7307) 33 - changed standard limiting magnitude from 7.0 to 9.0 34 - changed layout of display to implement new canvas 35 displaying the number of detected and correlated stars 36 - adapted to changes in MGStarg 37 - added box to change cleaning level of starguider window 38 - set default rotation angle to -0.4deg 39 - disallow changing of window size 40 - CalcTrackingError: check first the number of detected spots 41 and afterwards the number of found catalog stars 42 - CalcTrackingError: just try to correlate all spots with all stars 43 - decreased box size of LED box in starguider mode 44 - replaced circles around starguider pointing position by 45 camara size hexagons 46 - do not show the starguider pointing position if less than three 47 stars could be correlated 48 49 * tcpip/MTcpIpIO.cc: 50 - fixed a comparison between "signed and unsigned" 51 52 * videodev/FilterLed.[h,cc]: 53 - implemented DrawHexagon based on MGMap::DrawHexagon 54 - renamed *Circle to *Box 55 - replaced old algorithm to find stars in starguider mode (and 56 LEDs) by a new ClusterFinder class 57 - needs more maintanance! 58 59 60 2 61 2006/07/11 Thomas Bretz (La Palma) 3 62 -
trunk/MagicSoft/Cosy/gui/GuiLinkDef.h
r4865 r7790 15 15 #pragma link C++ class MGSkyPosition+; 16 16 #pragma link C++ class MGStarg+; 17 #pragma link C++ class MGNumStars+; 17 18 18 19 #pragma link C++ class MGCosy+; -
trunk/MagicSoft/Cosy/gui/MGAccuracy.cc
r7788 r7790 1 //2 // This File contains the definition of the MGCoordinates-class3 //4 // Author: Thomas Bretz5 // Version: V1.0 (1-8-2000)6 7 1 #include "MGAccuracy.h" 8 2 … … 13 7 #include <TText.h> 14 8 #include <TWbox.h> 15 #include <TList.h>16 9 #include <TGaxis.h> 17 10 #include <TGraph.h> … … 24 17 ClassImp(MGAccuracy); 25 18 26 void MGAccuracy::Draw CoordinateSystem()27 { 28 TWbox box;29 box.DrawWbox(-145*2, 145*2, -15*2, 120*2, 18, 2, 1);19 void MGAccuracy::DrawText(const char *c1, const char *c2, const char *c3, const char*txt) 20 { 21 fCanvas->SetEditable(kTRUE); 22 fCanvas->cd(); 30 23 31 24 TText text; 32 25 text.SetTextAlign(22); // centered, centered (s.TAttText) 33 text.DrawText(-80*2, 132.5*2, "Ctrl Deviation [min]"); 34 26 text.DrawText(-150, 265, txt); 27 28 text.SetTextAlign(11); // left, bottom (s.TAttText) 29 text.SetTextColor(3); 30 text.DrawText(220, -220, c1); 31 32 text.SetTextColor(5); 33 text.DrawText(220, -250, c2); 34 35 text.SetTextColor(2); 36 text.DrawText(220, -280, c3); 37 38 fCanvas->SetEditable(kFALSE); 39 } 40 41 void MGAccuracy::DrawCircles(Double_t rad) 42 { 43 fCanvas->SetEditable(kTRUE); 44 fCanvas->cd(); 35 45 36 46 TArc arc; … … 39 49 arc.SetLineColor(3); // green 40 50 arc.SetLineStyle(2); // dashed (s. TAttLine) 41 arc.DrawArc(0, 0, 79.1/2.);// 0.5se51 arc.DrawArc(0, 0, rad/2.); // 0.5se 42 52 43 53 arc.SetLineColor(5); // yellow 44 arc.DrawArc(0, 0, 79.1); // 1.0se54 arc.DrawArc(0, 0, rad); // 1.0se 45 55 46 56 arc.SetLineColor(2); // red 47 arc.DrawArc(0, 0, 79.1*2.); // 2.0se 48 49 50 text.SetTextAlign(11); // left, bottom (s.TAttText) 51 text.SetTextColor(3); 52 text.DrawText(220, -220, "0.5se"); 53 54 text.SetTextColor(5); 55 text.DrawText(220, -250, "1.0se"); 56 57 text.SetTextColor(2); 58 text.DrawText(220, -280, "2.0se"); 59 60 61 TLine line; 62 line.DrawLine(-65*4, 0, 65*4, 0); 63 line.DrawLine( 0, -65*4, 0, 65*4); 57 arc.DrawArc(0, 0, rad*2.); // 2.0se 58 59 fCanvas->SetEditable(kFALSE); 60 } 61 62 void MGAccuracy::DrawCoordinateSystem() 63 { 64 TWbox box; 65 box.DrawWbox(-290, 290, -10, 240, 18, 2, 1); 66 67 // TLine line; 68 // line.DrawLine(-65*4, 0, 65*4, 0); 69 // line.DrawLine( 0, -65*4, 0, 65*4); 64 70 65 71 // … … 122 128 123 129 MGAccuracy::MGAccuracy(const TGWindow* p, const UInt_t w) 124 : MGEmbeddedCanvas("Accuracy", p, w, 300) 130 : MGEmbeddedCanvas("Accuracy", p, w, 300), fColorScale(360*60/16384) 125 131 { 126 132 // FIXME: Overload MapWindow in newer Root versions to remove … … 133 139 fGraph->Draw("LP"); 134 140 fList->Add(fGraph); 135 //fGraph->SetNameTitle("AccVsT", "Accuracy vs Min of Time");136 //fGraph->Draw("APL");137 //fGraph->SetMarkerSize(2);138 141 139 142 DrawCoordinateSystem(); … … 153 156 MGAccuracy::~MGAccuracy() 154 157 { 155 // cout << "MGAccuracy destroyed." << endl;156 158 } 157 159 … … 172 174 173 175 fBar->SetY2(dist*60); // [sec] 174 if (dist *16384<1*360*60)176 if (dist<fColorScale) //1*360*60/16384 175 177 fBar->SetLineColor(kGreen); 176 178 else 177 if (dist *16384<2*360*60)179 if (dist<2*fColorScale) //2*360*60/16384 178 180 fBar->SetLineColor(kYellow); 179 181 else … … 227 229 228 230 SetModified(); 229 230 //cout << "N1 == " << fGraph->GetN() << endl;231 232 //fGraph->GetHistogram()->SetXTitle("Time");233 //fGraph->GetHistogram()->SetYTitle("\\Delta [arcmin]");234 //fGraph->GetHistogram()->GetXaxis()->SetTimeFormat("%M %F1995-01-01 00:00:00");235 //fGraph->GetHistogram()->GetXaxis()->SetTimeDisplay(1);236 //fGraph->GetHistogram()->GetXaxis()->SetLabelSize(0.033);237 231 } 238 232 … … 248 242 { 249 243 // 250 // calculate actual time for planet positions251 // acc [deg]252 //253 244 // x["], y["] 254 245 // -
trunk/MagicSoft/Cosy/gui/MGAccuracy.h
r4076 r7790 1 #ifndef MGACCURACY_H2 #define MGACCURACY_H1 #ifndef COSY_MGAccuracy 2 #define COSY_MGAccuracy 3 3 4 4 // … … 20 20 class MGAccuracy : public MGEmbeddedCanvas 21 21 { 22 protected: 22 23 TLine *fLin1; 23 24 TLine *fLin2; … … 30 31 31 32 Double_t fTime; 33 Double_t fColorScale; 32 34 33 35 void DrawCoordinateSystem(); … … 46 48 ~MGAccuracy(); 47 49 50 void DrawText(const char *c1, const char *c2, const char *c3, const char *txt); 51 void DrawCircles(Double_t rad=79.1); 52 53 void SetColorScale(Double_t scale=1) { fColorScale=scale; } 54 48 55 void Update(ZdAz &pos, ZdAz &acc); 49 56 … … 51 58 }; 52 59 53 #endif // MGSKYPOSITION_H60 #endif // COSY_MGAccuracy -
trunk/MagicSoft/Cosy/gui/MGCoordinate.cc
r7787 r7790 26 26 27 27 MGCoordinate::MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg, 28 const Bool_t flag, const char *txt,28 const Int_t flag, const char *txt, 29 29 const Int_t deg, const UInt_t min, const UInt_t sec) 30 : TGFrame(p, 119, flag ?76:46, kSunkenFrame|kFixedSize), fSign('+'), fDeg(deg), fMin(min), fSec(sec)30 : TGFrame(p, 119, flag==1?76:46-(TString(txt).IsNull()?23:0), kSunkenFrame|kFixedSize), fSign('+'), fDeg(deg), fMin(min), fSec(sec), fLabel(0) 31 31 { 32 32 fList = new MGList; 33 33 34 const Int_t offset = TString(txt).IsNull() ? 23 : 0; 35 34 36 // p = pointer to MainFrame (not owner) 35 if (flag )37 if (flag==1) 36 38 { 37 39 fTextEntryDeg = new TGTextEntry(this, "****", IDM_kDeg); … … 41 43 // fTextEntryMin->SetAlignment(kTextCenterX); 42 44 // fTextEntrySec->SetAlignment(kTextCenterX); 43 fTextEntryDeg->Move( 7, 26 );44 fTextEntryMin->Move(47, 26 );45 fTextEntrySec->Move(81, 26 );45 fTextEntryDeg->Move( 7, 26-offset); 46 fTextEntryMin->Move(47, 26-offset); 47 fTextEntrySec->Move(81, 26-offset); 46 48 fTextEntryDeg->MapWindow(); 47 49 fTextEntryMin->MapWindow(); … … 56 58 } 57 59 58 const int ypos = flag?56:26;60 const int ypos = (flag==1?56:26)-offset; 59 61 60 62 fLabelDeg = new TGLabel(this, "****"); … … 78 80 Set(fLabelSec, fSec); 79 81 80 fLabel = new TGLabel(this, txt); 81 fLabel->SetTextJustify(kTextLeft); 82 fLabel->Move(4, 4); 83 fLabel->MapWindow(); 84 fList->Add(fLabel); 82 if (!TString(txt).IsNull()) 83 { 84 fLabel = new TGLabel(this, txt); 85 fLabel->SetTextJustify(kTextLeft); 86 fLabel->Move(4, 4); 87 fLabel->MapWindow(); 88 fList->Add(fLabel); 89 } 85 90 86 91 TGLabel *label; … … 90 95 const char *sec = type==kETypeDeg ? "\"" : "s"; 91 96 92 if (flag )97 if (flag==1) 93 98 { 94 99 label = new TGLabel(this, deg); 95 100 label->SetTextJustify(kTextLeft); 96 label->Move(37, 29 );101 label->Move(37, 29-offset); 97 102 label->MapWindow(); 98 103 fList->Add(label); … … 100 105 label = new TGLabel(this, min); 101 106 label->SetTextJustify(kTextLeft); 102 label->Move(71, 29 );107 label->Move(71, 29-offset); 103 108 label->MapWindow(); 104 109 fList->Add(label); … … 106 111 label = new TGLabel(this, sec); 107 112 label->SetTextJustify(kTextLeft); 108 label->Move(107, 29 );113 label->Move(107, 29-offset); 109 114 label->MapWindow(); 110 115 fList->Add(label); … … 146 151 void MGCoordinate::Print() 147 152 { 148 cout << fLabel->GetText()->GetString() << " " << fSign << fDeg << "\xb0 " << fMin << "' " << fSec << "\"" << endl; 153 if (fLabel) 154 cout << fLabel->GetText()->GetString() << " "; 155 cout << fSign << fDeg << "\xb0 " << fMin << "' " << fSec << "\"" << endl; 149 156 } 150 157 -
trunk/MagicSoft/Cosy/gui/MGCoordinate.h
r1531 r7790 1 #ifndef MGCOORDINATE_H2 #define MGCOORDINATE_H1 #ifndef COSY_MGCoordinate 2 #define COSY_MGCoordinate 3 3 4 4 // … … 49 49 public: 50 50 MGCoordinate(const TGWindow* p, const Int_t type=kETypeDeg, 51 const Bool_t flag=kTRUE, const char *txt="Coordinates:",51 const Int_t flag=1, const char *txt="Coordinates:", 52 52 const Int_t deg=0, const UInt_t min=0, const UInt_t sec=0); 53 53 ~MGCoordinate(); … … 63 63 }; 64 64 65 #endif // MGIMAGE_H65 #endif // COSY_MGCoordinates -
trunk/MagicSoft/Cosy/gui/MGCoordinates.cc
r1111 r7790 16 16 MGCoordinates::MGCoordinates(const TGWindow* p, 17 17 const Int_t type, 18 const Bool_t flag,18 const Int_t flag, 19 19 const Int_t deg1, const UInt_t min1, const UInt_t sec1, 20 20 const Int_t deg2, const UInt_t min2, const UInt_t sec2) … … 23 23 const Int_t t = type==kETypeZdAz ? kETypeDeg : kETypeH; 24 24 const char *txt1 = type==kETypeZdAz ? "Zenith Dist [\xb0]:" : "Right Ascension [h]:"; 25 const char *txt2 = type==kETypeZdAz ? "Azimuth [\xb0]:" : "Declination [\xb0]:";25 const char *txt2 = type==kETypeZdAz ? "Azimuth [\xb0]:" : "Declination [\xb0]:"; 26 26 27 27 // p = pointer to MainFrame (not owner) 28 fX = new MGCoordinate(this, t, flag, txt1, deg1, min1, sec1);28 fX = new MGCoordinate(this, t, flag, flag>1?"":txt1, deg1, min1, sec1); 29 29 fX->Move(0, 0); 30 30 31 fY = new MGCoordinate(this, kETypeDeg, flag, txt2, deg2, min2, sec2);31 fY = new MGCoordinate(this, kETypeDeg, flag, flag>1?"":txt2, deg2, min2, sec2); 32 32 fY->Move(125, 0); 33 33 -
trunk/MagicSoft/Cosy/gui/MGCoordinates.h
r1111 r7790 1 #ifndef MGCOORDINATES_H2 #define MGCOORDINATES_H1 #ifndef COSY_MGCoordinates 2 #define COSY_MGCoordinates 3 3 4 4 // … … 15 15 16 16 enum { 17 kETypeZdAz, 18 kETypeRaDec 17 kETypeZdAz = BIT(0), 18 kETypeRaDec= BIT(1), 19 kETypeNone = BIT(3) 19 20 }; 20 21 … … 28 29 public: 29 30 MGCoordinates(const TGWindow* p, const Int_t type=kETypeZdAz, 30 const Bool_t flag=kTRUE,31 const Int_t flag=1, 31 32 const Int_t deg1=0, const UInt_t min1=0, const UInt_t sec1=0, 32 33 const Int_t deg2=0, const UInt_t min2=0, const UInt_t sec2=0); … … 41 42 }; 42 43 43 #endif // MGIMAGE_H44 #endif // COSY_MGCoordinates -
trunk/MagicSoft/Cosy/gui/MGCosy.cc
r4104 r7790 247 247 fList->Add(fAzSoll); 248 248 249 fArmed = new TGLabel(f, "Armed"); 249 250 fError = new TGLabel(f, "Error"); 250 251 fMoving = new TGLabel(f, "Moving"); … … 261 262 ULong_t color; 262 263 264 gClient->GetColorByName("Magenta", color); 265 fArmed->SetBackgroundColor(color); 263 266 gClient->GetColorByName("Red", color); 264 267 fError->SetBackgroundColor(color); … … 278 281 fStopped->SetBackgroundColor(color); 279 282 280 fError ->MoveResize(10, 25, 60, 20); 281 fMoving ->MoveResize(10, 25+20, 60, 20); 282 fTracking->MoveResize(10, 25+40, 60, 20); 283 fStopping->MoveResize(10, 25+60, 60, 20); 284 fStopped ->MoveResize(10, 25+80, 60, 20); 285 fAvailMac1->MoveResize(10, 25+120, 60, 20); 286 fAvailMac2->MoveResize(10, 25+140, 60, 20); 283 fArmed ->MoveResize(10, 25, 60, 20); 284 fError ->MoveResize(10, 25+25, 60, 20); 285 fMoving ->MoveResize(10, 25+25+20, 60, 20); 286 fTracking->MoveResize(10, 25+25+40, 60, 20); 287 fStopping->MoveResize(10, 25+25+60, 60, 20); 288 fStopped ->MoveResize(10, 25+25+80, 60, 20); 289 fAvailMac1->MoveResize(10, 25+25+120, 60, 20); 290 fAvailMac2->MoveResize(10, 25+25+140, 60, 20); 287 291 //fAvailMac3->Move(10, 25+160); 288 fAvailSe1->MoveResize(10, 25+200, 60, 20); 289 fAvailSe2->MoveResize(10, 25+220, 60, 20); 290 fAvailSe3->MoveResize(10, 25+180, 60, 20); 291 292 fAvailSe1->MoveResize(10, 25+25+200, 60, 20); 293 fAvailSe2->MoveResize(10, 25+25+220, 60, 20); 294 fAvailSe3->MoveResize(10, 25+25+180, 60, 20); 295 296 fList->Add(fArmed); 292 297 fList->Add(fError); 293 298 fList->Add(fMoving); … … 737 742 #endif 738 743 fAccuracy = new MGAccuracy(f1, 300); 744 fAccuracy->DrawText("0.5se", "1.0se", "2.0se", "Ctrl Deviation [min]"); 745 fAccuracy->DrawCircles(); 739 746 #ifdef DEBUG 740 747 cout << "MGCosy: Creating MGVelocity" << endl; … … 822 829 const Int_t w = 1010; 823 830 const Int_t h = 700; 824 SetWMSizeHints(w, h, 1280, 900, 10, 10); // set the smallest and biggest size of the Main frame831 SetWMSizeHints(w, h, w, h, 1, 1); // set the smallest and biggest size of the Main frame 825 832 826 833 SetWindowName("Cosy Main Window"); … … 1068 1075 SetLabelColor(fAvailSe2, stat2&0x10); 1069 1076 SetLabelColor(fAvailSe3, stat2&0x20); 1077 1078 EnableLabel(fArmed, 1);//stat2&0x40); 1070 1079 1071 1080 if (stat&MDriveCom::kTracking) -
trunk/MagicSoft/Cosy/gui/MGCosy.h
r4104 r7790 88 88 TGTab *fTab; 89 89 90 TGLabel *fArmed; 90 91 TGLabel *fError; 91 92 TGLabel *fMoving; -
trunk/MagicSoft/Cosy/gui/MGStarg.cc
r7788 r7790 1 1 #include "MGStarg.h" 2 2 3 #include <iostream.h> // cout4 5 #include <TArc.h>6 #include <TLine.h>7 #include <TText.h>8 #include <TWbox.h>9 #include <TList.h>10 #include <TGaxis.h>11 #include <TGraph.h>12 3 #include <TCanvas.h> 13 4 14 5 #include <MHexagon.h> 15 6 16 #include "coord.h"17 #include "MTime.h"18 #include "MAstro.h"19 20 7 ClassImp(MGStarg); 21 8 22 void MGStarg::Draw CoordinateSystem()9 void MGStarg::DrawHexagon() 23 10 { 24 TWbox box; 25 box.DrawWbox(-145*2, 145*2, -15*2, 120*2, 18, 2, 1); 26 27 TText text; 28 text.SetTextAlign(22); // centered, centered (s.TAttText) 29 text.DrawText(-80*2, 132.5*2, "Misspointing [min]"); 11 fCanvas->SetEditable(kTRUE); 12 fCanvas->cd(); 30 13 31 14 MHexagon hex; 32 hex.SetFillColor(39);33 15 hex.SetFillStyle(4000); 34 16 hex.SetLineColor(17); 35 hex.DrawHexagon(0, 0,177.5*2);17 hex.DrawHexagon(0, 0, 177.5*2); 36 18 37 text.SetTextAlign(11); // left, bottom (s.TAttText) 38 text.SetTextColor(3); 39 text.DrawText(220, -220, "0.75'"); 40 41 text.SetTextColor(5); 42 text.DrawText(220, -250, "1.50'"); 43 44 text.SetTextColor(2); 45 text.DrawText(220, -280, "3.00'"); 46 47 48 TLine line; 49 line.DrawLine(-65*4, 0, 65*4, 0); 50 line.DrawLine( 0, -65*4, 0, 65*4); 51 52 // 53 // Can be replaced by TGaxis axe; in a later root version 54 // than 3.01/06. I talked to Rene 55 // 56 TGaxis *axe; 57 axe = new TGaxis(-60*4, 0, 60*4, 0, -4, 4, 30204, "+-N"); 58 axe->SetTitle("Az"); // \xb0 59 axe->SetBit(kCanDelete); 60 axe->Draw(); 61 62 axe = new TGaxis( 0, -60*4, 0, 60*4, -4, 4, 304, "+-N"); 63 axe->SetTitle("Zd"); // \xb0 64 axe->SetLabelOffset(-0.02); 65 axe->SetBit(kCanDelete); 66 axe->Draw(); 67 } 68 69 void MGStarg::InitText() 70 { 71 fTxt = new TText(280, 280, "0' / 0'"); 72 fTxt->SetTextAlign(33); // right, top 73 fTxt->SetTextColor(10); 74 fTxt->Draw(); 75 76 fList->Add(fTxt); 77 } 78 79 void MGStarg::InitBar() 80 { 81 fBar = new TLine(0, 0, 0, 0); 82 fBar->SetLineColor(kBlack); 83 fBar->SetLineStyle(1); 84 fBar->SetLineWidth(5); 85 fBar->Draw(); 86 87 fList->Add(fBar); 88 } 89 90 void MGStarg::InitCross() 91 { 92 fLin1 = new TLine(0, 0, 0, 0); 93 fLin2 = new TLine(0, 0, 0, 0); 94 95 fLin1->SetLineColor(10); // white (s. TAttFill) 96 fLin2->SetLineColor(10); // white 97 fLin1->SetLineStyle(1); // solid (s. TAttLine) 98 fLin2->SetLineStyle(1); 99 100 fLin1->SetLineWidth(2); 101 fLin2->SetLineWidth(2); 102 103 fLin1->Draw(); 104 fLin2->Draw(); 105 106 fList->Add(fLin1); 107 fList->Add(fLin2); 19 fCanvas->SetEditable(kFALSE); 108 20 } 109 21 110 22 MGStarg::MGStarg(const TGWindow* p, const UInt_t w) 111 : MG EmbeddedCanvas("Starg", p, w, 300)23 : MGAccuracy(p, w) 112 24 { 113 // FIXME: Overload MapWindow in newer Root versions to remove 114 // the contents of the graph! 115 fGraph = new TGraph; 116 fGraph->SetPoint(0, 0, 0); 117 fGraph->SetLineColor(kBlue); 118 fGraph->SetMarkerColor(kBlue); 119 fGraph->SetMarkerStyle(kFullDotMedium); 120 fGraph->Draw("LP"); 121 fList->Add(fGraph); 122 //fGraph->SetNameTitle("AccVsT", "Accuracy vs Min of Time"); 123 //fGraph->Draw("APL"); 124 //fGraph->SetMarkerSize(2); 125 126 DrawCoordinateSystem(); 127 128 InitText(); 129 InitCross(); 130 InitBar(); 131 132 InitCanvas(); 133 134 SetNoContextMenu(); 135 136 MTime t(-1); 137 fTime = t.GetAxisTime(); 25 SetColorScale(1.5); 138 26 } 139 140 MGStarg::~MGStarg()141 {142 // cout << "MGStarg destroyed." << endl;143 }144 145 // dist [deg]146 void MGStarg::UpdateText(Float_t dist)147 {148 dist *= 3600.; // [sec]149 150 int rs = (int)floor(fmod(dist, 60.));151 152 dist /= 60.; // [min]153 int rm = (int)dist;154 155 char txt[100];156 rm ? sprintf(txt, "%d'%02d\"", rm, rs) : sprintf(txt, "%d\"", rs);157 158 fTxt->SetText(fTxt->GetX(), fTxt->GetY(), txt);159 160 fBar->SetY2(dist*60); // [sec]161 if (dist<1.5)162 fBar->SetLineColor(kGreen);163 else164 if (dist<3)165 fBar->SetLineColor(kYellow);166 else167 fBar->SetLineColor(kRed);168 169 SetModified();170 }171 172 // dist [deg]173 void MGStarg::UpdateGraph(Float_t dist)174 {175 MTime t(-1);176 const Double_t dtime = t.GetAxisTime()-fTime; // range [-0.5h, 0h]177 178 dist *= 60; // min179 180 static int odist = -1;181 if (odist==(int)(dist*10*60) && dtime<10)182 return;183 184 odist = (int)(dist*10*60);185 186 fGraph->SetPoint(fGraph->GetN(), dtime, dist*60);187 188 const Double_t ntime = dtime;189 for (int i=0; i<fGraph->GetN(); i++)190 {191 Double_t x, y;192 fGraph->GetPoint(i, x, y);193 fGraph->SetPoint(i, x-ntime, y);194 //cout << i << ": " << x-ntime << " / " << y << endl;195 }196 while (fGraph->GetN()>0)197 {198 Double_t x, y;199 fGraph->GetPoint(0, x, y);200 201 if (x==-ntime && y==0)202 {203 fGraph->RemovePoint(0);204 continue;205 }206 207 if (x>-4.75*60)208 break;209 210 fGraph->RemovePoint(0);211 }212 213 fTime = t.GetAxisTime();214 215 SetModified();216 217 }218 219 void MGStarg::Update(Float_t pzd, Float_t azd, Float_t aaz)220 {221 const double dist = MAstro::GetDevAbs(pzd, azd, aaz);222 223 UpdateText(dist);224 UpdateGraph(dist);225 }226 227 void MGStarg::UpdateCross(Float_t x, Float_t y)228 {229 //230 // x["], y["]231 //232 static int X = ~0;233 static int Y = ~0;234 235 int pixx = (int)(x/fPix); // [pix]236 int pixy = (int)(y/fPix); // [pix]237 238 if (X==pixx && Y==pixy)239 return;240 241 X = pixx;242 Y = pixy;243 244 fLin1->SetX1(x-5.);245 fLin1->SetX2(x+5.);246 247 fLin2->SetX1(x-5.);248 fLin2->SetX2(x+5.);249 250 fLin1->SetY1(y-5.);251 fLin1->SetY2(y+5.);252 253 fLin2->SetY1(y+5.);254 fLin2->SetY2(y-5.);255 256 SetModified();257 }258 259 void MGStarg::Update(ZdAz &pos, ZdAz &dev)260 {261 // Estimate the distance in az direction on the camera plane262 const double daz = MAstro::GetDevAbs(pos.Zd(), 0, dev.Az())*3600.;263 264 //cout << "--> S: " << dev.Az()*60 << " " << dev.Zd()*60. << endl;265 266 UpdateCross(TMath::Sign(daz, dev.Az()), dev.Zd()*3600.);267 Update(pos.Zd(), dev.Zd(), dev.Az());268 269 UpdateCanvas();270 } -
trunk/MagicSoft/Cosy/gui/MGStarg.h
r4865 r7790 1 #ifndef MGSTARG_H2 #define MGSTARG_H1 #ifndef COSY_MGStarg 2 #define COSY_MGStarg 3 3 4 #ifndef COSY_MG EmbeddedCanvas5 #include "MG EmbeddedCanvas.h"4 #ifndef COSY_MGAccuracy 5 #include "MGAccuracy.h" 6 6 #endif 7 7 … … 12 12 class ZdAz; 13 13 14 class MGStarg : public MG EmbeddedCanvas14 class MGStarg : public MGAccuracy 15 15 { 16 TLine *fLin1;17 TLine *fLin2;16 // TLine *fLin1; 17 // TLine *fLin2; 18 18 19 TText *fTxt;19 // TText *fTxt; 20 20 21 TLine *fBar;21 // TLine *fBar; 22 22 23 TGraph *fGraph;23 // TGraph *fGraph; 24 24 25 Double_t fTime;25 // Double_t fTime; 26 26 27 void DrawCoordinateSystem(); 27 // void InitText(); 28 // void InitCross(); 29 // void InitBar(); 28 30 29 void InitText(); 30 void InitCross(); 31 void InitBar(); 31 // void UpdateCross(Float_t x, Float_t y); 32 // void UpdateText(Float_t dist); 33 // void UpdateGraph(Float_t acc); 34 // void Update(Float_t zd, Float_t x, Float_t y); 32 35 33 void UpdateCross(Float_t x, Float_t y);34 void UpdateText(Float_t acc);35 void UpdateGraph(Float_t acc);36 void Update(Float_t zd, Float_t x, Float_t y);37 36 38 37 public: 39 38 MGStarg(const TGWindow* p, const UInt_t w); 40 ~MGStarg();39 // ~MGStarg(); 41 40 42 void Update(ZdAz &pos, ZdAz &acc); 41 // virtual void DrawText(); 42 void DrawHexagon(); 43 44 // void Update(ZdAz &pos, ZdAz &acc); 43 45 44 46 ClassDef(MGStarg, 0) 45 47 }; 46 48 47 #endif // MGSTARG_H49 #endif // COSY_MGStarg -
trunk/MagicSoft/Cosy/gui/Makefile
r7787 r7790 40 40 MGAccuracy.cc \ 41 41 MGStarg.cc \ 42 MGNumStars.cc \ 42 43 MGSkyPosition.cc 43 44 -
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 -
trunk/MagicSoft/Cosy/tcpip/MTcpIpIO.cc
r4865 r7790 91 91 return false; 92 92 93 const UInt_t len = fTxSocket->SendRaw(msg, strlen(msg));93 const Int_t len = fTxSocket->SendRaw(msg, strlen(msg)); 94 94 if (len<0) 95 95 { … … 97 97 return false; 98 98 } 99 if (len!= strlen(msg))99 if (len!=(Int_t)strlen(msg)) 100 100 { 101 101 cout << "Send wrong number (" << len << ") of Bytes." << endl; -
trunk/MagicSoft/Cosy/videodev/FilterLed.cc
r7788 r7790 45 45 } 46 46 47 void FilterLed::DrawHexagon(float cx, float cy, float r, byte col) const 48 { 49 MGMap::DrawHexagon(fImg, 768, 576, cx, cy, r, col); 50 } 51 47 52 void FilterLed::DrawCircle(const Ring &l, byte col) const 48 53 { … … 53 58 { 54 59 DrawCircle(l.GetX(), l.GetY(), r, col); 60 } 61 62 void FilterLed::DrawHexagon(const Ring &l, double r, byte col) const 63 { 64 DrawHexagon(l.GetX(), l.GetY(), r, col); 55 65 } 56 66 … … 121 131 } 122 132 123 int FilterLed::GetMeanPosition Circle(const int x, const int y,124 const int box, float &mx, 125 133 int FilterLed::GetMeanPositionBox(const int x, const int y, 134 const int box, float &mx, 135 float &my, unsigned int &sum) const 126 136 { 127 137 //------------------------------- … … 188 198 } 189 199 190 int FilterLed::GetMeanPosition Circle(const int x, const int y,191 200 int FilterLed::GetMeanPositionBox(const int x, const int y, 201 const int box) const 192 202 { 193 203 float mx, my; 194 204 unsigned int sum; 195 return GetMeanPosition Circle(x, y, box, mx, my, sum);205 return GetMeanPositionBox(x, y, box, mx, my, sum); 196 206 } 197 207 … … 334 344 } 335 345 346 class ClusterFinder 347 { 348 private: 349 byte *fImg; 350 351 UInt_t fW; 352 UInt_t fH; 353 354 Int_t fX0; 355 Int_t fX1; 356 357 Int_t fY0; 358 Int_t fY1; 359 360 UInt_t fCount; 361 Float_t fSumX; 362 Float_t fSumY; 363 364 Float_t FindCluster(Int_t x, Int_t y) 365 { 366 // if edge is touched stop finding cluster 367 if (x<fX0 || x>=fX1 || y<fY0 || y>=fY1) 368 return -1; 369 370 if (fCount>999) 371 return -1; 372 373 // get the value 374 Float_t val = fImg[y*fW+x]; 375 376 // if its empty we have found the border of the cluster 377 if (val==0) 378 return 0; 379 380 // mark the point as processed 381 fImg[y*fW+x] = 0; 382 383 fSumX += x*val; // sumx 384 fSumY += y*val; // sumy 385 fCount++; 386 387 Float_t rc[4]; 388 rc[0] = FindCluster(x+1, y ); 389 rc[1] = FindCluster(x, y+1); 390 rc[2] = FindCluster(x-1, y ); 391 rc[3] = FindCluster(x, y-1); 392 393 for (int i=0; i<4; i++) 394 { 395 if (rc[i]<0) // check if edge is touched 396 return -1; 397 398 val += rc[i]; 399 } 400 401 return val; 402 } 403 public: 404 ClusterFinder(byte *img, UInt_t w, UInt_t h) 405 { 406 fW = w; 407 fH = h; 408 409 fImg = new byte[fW*fH]; 410 411 memcpy(fImg, img, fW*fH); 412 } 413 414 ~ClusterFinder() 415 { 416 delete fImg; 417 } 418 void FindCluster(Leds &leds, Int_t x0=0, Int_t y0=0, Int_t x1=0, Int_t y1=0) 419 { 420 fX0 = x0; 421 fY0 = y0; 422 fX1 = x1==0?fW:x1; 423 fY1 = y1==0?fH:y1; 424 425 for (Int_t x=fX0; x<fX1; x++) 426 for (Int_t y=fY0; y<fY1; y++) 427 { 428 const byte &b = fImg[y*fW+x]; 429 if (b==0) 430 continue; 431 432 fCount = 0; 433 fSumX = 0; 434 fSumY = 0; 435 436 const Float_t mag = FindCluster(x, y); 437 if (fCount>999) 438 { 439 cout << "ERROR - Spot with Size>999 detected..." << endl; 440 return; 441 } 442 443 if (mag>0 && fCount>6) 444 { 445 Float_t M = mag/0xff; 446 if (M>0xf0) 447 M=0xf0; 448 449 leds.Add(fSumX/mag, fSumY/mag, 0, 0, 0xf0); 450 } 451 } 452 leds.Compress(); 453 } 454 }; 336 455 337 456 void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const … … 353 472 byte &b = fImg[y*fW+x]; 354 473 474 // Skip saturating pixels 475 if (b>0xf0) 476 continue; 477 478 sum += b; 479 sq += b*b; 480 } 481 482 sum /= wx*hy; 483 sq /= wx*hy; 484 485 bright=sum; 486 487 488 // 254 because b<=max and not b<max 489 const double sdev = TMath::Sqrt(sq-sum*sum); 490 const byte max = sum+fCut*sdev>254 ? 254 : (byte)(sum+fCut*sdev); 491 492 // 493 // clean image from noise 494 // (FIXME: A lookup table could accelerate things... 495 // 496 for (int x=x0; x<x1; x++) 497 for (int y=y0; y<y1; y++) 498 { 499 byte &b = fImg[y*fW+x]; 500 if (b<=max) 501 b = 0; 502 } 503 504 ClusterFinder find(fImg, fW, fH); 505 find.FindCluster(leds, x0, y0, x1, y1); 506 } 507 508 /* 509 void FilterLed::Execute(Leds &leds, int xc, int yc, double &bright) const 510 { 511 const int x0 = TMath::Max(xc-fBox, 0); 512 const int y0 = TMath::Max(yc-fBox, 0); 513 const int x1 = TMath::Min(xc+fBox, fW); 514 const int y1 = TMath::Min(yc+fBox, fH); 515 516 const int wx = x1-x0; 517 const int hy = y1-y0; 518 519 double sum = 0; 520 double sq = 0; 521 522 for (int x=x0; x<x1; x++) 523 for (int y=y0; y<y1; y++) 524 { 525 byte &b = fImg[y*fW+x]; 526 355 527 sum += b; 356 528 sq += b*b; … … 387 559 byte mag[maxpnt]; // (Use 'new' instead for big numbers!) 388 560 561 const int r = 5; 562 389 563 int cnt = 0; 390 for (int x=x0 ; x<x1; x++)391 for (int y=y0 ; y<y1; y++)564 for (int x=x0+r; x<x1-r; x++) 565 for (int y=y0+r; y<y1-r; y++) 392 566 { 393 567 byte &b = fImg[y*fW+x]; … … 395 569 continue; 396 570 397 const int ipos = GetMeanPosition(x, y, 5);571 const int ipos = GetMeanPosition(x, y, r); 398 572 399 573 int j; … … 402 576 if (pos[j]==ipos) 403 577 { 404 if (mag[j] < 0xf0)405 mag[j] += 0x10;578 if (mag[j]<0xff) 579 mag[j]++; // how often found (area) 406 580 break; 407 581 } … … 411 585 412 586 pos[cnt] = ipos; 413 mag[cnt] = 0x10;587 mag[cnt] = 1; 414 588 415 589 cnt++; … … 428 602 for (int i=0; i<cnt; i++) 429 603 { 430 if (mag[i]<= 0x80) // 0xa0604 if (mag[i]<=7) 431 605 continue; 432 606 433 607 Float_t mx, my; 434 608 unsigned int sum; 435 GetMeanPosition(pos[i]%fW, pos[i]/fW, 5, mx, my, sum);436 437 leds.Add(mx, my, 0, 0, mag[i]);438 } 439 440 RemoveTwinsInterpol(leds, first, 5);441 } 442 443 void FilterLed::FindStar(Leds &leds, int xc, int yc, bool circle) const609 GetMeanPosition(pos[i]%fW, pos[i]/fW, r, mx, my, sum); 610 611 leds.Add(mx, my, 0, 0, 0);//mag[i]*10); 612 } 613 614 RemoveTwinsInterpol(leds, first, r); 615 } 616 */ 617 void FilterLed::FindStar(Leds &leds, int xc, int yc, bool box) const 444 618 { 445 619 // fBox: radius of the inner (signal) box … … 535 709 float mx, my; 536 710 unsigned int mag; 537 int pos = circle ? GetMeanPositionCircle(xc, yc, fBox-1, mx, my, mag) : GetMeanPosition(xc, yc, fBox-1, mx, my, mag);711 int pos = box ? GetMeanPositionBox(xc, yc, fBox-1, mx, my, mag) : GetMeanPosition(xc, yc, fBox-1, mx, my, mag); 538 712 539 713 if (pos<0 || pos>=fW*fH || fImg[pos]<sum+fCut*sdev) -
trunk/MagicSoft/Cosy/videodev/FilterLed.h
r7788 r7790 20 20 float fCut; 21 21 22 Float_t FindCluster(int &cnt, float *sum, UInt_t x, UInt_t y, 23 UInt_t x0, UInt_t y0, UInt_t x1, UInt_t y1) const; 24 22 25 void GetMinMax(const int offset, byte *min, byte *max) const; 23 26 int GetMeanPosition(const int x, const int y, const int box) const; … … 25 28 float &mx, float &my, unsigned int &sum) const; 26 29 27 int GetMeanPosition Circle(const int x, const int y,28 29 int GetMeanPosition Circle(const int x, const int y,30 const int box, float &mx, float &my, 31 30 int GetMeanPositionBox(const int x, const int y, 31 const int box) const; 32 int GetMeanPositionBox(const int x, const int y, 33 const int box, float &mx, float &my, 34 unsigned int &sum) const; 32 35 33 36 void RemoveTwinsInterpol(Leds &leds, Int_t first, Double_t radius) const; … … 66 69 void DrawCircle(const Ring &c, byte col=0x40) const; 67 70 void DrawCircle(const Ring &c, double r, byte col) const; 71 void DrawHexagon(float cx, float cy, float r, byte col=0x40) const; 72 void DrawHexagon(const Ring &c, double r, byte col) const; 68 73 69 74 ClassDef(FilterLed, 0)
Note:
See TracChangeset
for help on using the changeset viewer.