Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dragoon/komodo
  • a.stevan/komodo
  • c.heme/komodo
3 results
Show changes
Commits on Source (2)
export const BIN = "./target/release/inbreeding"
export const CACHE = ($nu.home-path | path join .cache komodo inbreeding)
const FMT = {
env: "(?<env>.*)",
seed: "(?<seed>[a-zA-Z0-9]*)",
params: '(?<k>\d+)-(?<n>\d+)-(?<nb_bytes>\d+)',
timestamp: '(?<timestamp>\d+)',
strat: "(?<strategy>.*)" ,
}
export const ARG_EXPERIMENT_FORMAT = $FMT.seed + '-' + $FMT.env + '-' + $FMT.params
export const EXPERIMENT_FORMAT = $FMT.timestamp + '-' + $FMT.env + '-' + $FMT.strat + '-' + $FMT.params
export const FULL_EXPERIMENT_FORMAT = $FMT.seed + (char path_sep) + $EXPERIMENT_FORMAT
use consts.nu
use path.nu [ "remove-cache-prefix" ]
def get-seeds [] [ nothing -> list<string> ] {
$consts.CACHE | path join '*' | into glob | ls $in | get name | each { path split | last }
}
export def main [seed: int@get-seeds]: [
nothing -> table<
seed: string,
timestamp: string,
env: string,
strategy: string,
k: string,
n: string,
nb_bytes: string,
m: int,
>
] {
$consts.CACHE
| path join ($seed | into string) '*'
| into glob
| ls $in
| insert m { ls $in.name | length }
| select name m
| update name {
remove-cache-prefix
| parse --regex $consts.FULL_EXPERIMENT_FORMAT
| reject seed
}
| flatten --all name
}
use consts.nu
use path.nu [ "remove-cache-prefix" ]
use ../../.nushell error "error throw"
const ARG_EXPERIMENT_FORMAT = "{seed}-{env}-{k}-{n}-{nb_bytes}"
const EXPERIMENT_FORMAT = "{timestamp}-{env}-{strategy}-{k}-{n}-{nb_bytes}"
const FULL_EXPERIMENT_FORMAT = $"{seed}(char path_sep)($EXPERIMENT_FORMAT)"
def remove-cache-prefix []: path -> string {
str replace $"($consts.CACHE)(char path_sep)" ''
}
# return experiment names following `$ARG_EXPERIMENT_FORMAT`
def get-experiments []: nothing -> list<string> {
$consts.CACHE
......@@ -17,7 +10,7 @@ def get-experiments []: nothing -> list<string> {
| ls $in
| get name
| each { remove-cache-prefix }
| parse $FULL_EXPERIMENT_FORMAT
| parse --regex $consts.FULL_EXPERIMENT_FORMAT
| reject timestamp strategy
| each { values | str join '-' }
| uniq
......@@ -26,11 +19,11 @@ def get-experiments []: nothing -> list<string> {
export def main [
experiment: string@get-experiments,
]: nothing -> table<strategy: string, diversity: table<x: int, y: float, e: float>> {
let exp = $experiment | parse $ARG_EXPERIMENT_FORMAT | into record
let exp = $experiment | parse --regex $consts.ARG_EXPERIMENT_FORMAT | into record
if $exp == {} {
error throw {
err: "invalid experiment",
label: $"should have format '($ARG_EXPERIMENT_FORMAT)', found ($experiment)",
label: $"should have format '($consts.ARG_EXPERIMENT_FORMAT)', found ($experiment)",
span: (metadata $experiment).span,
}
}
......@@ -54,7 +47,7 @@ export def main [
$experiment_files
| select name
| insert . { get name | remove-cache-prefix | parse $EXPERIMENT_FORMAT }
| insert . { get name | remove-cache-prefix | parse --regex $consts.EXPERIMENT_FORMAT }
| flatten --all
| insert diversity {
ls $in.name
......
export use build.nu
export use run.nu
export use inspect.nu
export use load.nu
export use plot.nu
use consts.nu
export def remove-cache-prefix []: path -> string {
str replace $"($consts.CACHE)(char path_sep)" ''
}