def __init__(self, config_path): """Initailzie dictionary objects, and populate from config file information. Args: config_path: string specifying path to config file, set by command line argument. """ self.print_green = cp.ColorPrinter("Green") self.print_purple = cp.ColorPrinter("Purple") self.print_blue = cp.ColorPrinter("Blue") self.print_red = cp.ColorPrinter("Red") self.sock_dict = {} # dictionary to hold socket objects self.data_dict = { } # dictionary to hold POD, such as bools, ints, and str's self.addr_dict = { } # dictionary to hold information used to generate sockets # but -not- the sockets themselves, format is key=name val=[ip,port] self.sock_comm = sc.SocketComm() config_token_handler = self.__generate_token_handlers() self.__parse_config_data(config_path, config_token_handler) self.data_dict['num_of_iters'] = self.__get_total_iterations() self.__generate_file_paths()
def __init__(self): """ Initialize color printers. """ self.print_green = cp.ColorPrinter("Green") self.print_purple = cp.ColorPrinter("Purple") self.print_yellow = cp.ColorPrinter("Yellow") self.print_red = cp.ColorPrinter("Red")
def __init__(self, host="10.95.100.177", port=7776): super(StepperMover, self).__init__() self.print_green = cp.ColorPrinter("Green") self.print_red = cp.ColorPrinter("Red") self.step_sock = self._socket_connect("10.95.100.177", 7776) self.ardu_sock = self._socket_connect("10.66.192.41", 23) self.ardu_comm = sc.ArduComm(self.ardu_sock)
def __init__(self, config_path): super(ProgramCore, self).__init__(config_path) self.print_green = cp.ColorPrinter("Green") self.print_purple = cp.ColorPrinter("Purple") self.print_blue = cp.ColorPrinter("Blue") self.print_red = cp.ColorPrinter("Red") self.print_yellow = cp.ColorPrinter("Yellow") nwa_sock = self.sock_dict['nwa'] nwa_points = self.data_dict['nwa_points'] nwa_span = self.data_dict['nwa_span'] nwa_power = self.data_dict['nwa_power'] sg_sock = self.sock_dict['sg'] switch_sock = self.sock_dict['switch'] ardu_sock = self.sock_dict['ardu'] step_addr = self.addr_dict['step'] self.nwa_comm = sc.NetworkAnalyzerComm(nwa_sock, nwa_points, nwa_span, nwa_power) self.sg_comm = sc.SignalGeneratorComm(sg_sock) self.switch_comm = sc.SwitchComm(switch_sock) self.ardu_comm = sc.ArduComm(ardu_sock) self.step_comm = sc.StepperMotorComm(step_addr) self.convertor = procs.Convertor() self.nominal_centers = self.data_dict['nominal_centers'] self.num_of_iters = int(self.data_dict['num_of_iters']) self.start_length = float(self.data_dict['start_length']) self.initial_length = float(self.data_dict['intial_length']) self.nwa_span = int(self.data_dict['nwa_span']) self.iteration = 0
def __init__(self): """ Initialize colored terminal printers. """ self.print_blue = cp.ColorPrinter("Blue") self.print_purple = cp.ColorPrinter("Purple")
def __init__(self): self.print_blue = cp.ColorPrinter("Blue") self.print_purple = cp.ColorPrinter("Purple")