Skip to content
Snippets Groups Projects
Commit ef908b3c authored by André Offringa's avatar André Offringa
Browse files

Merge branch 'clang-tidy' into 'master'

Apply some suggestions by clang-tidy

See merge request aroffringa/aoflagger!120
parents a1fad253 3134af58
No related branches found
No related tags found
No related merge requests found
......@@ -31,7 +31,7 @@ BHFitsImageSet::BHFitsImageSet(const BHFitsImageSet &source)
_width(source._width),
_height(source._height) {}
BHFitsImageSet::~BHFitsImageSet() {}
BHFitsImageSet::~BHFitsImageSet() = default;
std::unique_ptr<ImageSet> BHFitsImageSet::Clone() {
return std::unique_ptr<BHFitsImageSet>(new BHFitsImageSet(*this));
......
......@@ -2,30 +2,34 @@
std::unique_ptr<VectorImage> ShrinkHorizontally(const ImageInterface& source,
size_t shrinkFactor) {
const size_t newWidth = (source.Width() + shrinkFactor - 1) / shrinkFactor;
const size_t height = source.Height();
std::vector<float> newImage;
newImage.reserve(newWidth * height);
for (size_t x = 0; x != newWidth; ++x) {
size_t binSize = shrinkFactor;
if (binSize + x * shrinkFactor > source.Width())
binSize = source.Width() - x * shrinkFactor;
const float* sourceData = source.Data();
for (size_t y = 0; y != height; ++y) {
float sum = 0.0;
const float* sourceRow = &sourceData[y * source.Stride()];
for (size_t binX = 0; binX < binSize; ++binX) {
size_t curX = x * shrinkFactor + binX;
sum += sourceRow[curX];
if (source.Width() == 0)
return std::unique_ptr<VectorImage>(new VectorImage());
else {
const size_t newWidth = (source.Width() + shrinkFactor - 1) / shrinkFactor;
const size_t height = source.Height();
std::vector<float> newImage;
newImage.reserve(newWidth * height);
for (size_t x = 0; x != newWidth; ++x) {
size_t binSize = shrinkFactor;
if (binSize + x * shrinkFactor > source.Width())
binSize = source.Width() - x * shrinkFactor;
const float* sourceData = source.Data();
for (size_t y = 0; y != height; ++y) {
float sum = 0.0;
const float* sourceRow = &sourceData[y * source.Stride()];
for (size_t binX = 0; binX < binSize; ++binX) {
size_t curX = x * shrinkFactor + binX;
sum += sourceRow[curX];
}
newImage.emplace_back(sum / float(binSize));
}
newImage.emplace_back(sum / float(binSize));
}
return std::unique_ptr<VectorImage>(
new VectorImage(std::move(newImage), newWidth));
}
return std::unique_ptr<VectorImage>(
new VectorImage(std::move(newImage), newWidth));
}
std::unique_ptr<VectorImage> ShrinkVertically(const ImageInterface& source,
......
......@@ -5,7 +5,8 @@
class RayleighFitter {
public:
RayleighFitter() : _fitLogarithmic(true) {}
RayleighFitter()
: _fitLogarithmic(true), _hist(nullptr), _minVal(0.0), _maxVal(0.0) {}
void Fit(double minVal, double maxVal, const LogHistogram &hist,
double &sigma, double &n);
......@@ -25,9 +26,6 @@ class RayleighFitter {
static double ErrorOfFit(const LogHistogram &histogram, double rangeStart,
double rangeEnd, double sigma, double n);
const LogHistogram *_hist;
double _minVal, _maxVal;
bool FitLogarithmic() const { return _fitLogarithmic; }
void SetFitLogarithmic(bool fitLogarithmic) {
_fitLogarithmic = fitLogarithmic;
......@@ -35,6 +33,10 @@ class RayleighFitter {
private:
bool _fitLogarithmic;
public:
const LogHistogram *_hist;
double _minVal, _maxVal;
};
#endif
......@@ -46,7 +46,6 @@ void PlotFrame::plot() {
if (_data.PolarizationCount() > 0 &&
_data.GetPolarization(0) == Polarization::StokesI) {
plotTimeGraph(_data, "Stokes I");
drawn = true;
} else if (!drawn) {
plotTimeGraph(_data, "Data");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment