From 3925e277862ee69b158598a497a05d2f562e2aa1 Mon Sep 17 00:00:00 2001 From: "a.stevan" <antoine.stevan@isae-supaero.fr> Date: Fri, 31 May 2024 09:30:57 +0200 Subject: [PATCH] add `inbreeding list` --- bins/inbreeding/list.nu | 16 ++++++++++++++++ bins/inbreeding/load.nu | 16 ++-------------- bins/inbreeding/mod.nu | 1 + 3 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 bins/inbreeding/list.nu diff --git a/bins/inbreeding/list.nu b/bins/inbreeding/list.nu new file mode 100644 index 00000000..208b541a --- /dev/null +++ b/bins/inbreeding/list.nu @@ -0,0 +1,16 @@ +use consts.nu +use path.nu [ "remove-cache-prefix" ] + +# return experiment names following `$ARG_EXPERIMENT_FORMAT` +export def main []: nothing -> list<string> { + $consts.CACHE + | path join '*' '*' + | into glob + | ls $in + | get name + | each { remove-cache-prefix } + | parse --regex $consts.FULL_EXPERIMENT_FORMAT + | reject strategy + | each { values | str join '-' } + | uniq +} diff --git a/bins/inbreeding/load.nu b/bins/inbreeding/load.nu index 3896ff4d..ccdbb056 100644 --- a/bins/inbreeding/load.nu +++ b/bins/inbreeding/load.nu @@ -2,22 +2,10 @@ use consts.nu use path.nu [ "remove-cache-prefix" ] use ../../.nushell error "error throw" -# return experiment names following `$ARG_EXPERIMENT_FORMAT` -def get-experiments []: nothing -> list<string> { - $consts.CACHE - | path join '*' '*' - | into glob - | ls $in - | get name - | each { remove-cache-prefix } - | parse --regex $consts.FULL_EXPERIMENT_FORMAT - | reject strategy - | each { values | str join '-' } - | uniq -} +use list.nu export def main [ - experiment: string@get-experiments, + experiment: string@list, ]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> { let exp = $experiment | parse --regex $consts.ARG_EXPERIMENT_FORMAT | into record if $exp == {} { diff --git a/bins/inbreeding/mod.nu b/bins/inbreeding/mod.nu index 4059fa7c..15e876c6 100644 --- a/bins/inbreeding/mod.nu +++ b/bins/inbreeding/mod.nu @@ -2,5 +2,6 @@ export use build.nu export use watch.nu export use run.nu export use inspect.nu +export use list.nu export use load.nu export use plot.nu -- GitLab