📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit 7a6deec3 authored by LANORE Vincent's avatar LANORE Vincent
Browse files

Changed seed calculation to use proper hash functions.

parent 705914d1
......@@ -47,15 +47,8 @@ let parse_input_data ~seed indir =
|> List.concat
let calc_fixed_seed ~(str:string) (seed:int) : int =
let str_digest = Md5.to_hex (Md5.digest_string str) in
let id = "1" ^ (Str.global_replace (Str.regexp "[^0-9]+") "" str_digest) in
let id = String.sub id 0 10 in
let id_int = float_of_int (int_of_string id) in
let id_len = float_of_int (String.length id) in
let seed_f = float_of_int seed in
let size_str_id = 10. ** id_len in
let res = Float.abs (Pervasives.(seed_f *. id_int /. size_str_id +. 1.)) in
int_of_float(res)
let str_hash = Hashtbl.hash str in
Hashtbl.hash (str_hash + seed)
let derive_from_model ~model ~input_tree ~tree_dataset ~tree_prefix ~profile ~preview ~ns ~seed =
let model_prefix = Convergence_hypothesis.string_of_model model in
......@@ -124,7 +117,6 @@ let derive_from_model ~model ~input_tree ~tree_dataset ~tree_prefix ~profile ~pr
let profile_c = profile.profile_c in
(*let seed = Random.int Int.max_value in*)
let seed = calc_fixed_seed ~str:descr seed in
printf "Bppseqgen seed: %s %s %i\n" model_prefix tree_prefix seed;
let run_fna = Bppsuite.bppseqgen_multi_profiles ~descr ~nb_sites ~tree ~config:config_p ~profile_f ~profile_c ~ne_c ~ne_a ~seed in
let fna = Bppsuite.bppseqgen_multi_profiles_get_fa run_fna in
let fna_infos = Some (Bppsuite.bppseqgen_multi_profiles_get_info run_fna) in
......@@ -257,7 +249,7 @@ let derive_from_det_meth ~det_meth ~(dataset : Dataset.t) ~preview =
let tree_conv = Tree_dataset.topological_tree dataset.dataset.tree_dataset in
let w_every = if preview then 1 else 1 in
let n_cycles = if preview then 10 else 2000 in
let seed = dataset.seed + 10 in
let seed = Hashtbl.hash dataset.seed in
match det_meth with
| `Pcoc -> `Pcoc (Pcoc.pcoc ~catx_est:10 ~plot_complete:true ~gamma:false ~faa ~tree:tree_sc)
| `Pcoc_gamma -> `Pcoc_gamma (Pcoc.pcoc ~catx_est:10 ~plot_complete: true ~gamma:true ~faa ~tree:tree_sc)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment