Skip to content
Snippets Groups Projects
Commit d0fcb3f5 authored by Andre Offringa's avatar Andre Offringa
Browse files

Task #10805: multidirsolver would always use phase_only mode, even in...

Task #10805: multidirsolver would always use phase_only mode, even in complexgain mode: Fixed. Also removed redundant _mode variable in the MultiDirSolver.
parent 86618693
No related branches found
No related tags found
No related merge requests found
...@@ -28,12 +28,7 @@ public: ...@@ -28,12 +28,7 @@ public:
std::vector<std::vector<Constraint::Result> > _results; std::vector<std::vector<Constraint::Result> > _results;
}; };
enum CalibrationMode { CalibrateComplexGain, MultiDirSolver(size_t maxIterations, double accuracy, double stepSize);
CalibrateTEC1,
CalibrateTEC2,
CalibratePhase };
MultiDirSolver(size_t maxIterations, double accuracy, double stepSize, bool phaseOnly = true);
void init(size_t nAntennas, size_t nDirections, size_t nChannels, void init(size_t nAntennas, size_t nDirections, size_t nChannels,
const std::vector<int>& ant1, const std::vector<int>& ant2); const std::vector<int>& ant1, const std::vector<int>& ant2);
...@@ -44,7 +39,7 @@ public: ...@@ -44,7 +39,7 @@ public:
SolveResult process(std::vector<Complex*>& data, std::vector<std::vector<Complex* > >& modelData, SolveResult process(std::vector<Complex*>& data, std::vector<std::vector<Complex* > >& modelData,
std::vector<std::vector<DComplex> >& solutions, double time) const; std::vector<std::vector<DComplex> >& solutions, double time) const;
void set_mode(CalibrationMode mode) { _mode = mode; } void set_phase_only(bool phaseOnly) { _phaseOnly = phaseOnly; }
void set_channel_blocks(size_t nChannelBlocks) { _nChannelBlocks = nChannelBlocks; } void set_channel_blocks(size_t nChannelBlocks) { _nChannelBlocks = nChannelBlocks; }
...@@ -69,7 +64,6 @@ private: ...@@ -69,7 +64,6 @@ private:
std::vector<int> _ant1, _ant2; std::vector<int> _ant1, _ant2;
// Calibration setup // Calibration setup
enum CalibrationMode _mode;
size_t _maxIterations; size_t _maxIterations;
double _accuracy; double _accuracy;
double _stepSize; double _stepSize;
......
...@@ -116,21 +116,32 @@ namespace LOFAR { ...@@ -116,21 +116,32 @@ namespace LOFAR {
itsConstraints.push_back(casacore::CountedPtr<Constraint>( itsConstraints.push_back(casacore::CountedPtr<Constraint>(
new CoreConstraint())); new CoreConstraint()));
} }
if (itsMode == GainCal::PHASEONLY) { switch(itsMode) {
case GainCal::PHASEONLY:
itsConstraints.push_back(casacore::CountedPtr<Constraint>( itsConstraints.push_back(casacore::CountedPtr<Constraint>(
new PhaseConstraint())); new PhaseConstraint()));
} else if (itsMode == GainCal::TEC) { itsMultiDirSolver.set_phase_only(true);
break;
case GainCal::TEC:
itsConstraints.push_back(casacore::CountedPtr<Constraint>( itsConstraints.push_back(casacore::CountedPtr<Constraint>(
new TECConstraint(TECConstraint::TECOnlyMode))); new TECConstraint(TECConstraint::TECOnlyMode)));
} else if (itsMode == GainCal::TECANDPHASE){ itsMultiDirSolver.set_phase_only(true);
break;
case GainCal::TECANDPHASE:
itsConstraints.push_back(casacore::CountedPtr<Constraint>( itsConstraints.push_back(casacore::CountedPtr<Constraint>(
new TECConstraint(TECConstraint::TECAndCommonScalarMode))); new TECConstraint(TECConstraint::TECAndCommonScalarMode)));
} else if (itsMode == GainCal::COMPLEXGAIN) { itsMultiDirSolver.set_phase_only(true);
break;
case GainCal::COMPLEXGAIN:
// no constraints // no constraints
} else if (itsMode == GainCal::TECSCREEN) { itsMultiDirSolver.set_phase_only(false);
break;
case GainCal::TECSCREEN:
itsConstraints.push_back(casacore::CountedPtr<Constraint>( itsConstraints.push_back(casacore::CountedPtr<Constraint>(
new ScreenConstraint(parset, prefix+"tecscreen."))); new ScreenConstraint(parset, prefix+"tecscreen.")));
} else { itsMultiDirSolver.set_phase_only(true);
break;
default:
THROW (Exception, "Unexpected mode: " << THROW (Exception, "Unexpected mode: " <<
GainCal::calTypeToString(itsMode)); GainCal::calTypeToString(itsMode));
} }
......
...@@ -7,16 +7,15 @@ ...@@ -7,16 +7,15 @@
using namespace arma; using namespace arma;
MultiDirSolver::MultiDirSolver(size_t maxIterations, double accuracy, double stepSize, bool phaseOnly) : MultiDirSolver::MultiDirSolver(size_t maxIterations, double accuracy, double stepSize) :
_nAntennas(0), _nAntennas(0),
_nDirections(0), _nDirections(0),
_nChannels(0), _nChannels(0),
_nChannelBlocks(0), _nChannelBlocks(0),
_mode(CalibrateComplexGain),
_maxIterations(maxIterations), _maxIterations(maxIterations),
_accuracy(accuracy), _accuracy(accuracy),
_stepSize(stepSize), _stepSize(stepSize),
_phaseOnly(phaseOnly) _phaseOnly(false)
{ {
} }
......
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