def mutate3(child): # Add/Remove Midpoints if len(child.trail_set) > 0: choice = random.randint(0, 1) index = np.random.randint(len(child.trail_set)) trail = child.trail_set[index] if choice: # Add Midpoint spline = path_lib.paths() index = np.random.randint(trail.shape[1] - 1) new_point = [(trail[0, index] + trail[0, index + 1]) / 2, (trail[1, index] + trail[1, index + 1]) / 2] trail = list(trail).insert(index, new_point) else: if len(trail) > 2: ind = np.random.randint(1, len(trail) - 2) trail.pop(ind) else: print("No Trails (Mut3)")
def testPaths(self): acls = map(path.paths, acltree["A"]) test(acls, [["A-[-B-p", "A-]-B-q", "A-B-[-r", "]-A-B-s"], ["A-[-B-p", "A-B-q", "A-B-r", "]-A-B-s"]]) ps = map(path.paths, palmtree["A"]) test(ps, [['S-[-Ns-the', 'S-Ns-closest', 'S-Ns-thing', 'S-Ns-P-[-to', 'S-Ns-P-Ns-[-a', 'S-]-Ns-P-Ns-home', 'S-Vsb-was', 'S-N-[-a', 'S-N-string', 'S-N-hammock', 'S-N-S+-[-and', 'S-N-S+-+,', 'S-N-S+-Fa-[-Rq-when', 'S-N-S+-Fa-Ni-it', 'S-N-S+-]-Fa-Vd-rained', 'S-N-S+-+,', 'S-N-S+-Np-[-some', 'S-N-S+-Np-palm', 'S-N-S+-]-Np-fronds', 'S-N-S+-Vd-draped', 'S-N-S+-P-[-over', ']-S-N-S+-P-sticks']]) test({'hi-[-child-grandchild0':1, ']-hi-child3': 1, 'hi-child2':1, 'hi-]-child-grandchild1':1}, dct.count(path.paths(iceread.sentences('''[<sent> <#1:1:A>] hi child grandchild0 grandchild1 child2 child3'''.split('\n'))['A'][0])))
elif (x1 == 0 and y1 == 4): dir = 'r' a[4][3][0:2] = a[4][5][0:2] = a[5][4][0:2] = [0, 0] elif (x1 == 4 and y1 == 8): dir = 'd' a[3][4][0:2] = a[4][3][0:2] = a[5][4][0:2] = [0, 0] elif (x1 == 8 and y1 == 4): dir = 'l' a[3][4][0:2] = a[4][5][0:2] = a[4][3][0:2] = [0, 0] while (True): points = [] # d= tuple((destination.dest(a,s,sh,co))[0:2]) # print (d) try: d = tuple((destination.dest(a, s, sh, co))[0:2]) points = (path.paths(s, d)) except (UnboundLocalError): file = open('string.txt', 'w+') file.write('0') file.close() sh = input("Enter shape: ") co = input("Enter color: ") continue except (RecursionError): file = open('string.txt', 'w+') file.write('0') file.close() sh = input("Enter shape: ") co = input("Enter color: ") continue for i in points:
#add flag if you want to plot each fit individually parser = argparse.ArgumentParser() parser.add_argument("-g", "--graph", help="Graph the individual fits", action="store_true") args = parser.parse_args() #define how long you want to extrapolate extrapolate_time = 1.578e+7 #1/2 year #define how many processes you want to run in parallel cores = 1 #names of many files are defined here. See path.py for more detail. [description, datafolder, datalist, pre_cool_offset, post_cool_offset, calibration, sig_gaussmeter_file, sig_multimeter_file, fit_graphs, fit_file, param_fit_file] = path.paths(set_list) #define a function to be looped for each run. A run consists of multiple #files created from ramping up the current. def analyze_run(ind): print('************') #description of the run. E.g. run079_4layer_helix print(description[ind]) #check if the initial magnetic field is too large or if the calibration is #the wrong sign. See quality_check.py for more details if not quality_check.initial_quality(pre_cool_offset[ind], calibration[ind]): print('%s does not pass quality test'%(description[ind])) return
"--graph", help="Graph the individual fits", action="store_true") args = parser.parse_args() #define how long you want to extrapolate extrapolate_time = 1.578e+7 #1/2 year #define how many processes you want to run in parallel cores = 1 #names of many files are defined here. See path.py for more detail. [ description, datafolder, datalist, pre_cool_offset, post_cool_offset, calibration, sig_gaussmeter_file, sig_multimeter_file, fit_graphs, fit_file, param_fit_file ] = path.paths(set_list) #define a function to be looped for each run. A run consists of multiple #files created from ramping up the current. def analyze_run(ind): print('************') #description of the run. E.g. run079_4layer_helix print(description[ind]) #check if the initial magnetic field is too large or if the calibration is #the wrong sign. See quality_check.py for more details if not quality_check.initial_quality(pre_cool_offset[ind], calibration[ind]): print('%s does not pass quality test' % (description[ind]))
cores = 1 # names of many files are defined here. See path.py for more detail. [ description, datafolder, datalist, pre_cool_offset, post_cool_offset, calibration, sig_gaussmeter_file, sig_multimeter_file, fit_graphs, fit_file, param_fit_file, ] = path.paths(set_list) # define a function to be looped for each run. A run consists of multiple # files created from ramping up the current. def analyze_run(ind): print("************") # description of the run. E.g. run079_4layer_helix print(description[ind]) # check if the initial magnetic field is too large or if the calibration is # the wrong sign. See quality_check.py for more details if not quality_check.initial_quality(pre_cool_offset[ind], calibration[ind]): print("%s does not pass quality test" % (description[ind])) return