XMM-Newton SAS Home Page
XMM-Newton Science Analysis System


colsmooth (colsmooth-1.9.1) [xmmsas_20230412_1735-21.0.0]


Algorithm

    &readParameters;
    convolver = &getConvolver;
    (values, uncerts) = &getInSet;
    mask = &getMask;

    noHoleMask = mask;
    foreach (hole in mask) {
      if (hole width <= fillholewidth) {
        noHoleMask = true;
        values = 0.0;
      }
    }

    if (normalise) {
      norm = 1.0;
    } else {
      norm = sum(convolver);
    }

    smoothedValues = 0.0;
    for (n = 1 to vectorSize) {
    next if (!noHoleMask(n));
      summ = 0.0;
      weight = 0.0;
      for (i = 1 to convolverSize) {
        j = n - (i - 1 - convolverSize / 2)
      next if (j < 1 || j > vectorSize || !mask(j));
        summ = summ + convolver(i) * values(j);
        weight = weight + convolver(i);
      }
      smoothedValues(n) = summ * norm / weight;
    }

    if (witherrors) {
      smoothedUncerts = 0.0;
      for (n = 1 to vectorSize) {
      next if (!noHoleMask(n));
        summ = 0.0;
        weight = 0.0;
        for (i = 1 to convolverSize) {
          j = n - (i - 1 - convolverSize / 2)
        next if (j < 1 || j > vectorSize || !mask(j));
          summ = summ + convolver(i) * convolver(i) * values(j) * values(j);
          weight = weight + convolver(i);
        }
        smoothedUncerts(n) = sqrt(summ) * norm / weight;
      }
    }

    &writeFitsOutput(smoothedValues, smoothedUncerts, noHoleMask);
    if (withPlotOutput) {
      &writePlotOutput(smoothedValues, smoothedUncerts, noHoleMask);
    }



XMM-Newton SOC -- 2023-04-16