SuperDARNCanada / fitacf.3.0

The repo for the new and improved fitacf routine
GNU General Public License v3.0
0 stars 1 forks source link

Setting elevation as measured from lag0 phase only #4

Closed pasha-ponomarenko closed 7 years ago

pasha-ponomarenko commented 7 years ago

Under the original convention, field .normal (fit.elv in the output structure) was assigned to elevation obtained by fitting (as it is set right now) while the fields .low (fit.elv_low) and .high (fit.elv_high) were filled with lower and upper elevation boundaries estimated from adding and subtracting the phase error to and from the fitted lag 0 phase estimate.

In FITACF3 we modified the convention so that .low now contains a standard error obtained through propagation of errors from the phase fitting error and .high contains an estimate from just laf 0 cross phase.

The lag0 way proved to be as good as the conventional fitting for high SNR but provides noticeably lower fluctuations for the data with low SNR, so it makes sense to switch them around. In order to do that, just swap the fields in the code.

For consistency, it is also be necessary to replace the fitted lag 0 phase phi0 by the directly measured one in set_xcf_phi0.

kkotyk commented 7 years ago

Seems like an easy change. I will accept that you find the results correct. Does set_xcf_phi0 still need to be changed as you mentioned?

pasha-ponomarenko commented 7 years ago

Yes, because that is what we use in this case for calculating elevation: the lag 0 xcf phase.

Cheers, Pasha

Sent from my Sony Xperia™ smartphone

---- kkotyk wrote ----

Seems like an easy change. I will accept that you find the results correct. Does set_xcf_phi0 still need to be changed as you mentioned?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SuperDARNCanada/fitacf.3.0/pull/4#issuecomment-280482904, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFEZyGUq3cWRzy374dWGehEyG-XFOZRnks5rdM1SgaJpZM4MCgVA.

kkotyk commented 7 years ago

What changes need to be made to set_xcf_phi0_err?

pasha-ponomarenko commented 7 years ago

For the time being it should stay the same because right now we have no other means to estimate the phase error. For a more accurate estimate we would need to record lag0 power for the interferometer ACF, not XCF (we discussed this awhile ago).

Sent from my Sony Xperia™ smartphone

---- kkotyk wrote ----

What changes need to be made to set_xcf_phi0_err?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/SuperDARNCanada/fitacf.3.0/pull/4#issuecomment-280696353, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFEZyNFrhDxVF5R2xdYfx7o1Opswxo8mks5rdcnlgaJpZM4MCgVA.

kkotyk commented 7 years ago

When recording the measured phase for set_xcf_phi0, do we use the phase from the wrapped or unwrapped phase?

pasha-ponomarenko commented 7 years ago

Keith, if by unwrapping you mean adjusted to the interferometer base length, i.e. by adding extra phase shift of 2Pi*(base/wavelength) and keeping them within 2Pi from the maximum possible shift, as it is done in the elevation code, then "NO". These should be just raw lag0 cross-phase values calculated between -Pi and Pi so that we will be able to re-process them with corrected tdiff values if necessary.

pasha-ponomarenko commented 7 years ago

Keith, I have checked the code and found that in set_xcf_phi0 the values are still set to the fitted value

_fit_range_array[range_node->range].phi0 = range_node->elevfit->a;

rather than to the arctangent from lag 0 XCF pase, as is done in find_elevation:

_/Experiment to compare fitted and measured elevation/ real = fit_prms->xcfd[range_node->range fit_prms->mplgs][0]; imag = fit_prms->xcfd[range_node->range fit_prms->mplgs][1]; xcf0p = atan2(imag,real);

Coluld you please fix this?