How to use setmin method in pyatom

Best Python code snippet using pyatom_python

i13.py

Source:i13.py Github

copy

Full Screen

...26 ''' set motor limits for diffcalc, these are within the actual motor limits27 '''28 print("set_default_limits....")29 setmax(delta, 90)30 setmin(delta, -1)31 setmin(gam, 0)32 setmax(gam, 90)33 setmin(eta, -90)34 setmax(eta, 90)35 setmin(chi, -10)36 setmax(chi, 100)37 setmin(phi, -88)38 setmax(phi, 88)39 #setcut(phi, -90)40 41if '_fivec' in globals() and 'en' in globals():42 # Assume we are running in a live GDA deployment with a _fivec ScannableGroup43 # with axes named: delta, gam, eta, chi, phi.44 # Ensure that these five Scannables exist.45 # There must also be Scannable en for moving and reading the energy46 print "Diffcalc using predefined _fivec and en Scannables"47else:48 ### Create dummy scannables ###49 print "Diffcalc creating dummy Scannables as _fivec and en were not found"50 delta = Dummy('delta')51 gam = Dummy('gam')52 eta = Dummy('eta')53 chi = Dummy('chi')54 phi = Dummy('phi')55 _fivec = ScannableGroup('_fivec', (delta, gam, eta, chi, phi))56 if not ('en' in globals()):57 print "Diffcalc creating dummy Scannables as en was not found"58 en = Dummy('en')59 en.level = 360 #set_default_limits()61### Configure and import diffcalc objects ###62ESMTGKeV = 163settings.hardware = ScannableHardwareAdapter(_fivec, en, ESMTGKeV)64beamline_axes_transform = matrix([[0, 0, 1],[1, 0, 0], [0, 1, 0,]])65settings.geometry = FiveCircleI13(beamline_axes_transform=beamline_axes_transform)66settings.energy_scannable = en67settings.axes_scannable_group = _fivec68settings.energy_scannable_multiplier_to_get_KeV = ESMTGKeV69from diffcalc.gdasupport.you import * # @UnusedWildImport70if GDA:71 print "Running in GDA --- aliasing commands"72 alias_commands(globals())73 74 75# Load the last ub calculation used 76# lastub()77# 78# setmax(delta, 28)79# setmin(delta, -1)80# setmin(gam, 0)81# setmax(gam, 16)82# setmin(eta, -10)83# setmax(eta, 10)84# setmin(chi, 90 - 12)85# setmax(chi, 90 + 12)86# setmin(phi, -88)87# setmax(phi, 88)88# setcut(phi, -90)89# hardware()90if not GDA:91 setmax(delta, 90)92 setmin(delta, -1)93 setmin(gam, 0)94 setmax(gam, 90)95 setmin(eta, -90)96 setmax(eta, 90)97 setmin(chi, -10)98 setmax(chi, 100)99 setmin(phi, -88)100 setmax(phi, 88)101 setcut(phi, -90)102hardware()103#def X(th_deg):104# return x_rotation(th_deg * TORAD)105#106#107#def Y(th_deg):108# return y_rotation(th_deg * TORAD)109# 110#111#def Z(th_deg):112# return z_rotation(th_deg * TORAD)113#...

Full Screen

Full Screen

Euler_060.py

Source:Euler_060.py Github

copy

Full Screen

