Skip to content

Commit 316a5ce

Browse files
authored
margins for threshold tuning (AliceO2Group#646)
* margins for threshold tuning * removed duplicate of application of threshold margins from ReleaseValidation.C
1 parent 9c3be70 commit 316a5ce

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

RelVal/ReleaseValidation.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void fillThresholdsFromFile(std::string const& inFilepath, std::unordered_map<st
4949
template <typename T>
5050
T getThreshold(std::string const& histoName, std::string const& testName, std::unordered_map<std::string, std::vector<TestResult>> const& allThresholds, T defaultValue)
5151
{
52-
std::cerr << "Extract threshold from value for histogram " << histoName << " and test " << testName << ", with default " << defaultValue << "\n";
52+
std::cerr << "Extract threshold from value for histogram " << histoName << " and test " << testName << " and default " << defaultValue << "\n";
5353
auto const& it = allThresholds.find(histoName);
5454
if (it == allThresholds.end()) {
5555
return defaultValue;

RelVal/o2dpg_release_validation.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,17 +654,19 @@ def rel_val_sim_dirs(args):
654654
rel_val_files(in1, in2, args, current_output_dir)
655655
return 0
656656

657-
def make_new_threshold_file(json_path, out_filepath):
657+
def make_new_threshold_file(json_path, out_filepath,threshold_margins):
658658
json_in = None
659659
with open(json_path, "r") as f:
660660
json_in = json.load(f)
661661
with open(out_filepath, "w") as f:
662662
for histo_name, tests in json_in.items():
663663
for t in tests:
664-
print(t["result"])
665664
if not t["comparable"]:
666665
continue
667-
f.write(f"{histo_name},{t['test_name']},{t['value']}\n")
666+
if t["test_name"] not in REL_VAL_TEST_NAMES_MAP:
667+
continue
668+
ind = REL_VAL_TEST_NAMES_MAP[t['test_name']]
669+
f.write(f"{histo_name},{t['test_name']},{t['value']*threshold_margins[ind]}\n")
668670

669671

670672
def rel_val(args):
@@ -681,7 +683,7 @@ def rel_val(args):
681683
if not exists(args.output):
682684
makedirs(args.output)
683685
if args.use_values_as_thresholds:
684-
out_path = make_new_threshold_file(args.use_values_as_thresholds, join(args.output, "use_thresholds.dat"))
686+
out_path = make_new_threshold_file(args.use_values_as_thresholds, join(args.output, "use_thresholds.dat"),[args.chi2_threshold_margin,args.rel_mean_diff_threshold_margin,args.rel_entries_diff_threshold_margin])
685687
args.use_values_as_thresholds = join(args.output, "use_thresholds.dat")
686688
if is_sim_dir(args.input1[0]) and is_sim_dir(args.input2[0]):
687689
if not args.dir_config:
@@ -869,6 +871,9 @@ def main():
869871
rel_val_parser.add_argument("--rel-entries-diff-threshold", dest="rel_entries_diff_threshold", type=float, help="Threshold of relative difference in number of entries", default=0.01)
870872
rel_val_parser.add_argument("--select-critical", dest="select_critical", action="store_true", help="Select the critical histograms and dump to file")
871873
rel_val_parser.add_argument("--use-values-as-thresholds", dest="use_values_as_thresholds", help="Use values from another run as thresholds for this one")
874+
rel_val_parser.add_argument("--chi2-threshold-margin", dest="chi2_threshold_margin", type=float, help="Margin to apply to the chi2 threshold extracted from file", default=1.0)
875+
rel_val_parser.add_argument("--rel-mean-diff-threshold-margin", dest="rel_mean_diff_threshold_margin", type=float, help="Margin to apply to the rel_mean_diff threshold extracted from file", default=1.0)
876+
rel_val_parser.add_argument("--rel-entries-diff-threshold-margin", dest="rel_entries_diff_threshold_margin", type=float, help="Margin to apply to the rel_entries_diff threshold extracted from file", default=1.0)
872877
rel_val_parser.add_argument("--dir-config", dest="dir_config", help="What to take into account in a given directory")
873878
rel_val_parser.add_argument("--dir-config-enable", dest="dir_config_enable", nargs="*", help="only enable these top keys in your dir-config")
874879
rel_val_parser.add_argument("--dir-config-disable", dest="dir_config_disable", nargs="*", help="disable these top keys in your dir-config (precedence over dir-config-enable)")

0 commit comments

Comments
 (0)