def main(argv): nb = -1 if len(sys.argv) == 3: if argv[0] == "-n": tmp = int(argv[1]) if tmp > 0: nb = tmp if nb == -1: print('argument non valide') exit(1) print("----- DEBUT SIMULATION ENTREPOT -----") # Pièces Piece.processusPieces(nb) # Machine mA Machine.processusMachine("mA",["pA", "pB"],["mB"],nb) # Machine mB Machine.processusMachine("mB",["pB", "pC"],["mA"],nb) # Entrepôt Entrepot.processusEntrepot() print("------ FIN SIMULATION ENTREPOT ------")
def work(WVirginica, WVersicolor): data = getData() mapping = {'Iris-setosa': 0, 'Iris-versicolor': -1, 'Iris-virginica': 1} data = data.replace({'Class': mapping}) #Separa 30% do banco para teste. dataTrain,dataTest = train_test_split(data, test_size=0.30) # Divide os dados que a maquina vai trabalhar que nao foram passados no treino X = dataTest[['PetalLength', 'PetalWidth', 'SepalLength', 'SepalWidth']] Xtest = np.asarray(X) Y = dataTest['Class'].values Ytest = np.asarray(Y) ml = Machine() # Recebe o resultado encontrado dos dados passados para teste result = ml.workIris(Xtest, WVirginica, WVersicolor) # Compara os resultados com os dados que deveriam sair e gera uma precisao accuracy = accuracy_score(Ytest, result) # Imprime na tela a precisao dos resultados print "precisao = ", accuracy
def main(arguments): args = init(arguments) print("************************") print("* Login to CloudEndure *") print("************************") cloud_endure = CloudEndure_manager.CloudEndure(args.config) cloud_endure.login(args.userapitoken) if args.command == "blueprint": if args.do == "get": print( 'This feature is not yet implemented, in the meanwhile you will have to do it on your own.' ) pass elif args.do == "update": Machine.update_blueprint(args.type, cloud_endure, args.projectname, args.dryrun) elif args.command == "project-update": UpdateProject.update(cloud_endure, args.projectname) sys.exit(4) elif args.command == "clean": Cleanup.remove(cloud_endure, args.projectname, args.dryrun) sys.exit(2) elif args.command == 'launch': Machine.execute(args.type, cloud_endure, args.projectname, args.dryrun) elif args.command == 'check-status': StatusCheck.check(args.type, cloud_endure, args.projectname)
def parseMachine(self, buffer): fmtLen = struct.unpack('i', buffer[0: 4])[0] fmtStr = struct.unpack('%ss' % (fmtLen), buffer[4: 4 + fmtLen])[0] machine = Machine() machine.fromString(fmtStr, buffer[4 + fmtLen:]) return machine
def main(arguments): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('--userapitoken', required=True) parser.add_argument('--configfile', required=True) parser.add_argument('--launchtype') parser.add_argument('--projectname', required=True) parser.add_argument('--updateproject', default="No") parser.add_argument('--statuscheck', default="No") parser.add_argument('--cleanup', default="No") parser.add_argument('--dryrun', default="No") parser.add_argument('--createimage', default="No") parser.add_argument('--region', default="") args = parser.parse_args(arguments) print("************************") print("* Login to CloudEndure *") print("************************") login(args.userapitoken, endpoint) if args.updateproject == "Yes": UpdateProject.update(session, headers, endpoint, HOST, args.projectname, args.configfile) sys.exit(4) if args.cleanup == "Yes": Cleanup.remove(session, headers, endpoint, HOST, args.projectname, args.configfile) sys.exit(2) if args.dryrun != "No" and args.dryrun != "Yes": print("ERROR: Please type '--dryrun Yes' if you want to validate your production YAML file....") sys.exit(3) if args.createimage != "No" and args.createimage != "Yes": print("ERROR: Please type '--createimage Yes' if you want to create Amazon EC2 Images(AMI) of the target instances....") sys.exit(5) if args.createimage=="Yes" and args.region =="": print("ERROR: Please provide valid ('--region <aws_region_name>') aws region(ex. us-west-1) to create EC2 Images(AMI) of the target instances....") sys.exit(6) if args.createimage=="Yes" and args.region != "": CreateImages.createimage(session, headers, endpoint, HOST, args.projectname, args.configfile, args.region) sys.exit(7) if args.launchtype == "test" or args.launchtype =="cutover": if args.statuscheck == "No": Machine.execute(args.launchtype, session, headers, endpoint, HOST, args.projectname, args.configfile, args.dryrun) else: if args.statuscheck =="Yes": StatusCheck.check(args.launchtype, session, headers, endpoint, HOST, args.projectname, args.configfile) else: print("ERROR: Please type '--statuscheck Yes' if you want to check migration status....") else: print("ERROR: Please use the valid launch type: test|cutover....")
class Game: def __init__(self): self.board = Board() self.player = Player() self.machine = Machine() def initGame(self): self.player.setName() self.player.getName() self.board.initBoard() randomChoice = self.board.coinFlip() self.player.setSide(randomChoice) print("Player is with ", randomChoice) self.machine.setSide(getOpSide(randomChoice)) def startGame(self): # if player is x then move if self.player.getSide() == 'X': spot = self.player.getNextMove(self.board.getGameBoard()) print('Player chose', end='\n\n') self.board.applyMove(spot, self.player.getSide()) self.board.gameBoard_status() print() while True: # machine moves spot = self.machine.minimax(self.board, 0, self.machine.getSide()) print('Machine chose', end='\n\n') self.board.applyMove((spot[0], spot[1]), self.machine.getSide()) self.board.gameBoard_status() print() # test for end then break info = self.board.isOver() if info[0]: print(f'{info[1]} wins !') break # player moves playerSpot = self.player.getNextMove(self.board.getGameBoard()) print('Player chose', end='\n\n') self.board.applyMove(playerSpot, self.player.getSide()) self.board.gameBoard_status() print() # test for end then break info = self.board.isOver() if info[0]: print(f'{info[1]} wins !') break
def __init__(self, machine): self.saver = Machine.File_Saver( type(self).JSON_FILENAME, type(self).AUTO_SAVING_INTERVAL) # Load events infomations from past data events_json = self.saver.load() if events_json is not False: self.eventQueue = [] for event_info in events_json['eventQueue']: if event_info["mode"] == MODE_DRYING: new_event = ClothDryingEvent(key=event_info["key"], p=event_info["priority"]) elif event_info["mode"] == MODE_GATHERING: new_event = ClothDryingEvent(key=event_info["key"], p=event_info["priority"]) elif event_info["mode"] == MODE_SORTING: new_event = ClothSortingEvent(key=event_info["key"], p=event_info["priority"]) else: print("Error Unknown Mode") self.eventQueue.append(new_event) self.taskQueue = events_json['taskQueue'] else: self.eventQueue = [] self.taskQueue = [] self.machine = machine
def update_machine(hostname): """ Permet la mise à jour d'une machine existante à l'aide de son hostname :param hostname: nom de la machine sur laquelle on va faire les modifications :return: """ print("Bienvenue sur la console de mise à jour pour la machine " + hostname) for machine in range(len(listMachinesFomFile)): namehost = listMachinesFomFile[machine]["hostname"] if namehost == hostname: hostname, ip, cpu, ram, numberDD, spaceDD, os, version_os = verif_insert_user( ) new_machine = Machine.Machine(hostname, ip, cpu, ram, numberDD, spaceDD, os, version_os) listMachinesFomFile[machine]["hostname"] = new_machine.hostname listMachinesFomFile[machine]["ip"] = new_machine.ip listMachinesFomFile[machine]["nombre_cpu"] = new_machine.nombre_cpu listMachinesFomFile[machine]["taille_ram"] = new_machine.taille_ram listMachinesFomFile[machine][ "nombre_disque_dur"] = new_machine.nombre_disque_dur listMachinesFomFile[machine][ "taille_disque_dur"] = new_machine.taille_disque_dur listMachinesFomFile[machine]["os"] = new_machine.os listMachinesFomFile[machine]["version_os"] = new_machine.version_os bdd_file.write_bd(listMachinesFomFile) return "Vos informations ont bien été prise en compte.\n" return "Impossible de trouver le hostname de la machine.\n"
def create_machine(machine: Machine): """ Methode qui va permettre de créer une nouvelle machine en entrant toutes les informations qui caracterisent une machine :return: """ machine_dict = machine.dict() listMachinesFomFile.append(machine_dict) return bdd_file.write_bd(listMachinesFomFile)
def __init__(self, **kwargs): # Set default values for public/private members self.machines = [] self.down = [] # Build the master machine self.master = Machine(localhost=True)
def MLearning(mapping): data = getData() data = data.replace({'Class': mapping}) # Separa aleatoriamente 20% para teste e 80% para que a maquina possa aprender dataTrain, dataTest = train_test_split(data, test_size=0.20) # Divide os dados que a maquina vai precisar comparar Y com os dados de entrada X para o aprendizado X = dataTrain[['PetalLength', 'PetalWidth', 'SepalLength', 'SepalWidth']] Xtrain = np.asarray(X) Y = dataTrain['Class'].values Ytrain = np.asarray(Y) # Declara e faz com que a maquina aprenda com os dados de treino ml = Machine() ml.learning(Xtrain, Ytrain) return ml.getW()
def handleMessage(self, connection, message): machineInfos = collectMachineInfo() machine = Machine() machine.os_info = machineInfos['os_info'] machine.ip_addr = machineInfos['ip_addr'] machine.cpu_info = machineInfos['cpu_info'] machine.mem_info = machineInfos['mem_info'] machine.disk_info = machineInfos['disk_info'] connection.enqueue(MachineInfoMessage(machine))
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.MachineGroups self.machineDB = Machine.Machine(db) # indexes self.collection.create_index([('group_name', ASCENDING)], unique=True)
def slot(self): # слот при изменения machine = Machine.Machine(self.line_edit.text()) current_condition = machine.start() machine = Machine.Machine(self.line_edit.text()[:-1]) prev_condition = machine.start() for key in self.conditions.keys(): self.change_color_of_circle(key, QColor(192, 192, 192)) for k in self.conditions[key]["text"]: self.conditions[key]["text"][k].setDefaultTextColor( QColor(0, 0, 0)) if current_condition[0]: self.change_color_of_circle(current_condition[1], QColor(50, 205, 50)) if current_condition[1] in self.conditions[ prev_condition[1]]["text"].keys(): self.conditions[prev_condition[1]]["text"][ current_condition[1]].setDefaultTextColor( QColor(50, 205, 50)) else: self.change_color_of_circle(current_condition[1], QColor(255, 50, 50))
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.DeploymentRequest self.machineDB = Machine.Machine(db) self.versionsDB = Versions.Versions(db) self.toolDB = Tool.Tool(db) self.passHelper = PasswordHelper.PasswordHelper(key) self.statedb = State.State(db)
def get_machines(): """ Methode qui va permettre de récupérer toutes les machines du parc informatique :return: """ lstObjMachine = [] for machine in listMachinesFomFile: instance_machine = Machine.Machine( machine["hostname"], machine["ip"], machine["nombre_cpu"], machine["taille_ram"], machine["nombre_disque_dur"], machine["taille_disque_dur"], machine["os"], machine["version_os"]) lstObjMachine.append(instance_machine) return {"Liste listMachie": listMachinesFomFile}
def __init__(self): myclient = pymongo.MongoClient("mongodb://localhost:27017/") dbname = "test_rest" mydb = myclient[dbname] user_colection = mydb["user"] user1 = { "name": "Renzo", "password": hashlib.sha1(b"abc123").hexdigest() } user2 = {"name": "Otro", "password": hashlib.sha1(b"Otra").hexdigest()} user_list = [user1, user2] user_colection.insert_many(user_list) machine_colection = mydb["machine"] machine1 = Machine.Machine("machine1", "12345678") machine2 = Machine.Machine("machine2", "abcdefgh") machine_list = [machine1.machine_to_DB(), machine2.machine_to_DB()] machine_colection.insert_many(machine_list) print("usuario1 = ", user1) print("usuario2 = ", user2) print("mchine1 = ", machine1.machine_to_JSON()) print("mchine2 = ", machine2.machine_to_JSON())
def __init__(self, db): ''' General description : This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.DeploymentRequestGroup self.deploymentRequestDb = DeploymentRequest.DeploymentRequest(db) self.machineDB = Machine.Machine(db) self.versionsDB = Versions.Versions(db) self.toolDB = Tool.Tool(db) self.deploymentUnitDB = DeploymentUnit.DeploymentUnit() self.deploymentRequestDbCollection = db.DeploymentRequest self.statedb = State.State(db)
def __init__(self, db): ''' General description: This function initializes the database variables and \ index to refer in functions. ''' DBUtil.__init__(self, db) self.collection = db.UserFavoriteMachine self.machineTypeDb = MachineType.MachineType(db) self.machineDB = Machine.Machine(db) self.userDB = Users.Users(db) # indexes self.collection.create_index([('user_id', ASCENDING), ('machine_id', ASCENDING)], unique=True)
def creerManchots(nb): tabMachines = [] for i in range(nb): esperance = randint(-10, 10) variance = randint(0, 10) machine = m.Implementation(esperance, variance) print("Machine "+str(i+1)+" :") print machine tabMachines.append(machine) return(tabMachines)
def read_machine(): #reading equipment prod = [] t = Machine.Machine('','', 0, 0.0) rb = openpyxl.load_workbook(filename = PATH + 'equipment.xlsx') sheet = rb.active for i in range(sheet.max_row): prod.append(t) buf = sheet.cell(row = i + 1, column = 1).value prod[i]._id = buf buf = sheet.cell(row = i + 1, column = 2).value prod[i]._type = buf buf = sheet.cell(row = i + 1, column = 4).value prod[i].speed = buf return prod
def create_machine(): """ Permet de créer une nouvelle machine en entrant toutes les informations qui caracterisent une machine :return: """ hostname, ip, cpu, ram, numberDD, spaceDD, os, version_os = verif_insert_user( ) new_machine = Machine.Machine(hostname, ip, cpu, ram, numberDD, spaceDD, os, version_os) data = { "hostname": new_machine.hostname, "ip": new_machine.ip, "nombre_cpu": new_machine.nombre_cpu, "taille_ram": new_machine.taille_ram, "nombre_disque_dur": new_machine.nombre_disque_dur, "taille_disque_dur": new_machine.taille_disque_dur, "os": new_machine.os, "version_os": new_machine.version_os } listMachinesFomFile.append(data) bdd_file.write_bd(listMachinesFomFile)
def get_machine(hostname): """ Permet de recuperer les informations pour une machine donnée en parametre :param hostname: nom de la machine :return: json avec les informations lié au hostname de la machine """ for machine in listMachinesFomFile: if machine["hostname"] == hostname: instance_machine = Machine.Machine( machine["hostname"], machine["ip"], machine["nombre_cpu"], machine["taille_ram"], machine["nombre_disque_dur"], machine["taille_disque_dur"], machine["os"], machine["version_os"]) return { "hostname": instance_machine.hostname, "ip": instance_machine.ip, "nombre cpu": instance_machine.nombre_cpu, "taille ram": instance_machine.taille_ram, "nombre disque dur": instance_machine.nombre_disque_dur, "taille disque dur": instance_machine.taille_disque_dur, "os": instance_machine.os, "version os": instance_machine.version_os } return "Impossible de trouver le hostname de la machine.\n"
def createMachine(line): if len(line) == 0: return return Machine(*line)
def InitMachines(): for ID, IP in zip(MachinesIDs, MachinesIPs): Machines[ID] = Machine(IP, ID)
# import sys # sys.path.append('DoTatThanh-Code/FinalProject/WordSeg/') # # from DicMap import DicMap import Feats import SylMap import Machine import pickle from scipy import sparse from sklearn.model_selection import GridSearchCV from sklearn.linear_model import LogisticRegression from joblib import dump, load f = Feats.Feats() m = Machine.Machine(3, '../data/', 0) m.load('', 'dongdu.map') # print("Bệnh".lower()) # fi = open('../data/vndata/train2') # count = 0 # for line in fi: # count += 1 # if count % 100 == 0: # print(count) # m.extract(line, 0) # result = m.vectorize_all_data() result = sparse.load_npz("coo_matrix.npz") # m.save_feats() m.load_feats() m.training() # a = m.segment('Trong hoàn cảnh nghiệt ngã lúc đó , lụt và hạn hoành hành , giặc ngoại xâm hoành hành , tiền và phương tiện gần như không có gì , giống má cạn kiệt , trâu bò chết gần hết ... , mà đánh thắng được giặc đói , thắng một cách oanh liệt thì quả là một kỳ công .') # print(a)
class System(object): """An example docstring for a class definition.""" def __init__(self): super(System, self).__init__() self.positions24well = [ ] # Array to store motor positions of wells for 24 well plate self.positions96well = [ ] # Array to store motor positions of wells for 96 well plate self.rows = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' ] # List of all possible row labels for 24 & 96 well plates self.cols = range( 1, 13) # List of all possible column labels for 24 & 96 well plates self.wellDict24 = [ ] # List to store selection status of all wells in 24 well plate self.wellDict96 = [ ] # List to store selection status of all wells in 96 well plate self.wellNames24 = [ ] # List to store the full label of all wells in 24 well plate self.wellNames96 = [ ] # List to store the full label of all wells in 96 well plate self.savedSettings = [ ] # List to store LED Wavelength properties and system measurement settings self.selectionDict = {1: {}} self.plateList = [] self.__current_plate_index = 0 self.__platetype = 0 self.__platecount = 0 self.load_calibration_data(24) self.load_calibration_data(96) self.load_settings() self.load_well_labels() def load_calibration_data(self, platetype, filename=''): """ Return the most important thing about a person. Parameters ---------- platetype A string indicating the name of the person. filename A filename of the calibration data """ if not filename: # If no filename was entered into function # Checks OS of system if platform.system() == 'Windows': if platetype == 24: # Loads calibration data for 24-well plate with open('System Settings/calibration24Wells', 'r') as f: self.positions24well = pickle.load(f) self.positions24well[0][0] = 1048 self.positions24well[0][1] = 1513 elif platetype == 96: # Loads calibration data for 96-well plate with open('System Settings/calibration96Wells', 'r') as f: self.positions96well = pickle.load(f) print self.positions96well elif platform.system() == 'Darwin': if platetype == 24: with open('System Settings/calibration24Wells', 'r') as f: self.positions24well = pickle.load(f) self.positions24well[0][0] = 1048 self.positions24well[0][1] = 1513 elif platetype == 96: with open('System Settings/calibration96Wells', 'r') as f: self.positions96well = pickle.load(f) print self.positions96well elif platform.system() == 'Linux': if platetype == 24: with open('System Settings/calibration24Wells', 'rb') as f: self.positions24well = pickle.load(f) self.positions24well[0][0] = 1048 self.positions24well[0][1] = 1513 elif platetype == 96: with open('System Settings/calibration96Wells', 'rb') as f: self.positions96well = pickle.load(f) print self.positions96well else: # If filename was provided as an input if platform.system() == 'Windows': if platetype == 24: with open('System Settings/' + filename, 'r') as f: self.positions24well = pickle.load(f) elif platetype == 96: with open('System Settings/' + filename, 'r') as f: self.positions96well = pickle.load(f) elif platform.system() == 'Darwin': if platetype == 24: with open('System Settings/' + filename, 'r') as f: self.positions24well = pickle.load(f) elif platetype == 96: with open('System Settings/' + filename, 'r') as f: self.positions96well = pickle.load(f) elif platform.system() == 'Linux': if platetype == 24: with open('System Settings/' + filename, 'rb') as f: self.positions24well = pickle.load(f) elif platetype == 96: with open('System Settings/' + filename, 'rb') as f: self.positions96well = pickle.load(f) def load_settings(self): """Used to automatically load the saved settings for the OSP software. Settings include the light source wavelengths and the number of scans to average. The settings are stored as a pickle file in System Settings directory. """ with open('System Settings/savedSettings', 'rb') as f: self.savedSettings = pickle.load(f) def save_settings(self): """ Used to automatically save the system settings for the OSP software. Settings include the light source wavelengths and the number of scans to average. The settings are stored as a pickle file in System Settings directory. """ with open('System Settings/savedSettings', 'wb') as f: pickle.dump(self.savedSettings, f) def load_well_labels(self): """ Creates the necessary list to store the well labels in form of 'well_rowcolumn'. For example the entry in the list for A2 would be 'well_A2'. Also creates a list to store the selection status of a particular well as either 'OFF' (not selected) or 'ON' (selected). """ for row in self.rows: for column in self.cols: self.wellNames96.append('well_' + row + str(column)) self.wellDict96.append('OFF') for row in self.rows[1:5]: for column in self.cols[1:7]: self.wellNames24.append('well_' + row + str(column)) self.wellDict24.append('OFF') def set_plate_type(self, platetype): """ This function initializes a new PlateConfiguration object which will be used to keep track of which wells are selected and which protocols to execute for the selected wells. The newly created PlateConfiguration object is added to a list allowing it be accessed later on. This function is executed every time a new set of protocols is desired to be run on a different group of wells (a new PlateConfiguration needed). Parameters ---------- platetype possible value of 24 (for 24-well plate) or 96 (for 96-well plate). """ self.__platetype = platetype self.__platecount += 1 if platetype == 24: self.selectionDict[self.__platecount] = self.wellDict24 elif platetype == 96: self.selectionDict[self.__platecount] = self.wellDict96 plate = PlateConfiguration(platetype, self.__platecount) self.plateList.append(plate) def set_current_plate(self, index): """Function to keep track of the index of the PlateConfiguration which is being edited. Arguments: index {integer} -- index of the PlateConfiguration object in the self.plateList list """ self.__current_plate_index = index def get_current_plate_type(self): """Function to attain the type of plate (24 or 96 well) of the current PlateConfiguration object Returns: integer -- plate type of current PlateConfiguration object being edited. Returns 24 (for 24-well plate) or 96 (for 96-well plate). """ plate_type = self.plateList[len(self.plateList) - 1].well_numb return plate_type def get_plate_count(self): """Used to attain the number of PlateConfiguration objects added to the system. Returns: integer -- number of PlateConfiguration objects in self.plateList. """ plate_numb = self.plateList[-1].order return plate_numb def remove_plate_object(self, plate_numb): """Function to remove a PlateConfiguration object from self.plateList. If object is removed the indices of all other plates are fixed to account for the removal. Arguments: plate_numb {integer} -- integer representing the index of the PlateConfiguration object in self.plateList. For this variable, an input of 1 would represent the first entry in self.plateList. """ del self.plateList[int(plate_numb) - 1] for p in range(0, len(self.plateList)): self.plateList[p].order = p + 1 def get_selected_wells(self, plate_index): """Returns a list of all the wells which were selected for protocol execution. Arguments: plate_index {integer} -- index of the PlateConfiguration object in self.plateList from which the selected wells are to be extracted from. Returns: [list] -- Each element in list is the label (as a string) of a well which was selected. If well A1 was selected, then the list would contain the element 'A1'. """ selected_wells = self.plateList[plate_index].get_selected_wells() return selected_wells def get_settings(self): """Returns the current settings of the system. Returns: [list] -- The list is made up of four elements. The first 3 elements represent the wavelengths of LEDs 1, 2, and 3 respectively. The fourth element of the list represents the number of scans to average. """ return self.savedSettings def select_wells(self, plate_index, well_list): """Function used to select the wells for protocol execution in a specific PlateConfiguration Arguments: plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells well_list {list} -- a list of the well indices, where well A1 is indexed at 0 and indices increase along the rows. For example, in a 24-well plate, the indices of the first row wells A1-A6 = 0-5, second row B1-B6 = 6-11, etc """ print self.plateList print plate_index for i in well_list: self.plateList[plate_index].select_wells(well_list) def clear_wells(self, plate_index): """Function used to unselect (clear) all the wells from the PlateConfiguration object Arguments: plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to unselect wells """ self.plateList[plate_index].clear_wells() def select_all_wells(self, plate_index): """Function used to select all the wells in the PlateConfiguration object Arguments: plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells """ self.plateList[plate_index].select_all_wells() def add_absorbance_protocol(self, exp_time, label, plate_index, order): """Function to add an Absorbance protocol to the list of protocols to execute for a particular PlateConfiguration Arguments: exp_time {integer} -- exposure time with which to collect absorbance spectrum in milliseconds label {string} -- protocol label, should be set to 'Absorbance' plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells order {integer} -- the index of the protocol in the existing list of protocols of the plate configuration object. If this is the first protocol that is being added to the PlateConfiguration object then the order is equal to zero. If it is the second, then the order is equal to 1 and so on. """ new_protocol = Absorbance(exp_time, label, plate_index, order) self.plateList[plate_index].add_protocol(new_protocol) def add_fluorescence_protocol(self, exp_time, led_index, wavelength_led_1, wavelength_led_2, wavelength_led_3, label, plate_index, order): """Function to add an Fluorescence protocol to the list of protocols to execute for a particular PlateConfiguration Arguments: exp_time {integer} -- exposure time with which to collect absorbance spectrum in milliseconds led_index {integer} -- possible values 1,2 or 3 representing which LED to use for protocol. Only 1 LED per protocol. wavelength_led_1 {integer} -- wavelength of LED 1 wavelength_led_2 {integer} -- wavelength of LED 2 wavelength_led_3 {integer} -- wavelength of LED 3 label {string} -- protocol label, should be set to 'Fluorescence' plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells order {integer} -- the index of the protocol in the existing list of protocols of the plate configuration object. If this is the first protocol that is being added to the PlateConfiguration object then the order is equal to zero. If it is the second, then the order is equal to 1 and so on. """ new_protocol = Fluorescence(exp_time, led_index, wavelength_led_1, wavelength_led_2, wavelength_led_3, label, plate_index, order) self.plateList[plate_index].add_protocol(new_protocol) def add_auxiliary_protocol(self, aux_index, duration, label, plate_index, order): """Function to add an Auxiliary protocol to the list of protocols to execute for a particular PlateConfiguration. The auxiliary protocol type is defined by the aux_index input. Arguments: aux_index {integer} -- possible values 1, 2, 3 or 4 representing which auxiliary port will be triggerd on. duration {integer} -- duration for how long to trigger the selected auxiliary port for. label {string} -- protocol label, should be set to 'Auxiliary' plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells order {integer} -- the index of the protocol in the existing list of protocols of the plate configuration object. If this is the first protocol that is being added to the PlateConfiguration object then the order is equal to zero. If it is the second, then the order is equal to 1 and so on. """ new_protocol = Auxiliary(aux_index, duration, label, plate_index, order) self.plateList[plate_index].add_protocol(new_protocol) def add_shake_protocol(self, label, plate_index, order): """Function to add a Shake protocol to the list of protocols to execute for a particular PlateConfiguration Arguments: label {string} -- protocol label, should be set to 'Shake' plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells order {integer} -- the index of the protocol in the existing list of protocols of the plate configuration object. If this is the first protocol that is being added to the PlateConfiguration object then the order is equal to zero. If it is the second, then the order is equal to 1 and so on. """ new_protocol = Shake(label, plate_index, order) self.plateList[plate_index].add_protocol(new_protocol) def turn_kinetic_tracking_on(self, method, interval, duration, reps, label, plate_index, order): """Function to turn on the system kinetic mode. This enables the user to input protocols into a kinetic sequence which can be looped for a desired time period or repeated a specific number of times. The interval method allows the user to perform a series of protocols in intervals for a specified duration of time. For example, executing an Absorbance protocol very 30 seconds for 20 minutes. The repetiion method allows the user to repeatedly perform a series of protocols. For example, executing an Absorbance protocol 10 times in a row. Arguments: method {integer} -- possible value 1 (for Interval method) or 2 (for Repeat method) interval {integer} -- interval time for a kinetic protocol (milliseconds) duration {integer} -- the duration to perform the kinetic protocol sequence (milliseconds) reps {integer} -- number of times to repeat the kinetic protocol sequence label {string} -- protocol label, should be set to 'Kinetic' plate_index {integer} -- index of the PlateConfiguration object in self.plateList in which to select wells order {integer} -- the index of the protocol in the existing list of protocols of the plate configuration object. If this is the first protocol that is being added to the PlateConfiguration object then the order is equal to zero. If it is the second, then the order is equal to 1 and so on. """ new_protocol = Kinetic(method, interval, duration, reps, label, plate_index, order) self.plateList[plate_index].add_protocol(new_protocol) def add_kinetic_absorbance_protocol(self, exp_time, label, plate_index, protocol_index, order): new_protocol = Absorbance(exp_time, label, plate_index, order) kinetic_protocol = self.plateList[plate_index].get_protocol( protocol_index) kinetic_protocol.add_protocol(new_protocol) def add_kinetic_fluorescence_protocol(self, exp_time, led_index, wavelength_led_1, wavelength_led_2, wavelength_led_3, label, plate_index, protocol_index, order): new_protocol = Fluorescence(exp_time, led_index, wavelength_led_1, wavelength_led_2, wavelength_led_3, label, plate_index, order) kinetic_protocol = self.plateList[plate_index].get_protocol( protocol_index) kinetic_protocol.add_protocol(new_protocol) def add_kinetic_auxiliary_protocol(self, aux_index, duration, label, plate_index, protocol_index, order): new_protocol = Auxiliary(aux_index, duration, label, plate_index, order) kinetic_protocol = self.plateList[plate_index].get_protocol( protocol_index) kinetic_protocol.add_protocol(new_protocol) def add_kinetic_shake_protocol(self, label, plate_index, protocol_index, order): new_protocol = Shake(label, plate_index, order) kinetic_protocol = self.plateList[plate_index].get_protocol( protocol_index) kinetic_protocol.add_protocol(new_protocol) def get_all_protocol_brief_descriptions(self, plate_index): for p in range(0, self.plateList[plate_index].get_protocol_count()): protocol = self.plateList[plate_index].get_protocol(p) protocol.get_brief_description() def get_all_protocol_full_descriptions(self, plate_index): for p in range(0, self.plateList[plate_index].get_protocol_count()): protocol = self.plateList[plate_index].get_protocol(p) protocol.get_full_description() def initialize_machine(self): print 'Machine Initialized' self.machine = Machine(self.savedSettings) def close_machine(self): self.machine.arduino.close() self.machine.spec.close() def start_program(self, plate_list, filename=''): print 'Initialize Excel sheet' self.initialize_datasheet(filename) print 'System prompt machine to start' self.machine.start_program(plate_list, self.worksheet, self.workbook, self.merge_format, self.header_format, self.positions24well, self.positions96well) def initialize_datasheet(self, user_name): if not user_name: filename = 'Data/' + 'data' + time.strftime( "%Y_%m_%d_%H_%M") + '.xlsx' else: filename = 'Data/' + user_name + '.xlsx' self.workbook = xlsxwriter.Workbook(filename) self.worksheet = self.workbook.add_worksheet() self.merge_format = self.workbook.add_format({'align': 'center'}) self.header_format = self.workbook.add_format() self.header_format.set_bold(True) self.header_format.set_bg_color('gray') self.worksheet.merge_range( 'A1:E1', '-------------------- PBPR --------------------', self.merge_format) self.worksheet.merge_range('A2:E2', str(time.ctime()), self.merge_format) self.worksheet.merge_range( 'A3:E3', '------------------------------------------------------------', self.merge_format) return filename
def initialize_machine(self): print 'Machine Initialized' self.machine = Machine(self.savedSettings)
def __init__(self): self.board = Board() self.player = Player() self.machine = Machine()
print('Return_Code =', return_code) print('Return_Message =', return_message) exit() #end-if #Update the PCB paramaters according to the generted random variable for i in range(0, len(dt_inpcsvfile)): pcbobj[i].update_parms(np.asscalar(rv_arr[i])) pcbobj[i].update_pattern() #end-for print(' ') print('-------------------------------------------------------------------') print('MACHINE INSTANTIATION') print('-------------------------------------------------------------------') ldr = Machine.Machine(env, 'LDR', 'Line-Loader ', 1) spr = Machine.Machine(env, 'SPR', 'Screen-Printer', 1) pp1 = Machine.Machine(env, 'PP1', 'PickandPlace1 ', 1) pp2 = Machine.Machine(env, 'PP2', 'PickandPlace2 ', 1) rfo = Machine.Machine(env, 'RFO', 'Reflow-Oven ', 1) print('-------------------------------------------------------------------') print(' ') print('-------------------------------------------------------------------') print('MACHINE BEHAVIOR') print('-------------------------------------------------------------------') for i in range(0, len(dt_inpcsvfile) - 1): if (pcbobj[i].ldr_entry >= 0) & (pcbobj[i].ldr_exit >= 0): env.process(
def wind(self): m = Machine.Machine(windings=t.windings) m.run() m.shutdown()