Commits

Takahiro Tsutsumi authored 51b307654c4
Fixed a bug in channel indexing for the statistics results

and enabled saving of the intermediate images for testing
No tags

code/synthesis/ImagerObjects/SDAlgorithmBase.cc

Modified
149 149 nsigmathresh = nsigma * (Float)robustrms(IPosition(1,0));
150 150 }
151 151
152 152 Float thresholdtouse;
153 153 if (nsigma>0.0) {
154 154 // returns as an Array but itsImages is already single plane so
155 155 // the return rms contains only a single element
156 156 Array<Double> medians;
157 157 //os<<"robuststats rec size="<<robuststats.nfields()<<LogIO::POST;
158 158 Bool statsexists = false;
159 + IPosition statsindex;
159 160 if (robuststats.nfields()) {
160 161 // use existing stats
161 162 if (robuststats.isDefined("robustrms")) {
162 163 robuststats.get(RecordFieldId("robustrms"), robustrms);
163 164 robuststats.get(RecordFieldId("median"), medians);
164 165 statsexists=True;
165 166 }
166 167 else if(robuststats.isDefined("medabsdevmed")) {
167 168 Array<Double> mads;
168 169 robuststats.get(RecordFieldId("medabsdevmed"), mads);
169 170 robuststats.get(RecordFieldId("median"), medians);
170 171 robustrms = mads * 1.4826; // convert to rms
171 172 statsexists=True;
172 173 }
174 + statsindex=IPosition(1,chanid); // this only support for npol =1, need to fix this
173 175 }
174 176 if (statsexists) {
175 177 os<<LogIO::DEBUG1<<"Using the existing robust image statatistics!"<<LogIO::POST;
176 178 }
177 179 else {
178 180 robustrms = itsImages->calcRobustRMS(medians, itsPBMask, fastnoise);
181 + statsindex=IPosition(1,0);
179 182 }
180 183 if (isautomasking) { // new threshold defination
181 - nsigmathresh = (Float)medians(IPosition(1,0)) + nsigma * (Float)robustrms(IPosition(1,0));
184 + //nsigmathresh = (Float)medians(IPosition(1,0)) + nsigma * (Float)robustrms(IPosition(1,0));
185 + nsigmathresh = (Float)medians(statsindex) + nsigma * (Float)robustrms(statsindex);
182 186 }
183 187 else {
184 - nsigmathresh = nsigma * (Float)robustrms(IPosition(1,0));
188 + nsigmathresh = nsigma * (Float)robustrms(statsindex);
185 189 }
186 190 thresholdtouse = max( nsigmathresh, loopcontrols.getCycleThreshold());
187 191 }
188 192 else {
189 193 thresholdtouse = loopcontrols.getCycleThreshold();
190 194 }
191 195 os << LogIO::DEBUG1<<"loopcontrols.getCycleThreshold()="<<loopcontrols.getCycleThreshold()<<LogIO::POST;
192 196 os << LogIO::DEBUG1<< "thresholdtouse="<<thresholdtouse<<LogIO::POST;
193 197 String thresholddesc = (thresholdtouse == loopcontrols.getCycleThreshold() ? "cyclethreshold" : "n-sigma");
194 198

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut