Skip to content
Snippets Groups Projects
Commit b2310c31 authored by Chiara Salvoni's avatar Chiara Salvoni
Browse files

Merge branch 'ast-1074-remove-fetch-functions-everywhere' into 'master'

Remove fetch functions from inputStep

See merge request !820
parents 861f337e 2704ebe1
No related branches found
No related tags found
1 merge request!820AST-1074 Remove fetch functions from inputStep
Pipeline #38929 passed
...@@ -34,68 +34,6 @@ InputStep::~InputStep() {} ...@@ -34,68 +34,6 @@ InputStep::~InputStep() {}
std::string InputStep::msName() const { return std::string(); } std::string InputStep::msName() const { return std::string(); }
const Cube<bool>& InputStep::fetchFullResFlags(const base::DPBuffer& bufin,
base::DPBuffer& bufout,
common::NSTimer& timer,
bool merge) {
// If already defined in the buffer, return those fullRes flags.
if (!bufin.getFullResFlags().empty()) {
return bufin.getFullResFlags();
}
// No fullRes flags in buffer, so get them from the input.
timer.stop();
bool fnd = getFullResFlags(bufin.getRowNrs(), bufout);
timer.start();
Cube<bool>& fullResFlags = bufout.getFullResFlags();
if (!fnd) {
// No fullRes flags in input; form them from the flags in the buffer.
// Only use the XX flags; no averaging done, thus navgtime=1.
// (If any averaging was done, the flags would be in the buffer).
IPosition shp(bufin.getFlags().shape());
if (fullResFlags.shape()[0] != shp[1] || fullResFlags.shape()[1] != 1 ||
fullResFlags.shape()[2] != shp[2])
throw std::runtime_error("Invalid shape of full res flags");
casacore::objcopy(fullResFlags.data(), bufin.getFlags().data(),
fullResFlags.size(), 1, shp[0]); // only copy XX.
return fullResFlags;
}
// There are fullRes flags.
// If needed, merge them with the buffer's flags.
if (merge) {
DPBuffer::mergeFullResFlags(fullResFlags, bufin.getFlags());
}
return fullResFlags;
}
const Cube<float>& InputStep::fetchWeights(const DPBuffer& bufin,
DPBuffer& bufout,
common::NSTimer& timer) {
// If already defined in the buffer, return those weights.
if (!bufin.getWeights().empty()) {
return bufin.getWeights();
}
// No weights in buffer, so get them from the input.
// It might need the data and flags in the buffer.
timer.stop();
getWeights(bufin.getRowNrs(), bufout);
timer.start();
return bufout.getWeights();
}
const Matrix<double>& InputStep::fetchUVW(const DPBuffer& bufin,
DPBuffer& bufout,
common::NSTimer& timer) {
// If already defined in the buffer, return those UVW.
if (!bufin.getUVW().empty()) {
return bufin.getUVW();
}
// No UVW in buffer, so get them from the input.
timer.stop();
getUVW(bufin.getRowNrs(), bufin.getTime(), bufout);
timer.start();
return bufout.getUVW();
}
void InputStep::getUVW(const RefRows&, double, DPBuffer&) { void InputStep::getUVW(const RefRows&, double, DPBuffer&) {
throw std::runtime_error("InputStep::getUVW not implemented"); throw std::runtime_error("InputStep::getUVW not implemented");
} }
......
...@@ -33,14 +33,6 @@ namespace steps { ...@@ -33,14 +33,6 @@ namespace steps {
/// data from a MeasurementSet. However, it is also possible to have /// data from a MeasurementSet. However, it is also possible to have
/// input steps generating data on the fly as done in test programs /// input steps generating data on the fly as done in test programs
/// like tAverager.cc. /// like tAverager.cc.
///
/// A particular task of the class is to fetch the input for various
/// data items like weight, uvw, etc.. This is done by testing if the
/// item's data array is in the DPBuffer. If so, it will be returned.
/// Otherwise the appropriate 'get' function will be called to read the
/// data array from the input.
/// The derived classes should implement those 'get' functions, unless
/// they are sure the data arrays are always put in the buffer.
class InputStep : public Step { class InputStep : public Step {
public: public:
...@@ -87,38 +79,6 @@ class InputStep : public Step { ...@@ -87,38 +79,6 @@ class InputStep : public Step {
virtual double firstTime() const; virtual double firstTime() const;
virtual double lastTime() const; virtual double lastTime() const;
/// Fetch the FullRes flags.
/// If defined in the buffer, they are taken from there.
/// Otherwise there are read from the input.
/// If not defined in the input, they are filled using the flags in the
/// buffer assuming that no averaging has been done so far.
/// If desired, they can be merged with the buffer's FLAG which means
/// that if an averaged channel is flagged, the corresponding FullRes
/// flags are set.
/// It does a stop/start of the timer when actually reading the data.
const casacore::Cube<bool>& fetchFullResFlags(const base::DPBuffer& bufin,
base::DPBuffer& bufout,
common::NSTimer& timer,
bool merge = false);
/// Fetch the weights.
/// If defined in the buffer, they are taken from there.
/// Otherwise there are read from the input.
/// If they have to be read and if autoweighting is in effect, the buffer
/// must contain DATA to calculate the weights.
/// <br>It does a stop/start of the timer when actually reading the data.
const casacore::Cube<float>& fetchWeights(const base::DPBuffer& bufin,
base::DPBuffer& bufout,
common::NSTimer& timer);
/// Fetch the UVW.
/// If defined in the buffer, they are taken from there.
/// Otherwise there are read from the input.
/// <br>It does a stop/start of the timer when actually reading the data.
const casacore::Matrix<double>& fetchUVW(const base::DPBuffer& bufin,
base::DPBuffer& bufout,
common::NSTimer& timer);
/// Check if a measurement set contains Baseline Dependent Averaged data. /// Check if a measurement set contains Baseline Dependent Averaged data.
/// @param ms A casacore measurement set. /// @param ms A casacore measurement set.
/// @return true if the measurement set has BDA data, false if it is regular. /// @return true if the measurement set has BDA data, false if it is regular.
......
...@@ -15,8 +15,6 @@ class MockPyStep(Step): ...@@ -15,8 +15,6 @@ class MockPyStep(Step):
def __init__(self, parset, prefix): def __init__(self, parset, prefix):
""" """
Set up the step (constructor). Read the parset here. Set up the step (constructor). Read the parset here.
Set fetch_weights to True if the weights need to be read.
Similarly for fetch_uvw.
Args: Args:
parset: Parameter set for the entire pipeline parset: Parameter set for the entire pipeline
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment