def input_poly(lang): lan = language[lang] pgrade = input_int(lan['input_poly'], lang) p = [0]*(pgrade+1) for i in range(pgrade+1): p[i] = input_float("x^" + str(i) + ": ", lang) return poly(p)
def welcome(): print("\n"*80) #Clear Screen print("************Root Locus Plot************") print("***************************************") print("Please select the language:") print("Por favor seleccione el idioma:") print("1.- English") print("2.- Español") print("0.- Exit/Salir") return input_int("")
def main(lang): max_k = 100 density = 0.01 lan = language[lang] print("\n"*80) #Clear Screen print(str_constants(lang))#Display constants print('*'*40) g_num = -1 while(g_num == -1): print() print(lan['g']) g_num = input_int(lan['g_num'],lang) if g_num == -1: print() max_k = input_int(lan['max_k'], lang) print() density = input_float(lan['prompt_density'], lang) g = [None]*g_num for i in range(g_num): g[i] = input_poly(lang) print(lan['h']) h_num = input_int(lan['h_num'],lang) h = [None]*h_num for i in range(h_num): h[i] = input_poly(lang) g_poly = functools.reduce(operator.mul, g, 1) h_poly = functools.reduce(operator.mul, h, 1) x_final, y_final = get_x_y_from_g_h(g_poly,h_poly, max_k, density) plt.plot(x_final,y_final) plt.xlabel(lan['real_axis']) plt.ylabel(lan['img_axis']) plt.title(lan['graph_title']) plt.show()
""" Created on Sat Apr 25 22:08:19 2020 @author: etshawy """ import os import math import numpy as np import cv2 import user_input min_acceptable_sequence_length = 2 data_type = 'B' img, img_path = user_input.read_gray_img() height, width = img.shape window_size = user_input.input_int('please enter the window size: ') lookahead_buffer_size = user_input.input_int( 'please enter the look ahead buffer size: ') if lookahead_buffer_size > window_size: print( "buffer can't be greater than the whole window, terminating program..." ) exit(-1) flattened = img.flatten().tolist() search_buffer_size = window_size - lookahead_buffer_size def get_longest_match(data, current_position): """Summary or Description of the Function