How to use convert_hist method in yandex-tank

Best Python code snippet using yandex-tank

compare.py

Source:compare.py Github

copy

Full Screen

...49 return Status.INCONCLUSIVE50 # raise RuntimeError("Shouldn't happen")51 def ensure_plots(self, report_dir: Path, plot_dir: Path):52 if isinstance(self.item_a, ROOT.TH2):53 h2_a = convert_hist(self.item_a)54 h2_b = convert_hist(self.item_b)55 for proj in [0, 1]:56 h1_a = h2_a.project(proj)57 h1_b = h2_b.project(proj)58 fig, _ = plot_ratio(h1_a, h1_b)59 elif isinstance(self.item_a, ROOT.TEfficiency):60 a, a_err = convert_hist(self.item_a)61 b, b_err = convert_hist(self.item_b)62 lowest = 063 nonzero = numpy.concatenate(64 [a.values()[a.values() > 0], b.values()[b.values() > 0]]65 )66 if len(nonzero) > 0:67 lowest = numpy.min(nonzero)68 fig, (ax, rax) = plot_ratio_eff(a, a_err, b, b_err)69 ax.set_ylim(bottom=lowest * 0.9)70 elif isinstance(self.item_a, ROOT.TH1):71 a = convert_hist(self.item_a)72 b = convert_hist(self.item_b)73 fig, _ = plot_ratio(a, b)74 self._generic_plots.append(plot_to_uri(fig))75 if plot_dir is not None:76 safe_key = self.key.replace("/", "_")77 fig.savefig(plot_dir / f"{safe_key}.pdf")78 @property79 def first_plot_index(self):80 for i, v in enumerate(self.checks):81 if v.plot is not None:82 return i83 @property84 def generic_plots(self) -> List[Path]:85 return self._generic_plots86@dataclass...

Full Screen

Full Screen

root_helpers.py

Source:root_helpers.py Github

copy

Full Screen

...84 name=_process_axis_title(axis.GetTitle()),85 )86 # print(ax)87 return ax88def convert_hist(item):89 if isinstance(item, ROOT.TH2):90 h = hist.Hist(91 convert_axis(item.GetXaxis()),92 convert_axis(item.GetYaxis()),93 storage=hist.storage.Weight(),94 name=_process_axis_title(item.GetTitle()),95 label=_process_axis_title(item.GetZaxis().GetTitle()),96 )97 cont, err = get_bin_content_error(item)98 h.view().value = cont99 h.view().variance = err ** 2100 return h101 elif isinstance(item, ROOT.TEfficiency):102 passed = convert_hist(item.GetPassedHistogram())103 # total = convert_hist(item.GetTotalHistogram())104 eff = passed[:]105 eff.reset()106 eff.name = _process_axis_title(item.GetTitle())107 nbins = item.GetPassedHistogram().GetNbinsX()108 values = numpy.zeros(nbins)109 error = numpy.zeros((2, nbins))110 for b in range(1, nbins + 1):111 values[b - 1] = item.GetEfficiency(b)112 # error[b - 1] = 0.5 * (113 # item.GetEfficiencyErrorUp(b) + item.GetEfficiencyErrorLow(b)114 # )115 if values[b - 1] != 0:116 error[1][b - 1] = item.GetEfficiencyErrorUp(b)117 error[0][b - 1] = item.GetEfficiencyErrorLow(b)...

Full Screen

Full Screen

直方图均衡化.py

Source:直方图均衡化.py Github

copy

Full Screen

...38 return result394041# 进行图片均衡化处理42def convert_hist(img, h, w, result):43 for i in range(h):44 for j in range(w):45 key = img[i, j]46 img[i, j] = result[key]4748 return img495051result = all_np(img, h, w)52new_image = convert_hist(img, h, w, result)5354# image2 = cv.equalizeHist(img)55# cv.imshow("new image", new_image)56# cv.imshow("new image2", image2)57# cv.waitKey(0)58# todo need confirm whether this is make by precision59# my result60# [[ 50 139 255 255 216]61# [ 88 50 139 203 139]62# [139 191 24 191 152]63# [ 88 255 88 191 24]]6465# expectation is66[ ...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run yandex-tank automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful