Best Python code snippet using fMBT_python
gaussian_tools.py
Source:gaussian_tools.py
...20 return self._Energy21 @property22 def intCoords(self):23 if self._intCoords is None:24 self._intCoords = self.get_intCoords()25 return self._intCoords26 def get_Ens(self):27 energy_array = []28 for f in self.log_files:29 with GI.GaussianLogReader(f) as reader:30 parse = reader.parse("OptimizedScanEnergies")31 temp_energy_array, temp_coords = parse["OptimizedScanEnergies"]32 if np.any(energy_array):33 energy_array = np.append(energy_array, temp_energy_array)34 else:35 energy_array = copy.deepcopy(temp_energy_array)36 return energy_array37 def get_intCoords(self):38 coords = {}39 for f in self.log_files:40 with GI.GaussianLogReader(f) as reader:41 parse = reader.parse("OptimizedScanEnergies")42 temp_energy_array, temp_coords = parse["OptimizedScanEnergies"]43 if coords:44 for key in coords.keys():45 coords[key] = np.append(coords[key],temp_coords[key])46 else:47 coords = copy.deepcopy(temp_coords)48 return coords49class GLogPlotter:50 def __init__(self, files):51 self.files = files...
gaussian_tools-checkpoint.py
Source:gaussian_tools-checkpoint.py
...20 return self._Energy21 @property22 def intCoords(self):23 if self._intCoords is None:24 self._intCoords = self.get_intCoords()25 return self._intCoords26 def get_Ens(self):27 energy_array = []28 for f in self.log_files:29 with GI.GaussianLogReader(f) as reader:30 parse = reader.parse("OptimizedScanEnergies")31 temp_energy_array, temp_coords = parse["OptimizedScanEnergies"]32 if np.any(energy_array):33 energy_array = np.append(energy_array, temp_energy_array)34 else:35 energy_array = copy.deepcopy(temp_energy_array)36 return energy_array37 def get_intCoords(self):38 coords = {}39 for f in self.log_files:40 with GI.GaussianLogReader(f) as reader:41 parse = reader.parse("OptimizedScanEnergies")42 temp_energy_array, temp_coords = parse["OptimizedScanEnergies"]43 if coords:44 for key in coords.keys():45 coords[key] = np.append(coords[key],temp_coords[key])46 else:47 coords = copy.deepcopy(temp_coords)48 return coords49class GLogPlotter:50 def __init__(self, files):51 self.files = files...
matcher4fmbt.py
Source:matcher4fmbt.py
...17'''18import fmbtgti19import MatcherWrapper20def _area2searcharea(screenshot, area):21 top, left = fmbtgti._intCoords(area[:2], screenshot.size())22 bottom, right = fmbtgti._intCoords(area[2:], screenshot.size())23 return (top, left, bottom, right)24def _resultbbox2bbox(resultbbox):25 return (resultbbox.x,26 resultbbox.y,27 resultbbox.x + resultbbox.width,28 resultbbox.y + resultbbox.height)29class MatcherOcrEngine(fmbtgti.OcrEngine):30 """31 OCR engine specific parameters, can be used in all32 ...OcrText() methods:33 match (float, optional):34 minimum match score in range [0.0, 1.0].35 The default is 1.0 (exact match).36 area ((left, top, right, bottom), optional):37 search from the given area only. Left, top38 right and bottom are either absolute coordinates39 (integers) or floats in range [0.0, 1.0]. In the40 latter case they are scaled to screenshot41 dimensions. The default is (0.0, 0.0, 1.0, 1.0),42 that is, search everywhere in the screenshot.43 """44 def __init__(self, *args, **kwargs):45 fmbtgti.OcrEngine.__init__(self, *args, **kwargs)46 mconfig = MatcherWrapper.MatcherConfig(useOCR = True, useOIR = False)47 self._matcher = MatcherWrapper.Matcher(mconfig)48 def _addScreenshot(self, screenshot, **neverMindDefaults):49 self._matcher.loadImage(screenshot.filename())50 def _removeScreenshot(self, screenshot):51 self._matcher.unloadImage(screenshot.filename())52 def _findText(self, screenshot, text, match=1.0, area=(0.0, 0.0, 1.0, 1.0)):53 top, left = fmbtgti._intCoords(area[:2], screenshot.size())54 bottom, right = fmbtgti._intCoords(area[2:], screenshot.size())55 threshold = int(match*100)56 result = self._matcher.match(57 screenshot = screenshot.filename(),58 icon = text,59 threshold = threshold,60 method = "OCR",61 searcharea = _area2searcharea(screenshot, area),62 resultimage = "")63 if result.result[0]/100.0 < match:64 return []65 else:66 return [fmbtgti.GUIItem(67 "OCR text",68 _resultbbox2bbox(result.bbox[0]),...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!