Skip to content
Snippets Groups Projects
Commit 11e692fe authored by Joris van Zwieten's avatar Joris van Zwieten
Browse files

Task #2654: Inverse ME now built using the phase center (PHASE_DIR) of the...

Task #2654: Inverse ME now built using the phase center (PHASE_DIR) of the observation if no sources are selected.
parent df25e741
No related branches found
No related tags found
No related merge requests found
...@@ -377,16 +377,12 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB, ...@@ -377,16 +377,12 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB,
if(haveDDE) if(haveDDE)
{ {
// Position of interest on the sky (given as patch name). // Position of interest on the sky (given as patch name).
if(config.getSources().size() != 1) if(config.getSources().size() > 1)
{ {
THROW(BBSKernelException, "No patch, or more than one patch" THROW(BBSKernelException, "Multiple patches selected, yet a"
" selected, yet corrections can only be applied for a single" " correction can only be applied for a single direction on the"
" direction on the sky"); " sky.");
} }
const string &patch = config.getSources().front();
PatchExprBase::Ptr exprPatch = makePatchExpr(patch,
buffer->getPhaseReference(), sourceDB, buffers);
// Beam reference position on the sky. // Beam reference position on the sky.
Expr<Vector<2> >::Ptr exprRefDelay = Expr<Vector<2> >::Ptr exprRefDelay =
...@@ -400,10 +396,6 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB, ...@@ -400,10 +396,6 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB,
Expr<Vector<3> >::Ptr exprRefTileITRF = Expr<Vector<3> >::Ptr exprRefTileITRF =
makeITRFExpr(instrument->position(), exprRefTile); makeITRFExpr(instrument->position(), exprRefTile);
// Patch position (ITRF direction vector).
Expr<Vector<3> >::Ptr exprPatchPositionITRF =
makeITRFExpr(instrument->position(), exprPatch->position());
HamakerBeamCoeff coeffLBA, coeffHBA; HamakerBeamCoeff coeffLBA, coeffHBA;
if(config.useBeam()) if(config.useBeam())
{ {
...@@ -427,54 +419,114 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB, ...@@ -427,54 +419,114 @@ void MeasurementExprLOFAR::makeInverseExpr(SourceDB &sourceDB,
IonosphereExpr::create(config.getIonosphereConfig(), itsScope); IonosphereExpr::create(config.getIonosphereConfig(), itsScope);
} }
for(size_t i = 0; i < stationExpr.size(); ++i) if(config.getSources().empty())
{ {
// Directional gain. LOG_DEBUG_STR("Applying a correction for the phase reference of the"
if(config.useDirectionalGain()) " observation.");
{
stationExpr[i] = compose(stationExpr[i],
makeDirectionalGainExpr(itsScope, instrument->station(i),
patch, config.usePhasors()));
}
// Beam. if(config.useDirectionalGain() || config.useDirectionalTEC()
if(config.useBeam()) || config.useFaradayRotation())
{ {
stationExpr[i] = compose(stationExpr[i], THROW(BBSKernelException, "Cannot correct for DirectionalGain,"
makeBeamExpr(itsScope, instrument->station(i), " DirectionalTEC, and/or FaradayRotation when correcting"
buffer->getReferenceFreq(), exprPatchPositionITRF, " for the (unnamed) phase reference direction.");
exprRefDelayITRF, exprRefTileITRF, config.getBeamConfig(),
coeffLBA, coeffHBA));
} }
// Directional TEC. // Phase reference position on the sky.
if(config.useDirectionalTEC()) Expr<Vector<2> >::Ptr exprRefPhase =
{ makeDirectionExpr(buffer->getPhaseReference());
stationExpr[i] = compose(stationExpr[i], Expr<Vector<3> >::Ptr exprRefPhaseITRF =
makeDirectionalTECExpr(itsScope, instrument->station(i), makeITRFExpr(instrument->position(), exprRefPhase);
patch));
}
// Faraday rotation. for(size_t i = 0; i < stationExpr.size(); ++i)
if(config.useFaradayRotation())
{ {
stationExpr[i] = compose(stationExpr[i], // Beam.
makeFaradayRotationExpr(itsScope, instrument->station(i), if(config.useBeam())
patch)); {
stationExpr[i] = compose(stationExpr[i],
makeBeamExpr(itsScope, instrument->station(i),
buffer->getReferenceFreq(), exprRefPhaseITRF,
exprRefDelayITRF, exprRefTileITRF,
config.getBeamConfig(), coeffLBA, coeffHBA));
}
// Ionosphere.
if(config.useIonosphere())
{
// Create an AZ, EL expression for the phase reference
// direction.
Expr<Vector<2> >::Ptr exprAzEl =
makeAzElExpr(instrument->station(i)->position(),
exprRefPhase);
stationExpr[i] = compose(stationExpr[i],
makeIonosphereExpr(itsScope, instrument->station(i),
instrument->position(), exprAzEl, exprIonosphere));
}
} }
}
else
{
const string &patch = config.getSources().front();
LOG_DEBUG_STR("Applying a correction for the centroid of patch: "
<< patch);
// Ionosphere. PatchExprBase::Ptr exprPatch = makePatchExpr(patch,
if(config.useIonosphere()) buffer->getPhaseReference(), sourceDB, buffers);
{
// Create an AZ, EL expression for the centroid direction of the
// patch.
Expr<Vector<2> >::Ptr exprAzEl =
makeAzElExpr(instrument->station(i)->position(),
exprPatch->position());
stationExpr[i] = compose(stationExpr[i], // Patch position (ITRF direction vector).
makeIonosphereExpr(itsScope, instrument->station(i), Expr<Vector<3> >::Ptr exprPatchPositionITRF =
instrument->position(), exprAzEl, exprIonosphere)); makeITRFExpr(instrument->position(), exprPatch->position());
for(size_t i = 0; i < stationExpr.size(); ++i)
{
// Directional gain.
if(config.useDirectionalGain())
{
stationExpr[i] = compose(stationExpr[i],
makeDirectionalGainExpr(itsScope,
instrument->station(i), patch, config.usePhasors()));
}
// Beam.
if(config.useBeam())
{
stationExpr[i] = compose(stationExpr[i],
makeBeamExpr(itsScope, instrument->station(i),
buffer->getReferenceFreq(), exprPatchPositionITRF,
exprRefDelayITRF, exprRefTileITRF,
config.getBeamConfig(), coeffLBA, coeffHBA));
}
// Directional TEC.
if(config.useDirectionalTEC())
{
stationExpr[i] = compose(stationExpr[i],
makeDirectionalTECExpr(itsScope, instrument->station(i),
patch));
}
// Faraday rotation.
if(config.useFaradayRotation())
{
stationExpr[i] = compose(stationExpr[i],
makeFaradayRotationExpr(itsScope,
instrument->station(i), patch));
}
// Ionosphere.
if(config.useIonosphere())
{
// Create an AZ, EL expression for the centroid direction of
// the patch.
Expr<Vector<2> >::Ptr exprAzEl =
makeAzElExpr(instrument->station(i)->position(),
exprPatch->position());
stationExpr[i] = compose(stationExpr[i],
makeIonosphereExpr(itsScope, instrument->station(i),
instrument->position(), exprAzEl, exprIonosphere));
}
} }
} }
} }
......
...@@ -111,15 +111,12 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers, ...@@ -111,15 +111,12 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers,
|| config.useIonosphere()) || config.useIonosphere())
{ {
// Position of interest on the sky (given as patch name). // Position of interest on the sky (given as patch name).
if(config.getSources().size() != 1) if(config.getSources().size() > 1)
{ {
THROW(BBSKernelException, "No patch, or more than one patch" THROW(BBSKernelException, "Multiple patches selected, yet a"
" selected, yet corrections can only be applied for a single" " correction can only be applied for a single direction on the"
" direction on the sky"); " sky.");
} }
string patch = config.getSources().front();
PatchExprBase::Ptr exprPatch = makePatchExpr(patch, refPhase, sourceDB,
buffers);
// Beam reference position on the sky. // Beam reference position on the sky.
Expr<Vector<2> >::Ptr exprRefDelay = makeDirectionExpr(refDelay); Expr<Vector<2> >::Ptr exprRefDelay = makeDirectionExpr(refDelay);
...@@ -131,10 +128,6 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers, ...@@ -131,10 +128,6 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers,
Expr<Vector<3> >::Ptr exprRefTileITRF = Expr<Vector<3> >::Ptr exprRefTileITRF =
makeITRFExpr(instrument->position(), exprRefTile); makeITRFExpr(instrument->position(), exprRefTile);
// Patch position (ITRF direction vector).
Expr<Vector<3> >::Ptr exprPatchPositionITRF =
makeITRFExpr(instrument->position(), exprPatch->position());
HamakerBeamCoeff coeffLBA, coeffHBA; HamakerBeamCoeff coeffLBA, coeffHBA;
if(config.useBeam()) if(config.useBeam())
{ {
...@@ -158,54 +151,113 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers, ...@@ -158,54 +151,113 @@ void StationExprLOFAR::initialize(SourceDB &sourceDB, const BufferMap &buffers,
IonosphereExpr::create(config.getIonosphereConfig(), itsScope); IonosphereExpr::create(config.getIonosphereConfig(), itsScope);
} }
for(size_t i = 0; i < itsExpr.size(); ++i) if(config.getSources().empty())
{ {
// Directional gain. LOG_DEBUG_STR("Applying a correction for the phase reference of the"
if(config.useDirectionalGain()) " observation.");
{
itsExpr[i] = compose(itsExpr[i],
makeDirectionalGainExpr(itsScope, instrument->station(i),
patch, config.usePhasors()));
}
// Beam. if(config.useDirectionalGain() || config.useDirectionalTEC()
if(config.useBeam()) || config.useFaradayRotation())
{ {
// Create beam expression. THROW(BBSKernelException, "Cannot correct for DirectionalGain,"
itsExpr[i] = compose(itsExpr[i], " DirectionalTEC, and/or FaradayRotation when correcting"
makeBeamExpr(itsScope, instrument->station(i), refFreq, " for the (unnamed) phase reference direction.");
exprPatchPositionITRF, exprRefDelayITRF, exprRefTileITRF,
config.getBeamConfig(), coeffLBA, coeffHBA));
} }
// Directional TEC. // Phase reference position on the sky.
if(config.useDirectionalTEC()) Expr<Vector<2> >::Ptr exprRefPhase = makeDirectionExpr(refPhase);
{ Expr<Vector<3> >::Ptr exprRefPhaseITRF =
itsExpr[i] = compose(itsExpr[i], makeITRFExpr(instrument->position(), exprRefPhase);
makeDirectionalTECExpr(itsScope, instrument->station(i),
patch));
}
// Faraday rotation. for(size_t i = 0; i < itsExpr.size(); ++i)
if(config.useFaradayRotation())
{ {
itsExpr[i] = compose(itsExpr[i], // Beam.
makeFaradayRotationExpr(itsScope, instrument->station(i), if(config.useBeam())
patch)); {
itsExpr[i] = compose(itsExpr[i],
makeBeamExpr(itsScope, instrument->station(i),
refFreq, exprRefPhaseITRF, exprRefDelayITRF,
exprRefTileITRF, config.getBeamConfig(), coeffLBA,
coeffHBA));
}
// Ionosphere.
if(config.useIonosphere())
{
// Create an AZ, EL expression for the phase reference
// direction.
Expr<Vector<2> >::Ptr exprAzEl =
makeAzElExpr(instrument->station(i)->position(),
exprRefPhase);
itsExpr[i] = compose(itsExpr[i],
makeIonosphereExpr(itsScope, instrument->station(i),
instrument->position(), exprAzEl, exprIonosphere));
}
} }
}
else
{
const string &patch = config.getSources().front();
LOG_DEBUG_STR("Applying a correction for the centroid of patch: "
<< patch);
PatchExprBase::Ptr exprPatch = makePatchExpr(patch, refPhase,
sourceDB, buffers);
// Patch position (ITRF direction vector).
Expr<Vector<3> >::Ptr exprPatchPositionITRF =
makeITRFExpr(instrument->position(), exprPatch->position());
// Ionosphere. for(size_t i = 0; i < itsExpr.size(); ++i)
if(config.useIonosphere())
{ {
// Create an AZ, EL expression per station for the centroid // Directional gain.
// direction of the patch. if(config.useDirectionalGain())
Expr<Vector<2> >::Ptr exprAzEl = {
makeAzElExpr(instrument->station(i)->position(), itsExpr[i] = compose(itsExpr[i],
exprPatch->position()); makeDirectionalGainExpr(itsScope,
instrument->station(i), patch, config.usePhasors()));
itsExpr[i] = compose(itsExpr[i], }
makeIonosphereExpr(itsScope, instrument->station(i),
instrument->position(), exprAzEl, exprIonosphere)); // Beam.
if(config.useBeam())
{
itsExpr[i] = compose(itsExpr[i],
makeBeamExpr(itsScope, instrument->station(i), refFreq,
exprPatchPositionITRF, exprRefDelayITRF,
exprRefTileITRF, config.getBeamConfig(), coeffLBA,
coeffHBA));
}
// Directional TEC.
if(config.useDirectionalTEC())
{
itsExpr[i] = compose(itsExpr[i],
makeDirectionalTECExpr(itsScope, instrument->station(i),
patch));
}
// Faraday rotation.
if(config.useFaradayRotation())
{
itsExpr[i] = compose(itsExpr[i],
makeFaradayRotationExpr(itsScope,
instrument->station(i), patch));
}
// Ionosphere.
if(config.useIonosphere())
{
// Create an AZ, EL expression for the centroid direction of
// the patch.
Expr<Vector<2> >::Ptr exprAzEl =
makeAzElExpr(instrument->station(i)->position(),
exprPatch->position());
itsExpr[i] = compose(itsExpr[i],
makeIonosphereExpr(itsScope, instrument->station(i),
instrument->position(), exprAzEl, exprIonosphere));
}
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment