def __init__(self): self.root = Tk() self.north = Entry(self.root) self.direction = 0 self.distance = 0 self.pen_button = Button() self.color_button = Button() self.eraser_button = Button() self.north_button = Button() self.south_button = Button() self.west_button = Button() self.east_button = Button() self.square_button = Button() self.circle_button = Button() self.triangle_button = Button() self.up = Button() self.down = Button() self.clear_canvas = Button() self.choose_size_button = Scale() self.c = Canvas() self.x = 0 self.y = 0 self.entry = 0.0 self.line_width = 1 self.button = Button() self.north = Entry() self.entry = self.north.get() self.line_width = self.choose_size_button.get() self.pen_state = True # so can be used in every mehotds. self.file = Writer("TKInterDrawer_Result.txt")
def run(self): print("[log]Generator start...") while (not globcfg.event.is_set()): print( "[log]currentRunThread: Reader= {readCount}, Writer= {writeCount}" .format(readCount=globcfg.currentRunThreadCount['Reader'], writeCount=globcfg.currentRunThreadCount['Writer'])) genterate_time = getRandomInterval(globcfg.lamGen) globcfg.generateTime_lock.acquire() globcfg.generate_time_globalCopy = genterate_time globcfg.generateTime_lock.release() globcfg.event.wait(genterate_time) choice = random.randint(0, 1) # generate a new thread if (choice): print("[log]Generate thread {number} : {name}".format( number=globcfg.threadNumber, name="Reader")) self.gui.change_state("R", globcfg.threadNumber, self.gui.nowhere, self.gui.scheduling) globcfg.waitingList.append( Reader.Reader(self.book, self.lock, globcfg.threadNumber, self.gui)) #new Reader else: print("[log]Generate thread {number} : {name}".format( number=globcfg.threadNumber, name="Writer")) self.gui.change_state("W", globcfg.threadNumber, self.gui.nowhere, self.gui.scheduling) globcfg.waitingList.append( Writer.Writer(self.book, self.lock, globcfg.threadNumber, self.gui)) #new Writer globcfg.threadNumber += 1
def WriteGmadFiles(self): """ Write the gmad files for all tests in the Tests directory. """ _os.chdir('Tests') for test in self._tests: writer = Writer.Writer() writer.WriteTests(test) if not self._testNames.__contains__(test.Component): self._testNames[test.Component] = [] self._testNames[test.Component].extend(writer._fileNamesWritten[test.Component]) _os.chdir('../')
def write(): writer = Writer() argc = len(sys.argv) if argc < 4: print("Expecting data file(s) and output paths") return False for i in range(2, argc - 1): writer.load(sys.argv[i]) writer.write(sys.argv[argc - 1]) return True
def __init__(self, fileName): self.fileName = fileName self.cfgfname = 'cfg.json' self.cfg = {} self.branches = {} self.out = Writer.Writer( os.path.join('output', fileName[:-2] + '_tranformed.ll')) # output file self.branchLabel = 0 # self.branch_blocks = {} self.isVisited = {} self.TB_st = {} self.FB_st = {} self.debug = False
def Calucalte(type1): fileOperator = Writer("Scores.txt") scores = fileOperator.readFile() scores = removeX(scores) ScoresTuples = tuplize(scores) scoresSummation = 0 unitsSummation = 0 for scoresTuple in ScoresTuples: score = scoresTuple[0] * 5 unit = scoresTuple[1] GPA = 0 if (type1 == True): if (score >= 0 and score < 60): GPA = 0 elif (score >= 60 and score < 67): GPA = 1 elif (score >= 67 and score <= 69): GPA = 1.3 elif (score >= 70 and score < 73): GPA = 1.7 elif (score >= 73 and score < 77): GPA = 2 elif (score >= 77 and score < 80): GPA = 2.3 elif (score >= 80 and score < 84): GPA = 2.7 elif (score >= 84 and score < 87): GPA = 3 elif (score >= 87 and score < 90): GPA = 3.3 elif (score >= 90 and score < 94): GPA = 3.7 elif (score >= 94 and score <= 100): GPA = 4.0 print("Normal: " + str(scoresTuple[0]) + " |Score : " + str(score) + " | Unit : " + str(unit) + " | GPA: " + str(GPA)) scoresSummation += GPA * unit unitsSummation += unit return scoresSummation/unitsSummation
class ArgumentSourceReader(AbstractSourceReader): results = Writer("SourceReader_Result.txt") def go(self): result = ArgumentParser.parse(self, '') if result == 'g': print('graphics') self.results.writeToFile("Graphics") elif result == 't': self.results.writeToFile("Running Turtle Command") TurtlePrompt().cmdloop() elif result == 'k': self.results.writeToFile("Running TKInter Drawer") TkinterDrawer().start() elif result == 'e': self.results.writeToFile("Exiting program") exit() else: self.results.writeToFile( "Graphics from else as arguments were wrong") print('graphics')
param=param, datapath=args.directory, multiopt="many") # Now read in as desired # def readDataMany(self,skip=0,step=1,howmany='all',Nvariable=False,readtypes = 'all'): Cornea.readDataMany("SAMoS", args.skip, args.step, args.howmany, True, readtypes=[1, 2]) #def __init__(self,directory,conffile,skip,howmany,ignore=True,maxtype=3): data = {'configuration': args.conffile} write = Writer() output = True nav = 0 nbin = 100 data['nbin'] = nbin data['directory'] = args.directory data['skip'] = args.skip data['howmany'] = args.howmany data['step'] = args.step data['average'] = args.average data['coneangle'] = args.coneangle # Histogram of swirling v_swirlhist = np.zeros((args.howmany - args.average, nbin))
from SettingParser import * from RecursiveScanner import * from Writer import * # Parse the setup.txt file to get its information. settingParser = SettingParser() # Recursively scan through the folder containing RobotC files (.c, .h) # to get documentation from comments recursiveScanner = RecursiveScanner(settingParser) # Write down the information gathered by recursiveScanner into BuiltInVariables.txt writer = Writer(settingParser) for scanner in recursiveScanner.scanners: writer.WriteDownFile(scanner)
vel2av = np.zeros(len(files)) phival = np.zeros(len(files)) ndensity = np.zeros(len(files)) pressure = np.zeros(len(files)) fmoment = np.zeros(len(files)) energy = np.zeros(len(files)) energytot = np.zeros(len(files)) zav = np.zeros(len(files)) u = 0 for f in files: print f # Ignore here is to simply calculate interactions of multiple types of particles (they have the same potential) conf = Configuration(params, f, True) if args.contractile: writeme = Writer(args.nematic, args.alpha) else: writeme = Writer(args.nematic) if args.writeP: outparticles = args.output + '/' + args.prefix + '%06d_particles.vtp' % u # + str(u) + '_particles.vtp' print outparticles writeme.writeConfigurationVTK(conf, outparticles) #plt.show() if args.getStatsBasic: vel2av[u], phival[u], ndensity[u], pressure[u], fmoment[u], energy[ u], energytot[u], zav[u] = conf.getStatsBasic() #vel2av[u], phival[u],pressav[u],energy[u]= conf.getStatsBasic() print "Mean square velocity: " + str(vel2av[u]) print "Packing fraction: " + str(phival[u]) print "Number density: " + str(ndensity[u]) print "Pressure: " + str(pressure[u])
class TurtlePrompt(Cmd): results = Writer("TurtleDrawer_Result.txt") welcome = "Welcome to Turtle Shell" prompt = '(turtle)' file = None def do_P(self, arg): """Select Pen: P 10""" self.results.writeToFile("Selected pen", arg) data = IntegerParser.parse(self, arg) TurtleDrawer.select_pen(self, data) def do_U(self, arg): """Pen Up : U""" self.results.writeToFile("Pen is up", arg) command = StringParser.parse(self, arg) TurtleDrawer.pen_up(command) def do_D(self, arg): """Pen Down : D""" self.results.writeToFile("Pen is down", arg) command = StringParser.parse(self, arg) TurtleDrawer.pen_down(command) def do_X(self, arg): """Go Along : X 100""" self.results.writeToFile("Go Along : X ", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.go_along(self, command) def do_Y(self, arg): """Go Down : Y 100""" self.results.writeToFile("Go Along : Y", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.go_down(self, command) def do_N(self, arg): """Draw line 0 degrees : N 100""" self.results.writeToFile("Draw line 0 degrees : N", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 0, command) def do_E(self, arg): """Draw line 90 degrees : E 100""" self.results.writeToFile("Draw line 90 degrees : E", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 90, command) def do_S(self, arg): """Draw line 120 degrees : S 100""" self.results.writeToFile("Draw line 120 degrees : S", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 180, command) def do_W(self, arg): """Draw line 270 degrees : W 100""" self.results.writeToFile("Draw line 270 degrees : W", arg) command = IntegerParser.parse(self, arg) TurtleDrawer.draw_line(self, 270, command) def do_square(self, arg): """Draw Square""" self.results.writeToFile("Drawing a square") command = IntegerParser.parse(self, arg) directions = [0, 90, 180, 270] for i in directions: TurtleDrawer.draw_line(self, i, command) def do_circle(self, arg): """Draw Circle""" self.results.writeToFile("Drawing a circle") command = IntegerParser.parse(self, arg) TurtleDrawer.draw_circle(self, command) def do_Exit(self, arg): """Exit Turtle CMD""" self.results.writeToFile("End program, Bye") print("Bye") return True
# * along with this program. If not, see <http://www.gnu.org/licenses/>. # * # ***************************************************************************** from Geometry import * from Configuration import * from Tesselation import * from Writer import * basefolder = '/home/silke/Documents/CurrentProjects/Rastko/Cells/Inke/' conffile = 'goblet.conf' filename = 'test3/goblet_test_0001100000.dat' outname = 'testing' params = Param(basefolder + conffile) conf = Configuration(params, basefolder + filename) plt.show() conf.getTangentBundle() tess = Tesselation(conf) print "initialized tesselation" LoopList, Ival, Jval = tess.findLoop() print "found loops" tess.OrderPatches() print "ordered patches" writeme = Writer() outparticles = basefolder + '/' + outname + '_particles.vtp' outdefects = basefolder + '/' + outname + '_defects.vtp' outpatches = basefolder + '/' + outname + '_patches.vtp' writeme.writePatches(tess, outpatches) writeme.writeConfigurationVTK(conf, outparticles)
epoxy.improper_labels = connect.improper_labels(epoxy.atom_labels,epoxy.impropers, epoxy.improper_types) epoxy.masses = [0] * len(epoxy.coords) #output.write_xyz('epoxy.xyz') p = Parameterise(epoxy.vdw_defs) epoxy.bond_coeffs = p.match_bonds(epoxy.bond_types) epoxy.angle_coeffs = p.match_angles(epoxy.angle_types) epoxy.torsion_coeffs = p.match_torsions(epoxy.torsion_types) epoxy.improper_coeffs = p.match_impropers(epoxy.improper_types) epoxy.pair_coeffs = p.match_pairs() epoxy.masses = p.match_masses() epoxy.charge_coeffs = p.match_charges() epoxy.atom_charges = [] for atom in epoxy.atom_labels: index = epoxy.charge_coeffs['a'].index(atom) epoxy.atom_charges += [ epoxy.charge_coeffs['q'][index] ] output = Writer(epoxy) output.write_lammps('2.data') #a = Writer(paa) #a.write_lammps()
Vim�UnDo���n��%�A�I} 4 ��wr��T�?:ƈ�iG system_info.get("full_release"), system_info.get("release")^]gY_�]����]gO�\^k( version="{} %(prog)s-{}".format(5�_�^����]gV�]_kG system_info.get("full_release"), system_info.get("release")5�_�^ ����]gW�]_k' system_info.get("release")5�_�^����]gX�k import sysfrom os import environimport argparse<from utils import CoinmineLogger, SystemHelpers, sentry_initfrom cli.cli import CoinmineCli(from minary.config import Reader, Writer sentry_init()if __name__ == "__main__":% logger = CoinmineLogger(__name__)@ minary_api_server_url = environ.get("MINARY_API_SERVER_URL"); machine_id_path = environ.get("MINARY_MACHINE_ID_PATH")3 config_path = environ.get("MINARY_CONFIG_PATH")= distro_info_path = environ.get("MINARY_DISTRO_INFO_PATH")= minary_info_path = environ.get("MINARY_MINARY_INFO_PATH")= satoshi_password = environ.get("MINARY_SATOSHI_PASSWORD")7 root_password = environ.get("MINARY_ROOT_PASSWORD")3 environment = environ.get("MINARY_ENVIRONMENT") try:$ reader = Reader(config_path) config = reader.Config except Exception: reader = None config = {} try:$ writer = Writer(config_path) except Exception: writer = None cli = CoinmineCli( minary_api_server_url, machine_id_path, config, writer, distro_info_path, minary_info_path, satoshi_password, root_password, environment, ) try:E system_info = SystemHelpers.get_distro_info(distro_info_path) except Exception: system_info = {}% parser = argparse.ArgumentParser(= formatter_class=argparse.RawDescriptionHelpFormatter,? description="""Coinmine's mineOS command line interface commands:8 coin displays the coin currently being mined> address displays the address currently being mined to. hashrate displays the current hashrateA uuid displays the unique identifier for this coinmine9 status shows full stats, use -j for json outputE register register this miner by adding the uuid to the db""", )' subparser = parser.add_subparsers() # coin. coin_parser = subparser.add_parser("coin")* coin_parser.set_defaults(which="coin") # address4 address_parser = subparser.add_parser("address")0 address_parser.set_defaults(which="address") # hashrate6 hashrate_parser = subparser.add_parser("hashrate")2 hashrate_parser.set_defaults(which="hashrate") # uuid. uuid_parser = subparser.add_parser("uuid")* uuid_parser.set_defaults(which="uuid") # status2 status_parser = subparser.add_parser("status"). status_parser.set_defaults(which="status")X status_parser.add_argument("-j", action="store_true", help="prints the json output") # stats6 register_parser = subparser.add_parser("register")2 register_parser.set_defaults(which="register") # version parser.add_argument( "--version", action="version",% version="%(prog)s-{}".format(& system_info.get("release") ),1 help="find the version number of mineOS", ) args = parser.parse_args() try: if hasattr(args, "j"):1 cli.handle_parser(args.which, args.j) else:) cli.handle_parser(args.which) except Exception as e:% print(parser.print_help(), e) sys.exit(1)5��
from ParSite import * from Writer import * if __name__ == '__main__': print("http://", input('http://')) http = ParSite() http.html_doc('http://') data = Writer() data.csv_writer(data) #data = link.get(get.html('https://33pingvina.ru'))
def __init__(self, width=1., height=1., nCellsX=2, nCellsY=2): ''' Constructor ''' self.width = width self.height = height self.nCellsX = nCellsX self.nCellsY = nCellsY self.hx = width/nCellsX # cell size in x-direction self.hy = height/nCellsY # cell size in y-direction self.time = 0.0 self.recordParticleTrace = False #self.X = outer(ones(nCellsY+1), linspace(0.0, width, nCellsX+1)) #self.Y = outer(linspace(0.0, height, nCellsY+1), ones(nCellsX+1)) x = linspace(0,width ,(nCellsX+1)) y = linspace(0,height,(nCellsY+1)) self.X, self.Y = meshgrid(x, y, indexing='xy') self.Re = 1.0 self.rho = 1.0 self.v0 = 0.0 self.motion = None self.particleUpdateScheme = ExplicitEuler() self.nodes = [ [ None for j in range(self.nCellsY+1) ] for i in range(self.nCellsX+1) ] id = -1 for i in range(nCellsX+1): for j in range(nCellsY+1): id += 1 theNode = Node(id,x[i],y[j]) theNode.setGridCoordinates(i,j) self.nodes[i][j] = theNode self.cells = [] id = -1 hx = width / nCellsX hy = height / nCellsY for i in range(nCellsX): for j in range(nCellsY): id += 1 newCell = Cell(id, hx, hy) newCell.setCellGridCoordinates(i, j) theNodes = [] theNodes.append(self.nodes[i][j]) theNodes.append(self.nodes[i+1][j]) theNodes.append(self.nodes[i+1][j+1]) theNodes.append(self.nodes[i][j+1]) newCell.SetNodes(theNodes) self.cells.append(newCell) self.setParameters(self.Re, self.rho, self.v0) self.particles = [] # set default analysis parameters self.setAnalysis(False, True, True, True, False, True, True, True) # set default plot parameters self.plotControl = {'Active':False, 'DelTime':-1 } self.plot = Plotter() self.plot.setGrid(width, height, nCellsX, nCellsY) self.lastPlot = self.time # set default output parameters self.outputControl = {'Active':False, 'DelTime':-1 } self.writer = Writer() self.writer.setGrid(width, height, nCellsX, nCellsY) self.lastWrite = self.time
defects_n_out = [] defects_v_out = [] numdefects_n_out = [] numdefects_v_out = [] for J in Jlist: for v in vlist: directory = basefolder + '/' + args.name_1 + '_' + J + '/' + args.name_2 + '_' + v + '/' conffile = 'nematic_' + args.name_1 + '_' + J + '_' + args.name_2 + '_' + v + '.conf' finput = 'nematic_' + args.name_1 + '_' + J + '_' + args.name_2 + '_' + v + '_0' print finput params = Param(directory + conffile) files = sorted(glob(directory + finput + '*.dat'))[skip:] u = 0 for f in files: conf = Configuration(params, f) writeme = Writer(nematic) if writeP: outparticles = directory + 'frame' + str(u) + '_particles.vtp' print outparticles writeme.writeConfigurationVTK(conf, outparticles) #plt.show() conf.getTangentBundle() tess = Tesselation(conf) print "initialized tesselation" LoopList, Ival, Jval = tess.findLoop(args.closeHoles) print "found loops" #print LoopList if writeD: #print "Still to be done ..." outdefects = directory + '/frame' + str(u) + '_defects.vtp' print outdefects