How to use name_scheme method in avocado

Best Python code snippet using avocado_python

variables_baptism.py

Source:variables_baptism.py Github

copy

Full Screen

...39 if list_of_names is None:40 list_of_names = [prop_obj.lean_data["name"] for prop_obj in PO.ProofStatePO.context_dict.values()]41 good_name = None42 if not hasattr(math_type, name_scheme):43 init_name_scheme(math_type, list_of_names)44 while good_name is None:45 for name in math_type.name_scheme:46 if name not in list_of_names:47 good_name = name48 math_type.name_scheme.remove(name)49 init_name_scheme(math_type, list_of_names)50 return good_name51def init_name_scheme(math_type: PO.PropObj, list_of_names: list, name_prescheme=None):52 """53 determine a list of variable names and attribute it to math_type.name_scheme54 the main sheme is the following:55 first determine the base letter, and second add a decoration (prime or index or nothing)56 - for elements (ie the type of math_type is "Type"), if there is a hint_set which is an upper case letter,57 the base letter is the corresponding lower case letter58 if there is no variable of type math_type, then choose the name according to59 :param math_type: a mathematical type60 :param list_of_names: the list of all current variables61 :param name_prescheme: a hint for naming new variables62 name_prescheme, if not None, is a list of strings of one of the following form:63 - a letter of the latin alphabet, in lower or upper case ;64 - a letter followed by "-", meaning all letters starting from the given one in the alphabetic order65 - an interval of letters, e.g. "[a-e]" or "[A-E]"...

Full Screen

Full Screen

gpu_lists.py

Source:gpu_lists.py Github

copy

Full Screen

1def get_nvidia_gtx_gpu():2 name_scheme = {"prefix": "gtx",3 "generation_max": 10,4 "perf_tier_max": 8,5 "revision": 0,6 "suffix": "Ti", }7 gpus = []8 listing = True9 generation = 510 while listing:11 if generation == (name_scheme["generation_max"]+6):12 listing = False1314 perf_tier = 515 while perf_tier <= name_scheme["perf_tier_max"]:16 if generation == 8:17 break18 elif generation == 16:19 if perf_tier > 6:20 break2122 suffix = 023 series = "{} {}{}{}".format(name_scheme["prefix"], generation, perf_tier, name_scheme["revision"])24 gpus.append(series)25 suffix += 1 26 if suffix == 1:27 series = "{} {}{}{} {}".format(name_scheme["prefix"], generation, perf_tier, name_scheme["revision"], name_scheme["suffix"])28 gpus.append(series)29 perf_tier += 130 generation += 131 if generation > name_scheme["generation_max"]:32 generation = 163334 return gpus353637def get_nvidia_rtx_gpu():38 name_scheme = {"prefix": "rtx",39 "generation_min": 20,40 "generation_max": 30,41 "perf_tier_min": 6,42 "perf_tier_max": 9, 43 "revision": 0,44 "suffix": "Ti"}45 gpus = []46 listing = True47 generation = name_scheme["generation_min"]48 while listing:49 perf_tier = name_scheme["perf_tier_min"]5051 while perf_tier <= name_scheme["perf_tier_max"]:52 53 if perf_tier == name_scheme["perf_tier_max"] and generation == name_scheme["generation_min"]:54 break55 56 if perf_tier == name_scheme["perf_tier_max"]:57 series = "{} {}{}{}".format(name_scheme["prefix"], generation, perf_tier, name_scheme["revision"])58 gpus.append(series)59 else:60 series = "{} {}{}{}".format(name_scheme["prefix"], generation, perf_tier, name_scheme["revision"])61 gpus.append(series)62 series = "{} {}{}{} {}".format(name_scheme["prefix"], generation, perf_tier, name_scheme["revision"], name_scheme["suffix"])63 gpus.append(series)64 perf_tier += 16566 generation += 106768 if generation > name_scheme["generation_max"]:69 listing = False7071 return gpus727374def get_amd_gpu():75 amd = [76 "rx 460","rx 470", "rx 480", 77 "rx 550", "rx 560", "rx 570", "rx 580",78 "rx 5500", "rx 5500 xt", "rx 5600", "rx 5600 xt", "rx 5700", "rx 5700 xt",79 "rx 6600", "rx 6600 xt", "rx 6700 xt", "rx 6800", "rx 6800 xt", "rx 6900 xt" 80 ]81 82 return amd83 84858687if __name__ == '__main__':88 gpu_lists = []89 nvidia_gtx = get_nvidia_gtx_gpu()90 nvidia_rtx = get_nvidia_rtx_gpu()91 ...

Full Screen

Full Screen

solver.py

Source:solver.py Github

copy

Full Screen

1import numpy as np2import matplotlib.pyplot as plt3from .utils import create_dir4class ODESim:5 def __init__(self, times, schemes, model, init_value, fig_dir=None):6 # Time related variables7 self.times = times8 self.ntimes = len(times)9 self.dt = times[1] - times[0]10 # Model and schemes11 self.model = model12 self.schemes = schemes13 self.nschemes = len(schemes)14 # variable of interest15 self.v = np.zeros((self.nschemes, self.ntimes, self.model.nd))16 self.v0 = init_value17 # Figures directory18 if not fig_dir is None:19 self.fig_dir = f'figures/{fig_dir}/'20 create_dir(self.fig_dir)21 22 def forwardEuler(self, v):23 """ Use model to apply forward Euler scheme """24 v[0] = self.v025 for i in range(1, self.ntimes):26 v[i] = v[i - 1] + self.dt * self.model.f(v[i - 1], self.times[i - 1])27 28 def midpoint(self, v):29 """ Use model to apply midpoint formula """30 v[0] = self.v031 v[1] = v[0] + self.dt * self.model.f(v[0], self.times[0])32 for i in range(2, self.ntimes):33 v[i] = v[i - 2] + 2 * self.dt * self.model.f(v[i - 1], self.times[i - 1])34 35 def multi_step2(self, v):36 """ Most accurate explicit 2multistep method """37 v[0] = self.v038 v[1] = v[0] + self.dt * self.model.f(v[0], self.times[0])39 for i in range(2, self.ntimes):40 v[i] = - 4 * v[i - 1] + 5 * v[i - 1] + self.dt * \41 (4 * self.model.f(v[i - 1], self.times[i - 1]) + 2 * self.model.f(v[i - 2], self.times[i - 2]))42 43 def backwardEuler(self, v):44 """ Only works with stiff problem for now """45 v[0] = self.v046 for i in range(1, self.ntimes):47 v[i] = self.model.fbackwardEuler(v[i - 1], self.times[i - 1], self.dt)48 49 def trapezoidal(self, v):50 """ Only works with nonlinear problem for now """51 v[0] = self.v052 for i in range(1, self.ntimes):53 v[i] = self.model.ftrapez(v[i - 1], self.times[i - 1], self.dt)54 print(v.shape)55 56 def run_schemes(self):57 """ Apply scheme and plot the results """58 for i_scheme, name_scheme in enumerate(self.schemes):59 scheme = getattr(self, name_scheme)60 scheme(self.v[i_scheme, :])61 62 def plot(self, figname=None):63 for i_scheme, name_scheme in enumerate(self.schemes):64 if figname is None:65 self.model.plot(self.times, self.v[i_scheme, :], f'{name_scheme} - dt = {self.dt:.2e}', self.fig_dir + name_scheme)66 else:...

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 avocado 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