diff --git a/bins/inbreeding/load.nu b/bins/inbreeding/load.nu index 7f79a9498232fbf2b7e31286756d9b7c5a88f730..b0437ca6fdfe4fc3d51d5bc2428944a4ff83bc13 100644 --- a/bins/inbreeding/load.nu +++ b/bins/inbreeding/load.nu @@ -13,7 +13,7 @@ def get-experiments []: nothing -> list<string> { export def main [ experiment: string@get-experiments, # something of the form '<seed>-<env>' -]: nothing -> table<strategy: string, diversity: table<x: int, y: float>> { +]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> { let exp = $experiment | parse "{seed}-{env}" | into record if $exp == {} { error throw { @@ -46,8 +46,10 @@ export def main [ | parse "{x}, {y}" | into float y | group-by x --to-table - | update items { get y | math avg } - | rename --column { group: "x", items: "y" } + | insert y { get items.y | math avg } + | insert e { get items.y | math stddev } + | rename --column { group: "x" } + | reject items | into int x # NOTE: $.x needs to be converted to int here because # `group-by --to-table` converts the grouping key to # string diff --git a/bins/inbreeding/plot.nu b/bins/inbreeding/plot.nu index 11ca0f71adf6eaa0223c2094ce10a55bc0958169..cd2bcddf0ca12001e3268e33d4a1161202c17b52 100644 --- a/bins/inbreeding/plot.nu +++ b/bins/inbreeding/plot.nu @@ -43,7 +43,7 @@ def get-color []: int -> string { export def main [ --save: path, --options: record<k: int> -]: table<strategy: string, diversity: table<x: int, y: float>> -> nothing { +]: table<strategy: string, diversity: table<x: int, y: float, e: float>> -> nothing { let data = $in let l = $data.diversity.0 | length @@ -71,10 +71,6 @@ export def main [ "double" => $"($it.strategy.p)? ($it.strategy.n) ; ($it.strategy.m)" } } - | update diversity {|it| - let l = $it.diversity | length - $it.diversity | insert e 0 | rename --column { t: "x", diversity: "y" } - } | rename --column { diversity: "points" } | insert style {|it| let color = match $it.strategy.type {