casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
FlagAgentDisplay.h
Go to the documentation of this file.
00001 //# FlagAgentDisplay.h: This file contains the interface definition of the FlagAgentDisplay class.
00002 //#
00003 //#  CASA - Common Astronomy Software Applications (http://casa.nrao.edu/)
00004 //#  Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved.
00005 //#  Copyright (C) European Southern Observatory, 2011, All rights reserved.
00006 //#
00007 //#  This library is free software; you can redistribute it and/or
00008 //#  modify it under the terms of the GNU Lesser General Public
00009 //#  License as published by the Free software Foundation; either
00010 //#  version 2.1 of the License, or (at your option) any later version.
00011 //#
00012 //#  This library is distributed in the hope that it will be useful,
00013 //#  but WITHOUT ANY WARRANTY, without even the implied warranty of
00014 //#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 //#  Lesser General Public License for more details.
00016 //#
00017 //#  You should have received a copy of the GNU Lesser General Public
00018 //#  License along with this library; if not, write to the Free Software
00019 //#  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00020 //#  MA 02111-1307  USA
00021 //# $Id: $
00022 
00023 #ifndef FlagAgentDisplay_H_
00024 #define FlagAgentDisplay_H_
00025 
00026 #include <flagging/Flagging/FlagAgentBase.h>
00027 
00028 #include <casadbus/viewer/ViewerProxy.h>
00029 #include <casadbus/plotserver/PlotServerProxy.h>
00030 #include <casadbus/utilities/BusAccess.h>
00031 #include <casadbus/session/DBusSession.h>
00032 
00033 //#include <ms/MeasurementSets/MSColumns.h>
00034 
00035 #include <flagging/Flagging/LFPlotServerProxy.h>
00036 
00037 
00038 namespace casa { //# NAMESPACE CASA - BEGIN
00039   
00040   class FlagAgentDisplay : public FlagAgentBase {
00041     
00042   public:
00043     
00044     FlagAgentDisplay(FlagDataHandler *dh, Record config, Bool writePrivateFlagCube = false);
00045     ~FlagAgentDisplay();
00046 
00047     // Make plots and either display or write to a file
00048     Bool displayReports(FlagReport &combinedReport);
00049     
00050     // Get a report/summary
00051     FlagReport getReport();
00052     
00053   protected:
00054     
00055     // Compute flags for a given (time,freq) map
00056     bool computeAntennaPairFlags(const vi::VisBuffer2 &visBuffer, VisMapper &visibilities,FlagMapper &flag,Int antenna1,Int antenna2,vector<uInt> &rows);
00057 
00058     void preProcessBuffer(const vi::VisBuffer2 &visBuffer);
00059     
00060     // Choose how to step through the baselines in the current chunk
00061     void iterateAntennaPairsInteractive(antennaPairMap *antennaPairMap_ptr);
00062     
00063     // Parse configuration parameters
00064     void setAgentParameters(Record config);
00065 
00066   private:
00067     
00068     Bool setDataLayout();
00069     Bool setReportLayout();
00070     Bool buildDataPlotWindow();
00071     Bool buildReportPlotWindow();
00072 
00073 
00074     void getChunkInfo(const vi::VisBuffer2 &visBuffer);
00075     Bool skipBaseline(std::pair<Int,Int> antennaPair);
00076  
00077     void getUserInput();
00078     void getReportUserInput();
00079     
00080     void DisplayRaster(Int xdim, Int ydim, Vector<Float> &data, uInt frame);
00081     void DisplayLine(Int xdim, Vector<Double> &xdata, Vector<Float> &ydata, String label, String color, Bool hold,  uInt frame);
00082     void DisplayScatter(Int xdim, Vector<Double> &xdata, Vector<Float> &ydata, String label, String color, Bool hold,  uInt frame);
00083     void DisplayLineScatterError(FlagPlotServerProxy *&plotter, String &plottype, Vector<Float> &xdata, Vector<Float> &ydata, String &errortype, Vector<Float> &error, String label, String color, uInt frame);
00084 
00085     // Plotter members
00086     FlagPlotServerProxy *dataplotter_p;  
00087     FlagPlotServerProxy *reportplotter_p;
00088     Vector<dbus::variant> panels_p, report_panels_p;
00089     char *dock_xml_p, *report_dock_xml_p;
00090     Bool showBandpass_p;
00091 
00092     // Control parameters
00093     Bool stopAndExit_p;
00094     Bool pause_p;
00095     Bool dataDisplay_p, reportDisplay_p; // show per chunk plots and/or end-of-MS plots
00096     Bool reportReturn_p;
00097     String reportFormat_p;
00098     
00099     // visBuffer state variables
00100     Int fieldId_p;
00101     String fieldName_p;
00102     Int scanStart_p;
00103     Int scanEnd_p;
00104     Int spwId_p;
00105     String antenna1_p;
00106     String antenna2_p;
00107     
00108     uInt nPolarizations_p;
00109     Vector<Double> freqList_p;
00110     
00111     
00112     // GUI parameters
00113     String userChoice_p;
00114     String userFixA1_p, userFixA2_p;
00115     
00116     Int skipScan_p, skipSpw_p, skipField_p;
00117 
00118     Vector<String> plotColours_p;
00119     
00120     
00121   };
00122   
00123   
00124 } //# NAMESPACE CASA - END
00125 
00126 #endif /* FLAGAGENTDISPLAY_H_ */
00127