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

C implementation of "salt-and-pepper" removal procedure #9

Open pasha-ponomarenko opened 7 years ago

pasha-ponomarenko commented 7 years ago

The original implementation of FITACF3 produces a seemingly excessive amount of "grainy" echoes in low-power ground scatter (e.g. above range gate 50 in the velocity plot below):

image

I found out that this is related to increased phase fluctuation level leading to sporadic "false alarms" triggering phase unwrapping and generating velocity values at+-500 m/s. In order to fix this, I tested several procedures and ended up with a simple comparison of fitting errors for "unwrapped" and "wrapped" (unmodified) ACF phase. Whose error is smaller, that fit wins. In this way the genuine high-speed echoes remain intact while those artificially "unwrapped" are re-set to statistically more accurate values. An IDL implementation of this procedure seems to work OK on my laptop:

image

However, when Keith implemented it in C and added to FITACF3, it did only a half of the job:

image

It looks like the fitting errors in the C code have not been calculated in the same way as in its IDL version, but I have no tools to look at those generated by the C version, so it would be good to add some diagnostics allowing to do that.

kkotyk commented 7 years ago

Do a git pull on the fix_unwrap branch and make. When you run make fit, just add an additional line to redirect stderr to file since thats where I have the errors being printed: bin/make_fit -new 20131004.0401.00.rkn.rawacf >/dev/null 2> errors.txt for example

pasha-ponomarenko commented 7 years ago

The error file is empty for some reason. Do I need to uncomment some lines in fitacfoplevel.c?

kkotyk commented 7 years ago

Try do a pull on that branch again. My put in my password wrong and failed the push.

pasha-ponomarenko commented 7 years ago

Thanks, it worked!

pasha-ponomarenko commented 7 years ago

Surprisingly (or maybe not so surprisingly?) the original fix_unwrap code shows many more sporadic velocities than the one you played with on my Linux machine, although on the surface they look identical... I am not too sure what to make out of it.

kkotyk commented 7 years ago

Probably an uninitialized variable or something. Will find it on monday.

pasha-ponomarenko commented 7 years ago

Maybe. Is Monday a working day?

kkotyk commented 7 years ago

Yes it is