Commits

Takeshi Nakazato authored 1a8998d064c
renamed weightspec to weightSpec

NAOJ code review Refs #2629

casatools/src/code/synthesis/MeasurementComponents/SDGrid.cc

Modified
2153 2153 void SDGrid::pickWeights(const VisBuffer& vb, Matrix<Float>& weight){
2154 2154 #if defined(SDGRID_PERFS)
2155 2155 StartStop trigger(cPickWeights);
2156 2156 #endif
2157 2157 //break reference
2158 2158 weight.resize();
2159 2159
2160 2160 if (useImagingWeight_p) {
2161 2161 weight.reference(vb.imagingWeight());
2162 2162 } else {
2163 - const Cube<Float> weightspec(vb.weightSpectrum());
2163 + const Cube<Float> weightSpec(vb.weightSpectrum());
2164 2164 weight.resize(vb.nChannel(), vb.nRow());
2165 2165
2166 2166 auto const toStokesWeight = [](float numerator, float denominator) {
2167 2167 constexpr float fmin = std::numeric_limits<float>::min();
2168 2168 return abs(denominator) < fmin ? 0.0f : 4.0f * numerator / denominator;
2169 2169 };
2170 2170
2171 - if (weightspec.nelements() == 0) {
2171 + if (weightSpec.nelements() == 0) {
2172 2172 auto const weightMat = vb.weightMat();
2173 2173 ssize_t const npol = weightMat.shape()(0);
2174 2174 if (npol == 1) {
2175 2175 for (int k = 0; k < vb.nRow(); ++k) {
2176 2176 weight.column(k).set(weightMat(0, k));
2177 2177 }
2178 2178 } else {
2179 2179 for (int k = 0; k < vb.nRow(); ++k) {
2180 2180 //cerr << "nrow " << vb.nRow() << " " << weight.shape() << " " << weight.column(k).shape() << endl;
2181 2181 // CAS-9957 correct weight propagation from linear/circular correlations to Stokes I
2182 2182 auto const denominator = weightMat(0, k) + weightMat((npol-1), k);
2183 2183 auto const numerator = weightMat(0, k) * weightMat((npol-1), k);
2184 2184 weight.column(k).set(toStokesWeight(numerator, denominator));
2185 2185 }
2186 2186 }
2187 2187 } else {
2188 - ssize_t const npol = weightspec.shape()(0);
2188 + ssize_t const npol = weightSpec.shape()(0);
2189 2189 if (npol == 1) {
2190 2190 for (int k = 0; k < vb.nRow(); ++k) {
2191 2191 for (int chan = 0; chan < vb.nChannel(); ++chan) {
2192 - weight(chan, k)=weightspec(0, chan, k);
2192 + weight(chan, k)=weightSpec(0, chan, k);
2193 2193 }
2194 2194 }
2195 2195 } else {
2196 2196 for (int k = 0; k < vb.nRow(); ++k) {
2197 2197 for (int chan = 0; chan < vb.nChannel(); ++chan) {
2198 2198 // CAS-9957 correct weight propagation from linear/circular correlations to Stokes I
2199 - auto const denominator = weightspec(0, chan, k) + weightspec((npol-1), chan, k);
2200 - auto const numerator = weightspec(0, chan, k) * weightspec((npol-1), chan, k);
2199 + auto const denominator = weightSpec(0, chan, k) + weightSpec((npol-1), chan, k);
2200 + auto const numerator = weightSpec(0, chan, k) * weightSpec((npol-1), chan, k);
2201 2201 weight(chan, k) = toStokesWeight(numerator, denominator);
2202 2202 }
2203 2203 }
2204 2204 }
2205 2205 }
2206 2206 }
2207 2207 }
2208 2208
2209 2209 void SDGrid::clipMinMax() {
2210 2210 if (clipminmax_) {

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

Add shortcut