1# Problem 602def getPrimes(n):3 primeArray = [0,0] + [1] * (n-1)4 for pos in range(2, int(n ** 0.5)+1):5 if primeArray[pos] == 1:6 testNum = pos * 27 while testNum < n + 1:8 primeArray[testNum] = 09 testNum += pos10 primes = []11 for pos in range(2,n+1):12 if primeArray[pos] == 1:13 primes.append(pos)14 return primes15def concatTest(prime_1, prime_2, primesArr, primesDict):16 test_1 = int(str(prime_1)+str(prime_2))17 test_2 = int(str(prime_2)+str(prime_1))18 if isPrime(test_1,primesArr,primesDict) and isPrime(test_2,primesArr,primesDict):19 return True20 return False21def isPrime(testNum,primesArr,primesDict):22 if testNum < limit:23 return testNum in primesDict24 if testNum in bigPrimesDict:25 return True26 breakNum = testNum ** 0.527 for prime in primesArr:28 if testNum % prime == 0:29 return False30 elif prime > breakNum:31 bigPrimesDict[testNum] = None32 return True33 return True34 35import time36start = time.time()37print("This will take ~25 seconds")38# Find Primes39limit = 10_000_00040primesArr = getPrimes(limit)41primesDict = {}42bigPrimesDict = {}43for prime in primesArr:44 primesDict[prime] = None 45print(f'Step 1: found primes below {limit} in {time.time() - start} seconds\n')46setMin = 10 ** 2547rangy = 125048for a in range(rangy):49 if primesArr[a] > setMin / 5:50 break51 for b in range(a+1,rangy):52 if primesArr[b] > (setMin - primesArr[a]) / 4:53 break54 55 elif concatTest(primesArr[a], primesArr[b], primesArr, primesDict) == False:56 continue57 58 for c in range(b+1,rangy):59 if primesArr[c] > (setMin - (primesArr[a] + primesArr[b])) / 3:60 break61 if concatTest(primesArr[a], primesArr[c], primesArr, primesDict) == False:62 continue63 elif concatTest(primesArr[b], primesArr[c], primesArr, primesDict) == False:64 continue65 66 for d in range(c+1,rangy):67 if primesArr[d] > (setMin - (primesArr[a] + primesArr[b] + primesArr[c])) / 2:68 break69 if concatTest(primesArr[a], primesArr[d], primesArr, primesDict) == False:70 continue71 elif concatTest(primesArr[b], primesArr[d], primesArr, primesDict) == False:72 continue73 elif concatTest(primesArr[c], primesArr[d], primesArr, primesDict) == False:74 continue75 76 for e in range(d+1,rangy):77 if primesArr[e] > (setMin - (primesArr[a] + primesArr[b] + primesArr[c] + primesArr[d])):78 break79 if concatTest(primesArr[a], primesArr[e], primesArr, primesDict) == False:80 continue81 elif concatTest(primesArr[b], primesArr[e], primesArr, primesDict) == False:82 continue83 elif concatTest(primesArr[c], primesArr[e], primesArr, primesDict) == False:84 continue85 elif concatTest(primesArr[d], primesArr[e], primesArr, primesDict) == False:86 continue87 else:88 print(f'5-set of primes: {primesArr[a]}, {primesArr[b]}, {primesArr[c]}, {primesArr[d]}, {primesArr[e]}')89 sumPrimes = primesArr[a] + primesArr[b] + primesArr[c] + primesArr[d] + primesArr[e]90 if sumPrimes < setMin:91 setMin = sumPrimes92 print(f'new set_min of {setMin}')93 print(f'Time check: {time.time() - start} seconds\n')94 95 ...

Full Screen

Full Screen

placing_parentheses.py

Source:placing_parentheses.py Github

copy

Full Screen

1import re2def mini_max(i, j, operations, setMin, setMax):3 mn = float('inf')4 mx = float('-inf')5 for k in range(i, j):6 a = evalt(setMax[i][k], setMax[k+1][j], operations[k])7 b = evalt(setMax[i][k], setMin[k+1][j], operations[k])8 c = evalt(setMin[i][k], setMax[k+1][j], operations[k])9 d = evalt(setMin[i][k], setMin[k+1][j], operations[k])10 mn = min(mn, a, b, c, d)11 mx = max(mx, a, b, c, d)12 return mn, mx13def get_maximum_value(dataset):14 digits, operations = Split(dataset)15 # Fill Subsets16 setMin, setMax = init_sets(digits)17 # s[0][0], s[1][1]18 for s in range(1, len(digits)):19 for i in range(len(digits)-s):20 j = i + s21 setMin[i][j], setMax[i][j] = mini_max(i, j, operations, setMin, setMax)22 # for i in range(len(digits)-1):23 # subset[i][i+1] = evalt(subset[i][i], subset[i+1][i+1], operations[i])24 #write your code here25 return setMax[0][len(digits)-1]26def init_sets(digits):27 setMin, setMax = [ ], [ ]28 for i,v in enumerate(digits):29 ar = [0] * len(digits)30 ar[i] = v31 setMin.append(ar)32 setMax.append(list(ar))33 return setMin, setMax34def Split(data):35 digits = [int(d) for d in re.findall(r'\d+', data)]36 operations = re.findall(r'\D+', data)37 return digits, operations38# Uses python339def evalt(a, b, op):40 if op == '+':41 return a + b42 elif op == '-':43 return a - b44 elif op == '*':45 return a * b46 else:47 assert False48if __name__ == "__main__":49 dataset = input()50 #dataset = '1+5'51 #dataset = '5-8+7*4-8+9'...

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