Line data Source code
1 :
2 : //# RFASelector.h: this defines RFASelector
3 : //# Copyright (C) 2000,2001
4 : //# Associated Universities, Inc. Washington DC, USA.
5 : //#
6 : //# This library is free software; you can redistribute it and/or modify it
7 : //# under the terms of the GNU Library General Public License as published by
8 : //# the Free Software Foundation; either version 2 of the License, or (at your
9 : //# option) any later version.
10 : //#
11 : //# This library is distributed in the hope that it will be useful, but WITHOUT
12 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
14 : //# License for more details.
15 : //#
16 : //# You should have received a copy of the GNU Library General Public License
17 : //# along with this library; if not, write to the Free Software Foundation,
18 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
19 : //#
20 : //# Correspondence concerning AIPS++ should be addressed as follows:
21 : //# Internet email: aips2-request@nrao.edu.
22 : //# Postal address: AIPS++ Project Office
23 : //# National Radio Astronomy Observatory
24 : //# 520 Edgemont Road
25 : //# Charlottesville, VA 22903-2475 USA
26 : //#
27 : //# $Id$
28 : #ifndef FLAGGING_RFASELECTOR_H
29 : #define FLAGGING_RFASELECTOR_H
30 :
31 : #include <flagging/Flagging/RFAFlagCubeBase.h>
32 : #include <flagging/Flagging/RFDataMapper.h>
33 : #include <casacore/ms/MeasurementSets/MSColumns.h>
34 : #include <casacore/casa/Arrays/LogiVector.h>
35 :
36 : namespace casa { //# NAMESPACE CASA - BEGIN
37 :
38 : // <summary>
39 : // RFASelector: flags pixels/rows based on a specified selection
40 : // </summary>
41 :
42 : // <use visibility=local>
43 :
44 : // <reviewed reviewer="" date="" tests="" demos="">
45 : // </reviewed>
46 :
47 : // <prerequisite>
48 : // <li> RFAFlagCubebase
49 : // </prerequisite>
50 : //
51 : // <etymology>
52 : // RedFlaggerAgent Selector
53 : // </etymology>
54 : //
55 : // <synopsis>
56 : // RFASelector accepts a whole bunch of options to select a subset of the
57 : // casacore::MS (by time, antenna, baseline, channel/frequency, etc.), and to flag/unflag
58 : // the whole selection, or specific parts of it (autocorrelations, specific
59 : // time slots, VLA quacks, etc.)
60 : // </synopsis>
61 : //
62 : // <todo asof="2001/04/16">
63 : // <li> add this feature
64 : // <li> fix this bug
65 : // <li> start discussion of this possible extension
66 : // </todo>
67 :
68 : class RFASelector : public RFAFlagCubeBase
69 : {
70 : public:
71 : // constructor.
72 : RFASelector ( RFChunkStats &ch,const casacore::RecordInterface &parm );
73 : virtual ~RFASelector ();
74 :
75 0 : virtual casacore::uInt estimateMemoryUse () { return RFAFlagCubeBase::estimateMemoryUse()+2; }
76 : virtual casacore::Bool newChunk ( casacore::Int &maxmem );
77 : virtual IterMode iterTime ( casacore::uInt it );
78 : virtual void endRows(casacore::uInt itime);
79 : virtual IterMode iterRow ( casacore::uInt ir );
80 : virtual void iterFlag(casacore::uInt itime);
81 : virtual void startData(bool verbose);
82 :
83 : virtual casacore::String getDesc ();
84 : static const casacore::RecordInterface & getDefaults ();
85 :
86 : casacore::Bool fortestingonly_parseMinMax( casacore::Float &vmin,casacore::Float &vmax,const casacore::RecordInterface &spec,casacore::uInt f0 );
87 : void fortestingonly_parseClipField( const casacore::RecordInterface &spec,casacore::Bool clip );
88 :
89 : protected:
90 : typedef struct ClipInfo {
91 : RFDataMapper *mapper;
92 : casacore::Float vmin, vmax;
93 : casacore::Bool channel_average; // average data over channels?
94 : casacore::Bool clip; // flag outside range if true (otherwise flag inside)
95 : casacore::Float offset; // offset added to value (used for angles, etc.)
96 : } ClipInfo;
97 :
98 :
99 : template<class T> casacore::Bool reformRange( casacore::Matrix<T> &rng,const casacore::Array<T> &arr );
100 : template<class T> casacore::Bool parseRange( casacore::Matrix<T> &rng,const casacore::RecordInterface &parm,const casacore::String &id );
101 : template<class T> casacore::Bool find( casacore::uInt &index,const T &obj,const casacore::Vector<T> &arr );
102 :
103 : casacore::Bool parseTimes ( casacore::Array<casacore::Double> ×,const casacore::RecordInterface &parm,const casacore::String &id,casacore::Bool secs=false );
104 : void addString ( casacore::String &str,const casacore::String &s1,const char *sep=" " );
105 : virtual void processRow ( casacore::uInt ifr,casacore::uInt it );
106 : casacore::Bool parseMinMax ( casacore::Float &vmin,casacore::Float &vmax,const casacore::RecordInterface &spec,casacore::uInt f0 );
107 : void addClipInfo ( const casacore::Vector<casacore::String> &expr,casacore::Float vmin,casacore::Float vmax,casacore::Bool clip, casacore::Bool channel_average );
108 : void parseClipField ( const casacore::RecordInterface &spec,casacore::Bool clip );
109 : void addClipInfoDesc ( const casacore::Block<ClipInfo> &clip );
110 :
111 : // shadow mode
112 : casacore::Double diameter; /* diameter to use. If negative use
113 : the diameters array (true antenna diameters)
114 : */
115 : casacore::Vector< casacore::Double > diameters;
116 : casacore::MSAntennaColumns *ac;
117 :
118 : // elevation
119 : double lowerlimit;
120 : double upperlimit;
121 :
122 : // description of agent
123 : casacore::String desc_str;
124 : // selection arguments
125 : casacore::Matrix<casacore::Double> sel_freq,sel_time,sel_timerng,sel_uvrange;
126 : casacore::Matrix<casacore::Int> sel_chan;
127 : casacore::Vector<casacore::Int> sel_corr,sel_spwid,sel_fieldid, sel_stateid;
128 : casacore::Vector<casacore::String> sel_fieldnames;
129 : casacore::LogicalVector sel_ifr,flagchan,sel_feed;
130 : casacore::Bool sel_autocorr,unflag;
131 : casacore::Block<ClipInfo> sel_clip,sel_clip_row;
132 : casacore::LogicalVector sel_clip_active;
133 : casacore::Bool sum_sel_clip_active;
134 : casacore::Double quack_si, quack_dt;
135 : casacore::String quack_mode;
136 : casacore::Bool quack_increment;
137 : casacore::Vector<casacore::Int> sel_scannumber,sel_arrayid,sel_observation;
138 : casacore::String sel_column;
139 :
140 : casacore::Bool select_fullrow,flag_everything, shadow, elevation;
141 :
142 : };
143 :
144 :
145 :
146 :
147 : } //# NAMESPACE CASA - END
148 :
149 : #ifndef AIPS_NO_TEMPLATE_SRC
150 : #include <flagging/Flagging/RFASelector.tcc>
151 : #endif //# AIPS_NO_TEMPLATE_SRC
152 : #endif
|