Median Absolute Deviation for circular data

17 views
Skip to first unread message

henri laurent

unread,
Feb 14, 2020, 3:19:26 AM2/14/20
to Warp 10 users
Hi,
I am looking for a method to measure the variability of a set of angles.
For non circular data, we have bucketizer.mad.
Could we have a bucketizer.mad.circular function the same way we have buckerizer.mean and buckerizer.mean.circular?

Thanks,

Henri

Fabien Tencé

unread,
Feb 17, 2020, 10:16:20 AM2/17/20
to Warp 10 users
Hi Henri,

If you're working with angles, or any data with a modulo applied to it, you should really "unmodulo" it before using the data. This will make most computations a lot easier, including finding the MAD on buckets. At the end of the script, you can just reapply the mod if you need to.

Here is a utility macro I use to "unmodulo" a GTS or a list thereof:
<%
SAVE 'context' STORE

[ 'gts' 'modulo' ] STORE
0 'add_val' STORE

[
$gts
<%
'mw' STORE

$mw 0 GET // Tick
$mw 4 GET -1 GET // Lat
$mw 5 GET -1 GET // Lon
$mw 6 GET -1 GET // Elev
$mw 7 GET -1 GET
$mw 7 GET 0 GET - 'diff' STORE
$diff ABS $modulo 2.0 / >
<%
$diff 0 <
<% $add_val $modulo + 'add_val' STORE %>
<% $add_val $modulo - 'add_val' STORE %>
IFTE
%>
IFT
$mw 7 GET -1 GET $add_val + // Value
%>
1 SNAPSHOTN EVAL
{ 'modulo' $modulo } DEREF
MACROMAPPER
1 0 0
]
MAP

$gts TYPEOF 'LIST' !=
<% 0 GET %>
IFT

$context RESTORE
%>

You can use it this way:
$gtsOrlgts 360 @util/unmod

Regards,
Fabien.
Reply all
Reply to author
Forward
0 new messages