def main(): user_home = os.environ.get('HOME', '') echo_path = f"{user_home}/.echo" ensure_path_exists(echo_path) while True: try: user_input = prompt( 'echo==> ', history=FileHistory(f'{echo_path}/echo-history'), auto_suggest=AutoSuggestFromHistory()) process_input(user_input) except KeyboardInterrupt: exit(0)
MODEL = get_model_config(NETWORK_KEY, glove=USE_GLOVE) PREPROCESSING_ALGORITHM = get_preprocessing_algorithm( PREPROCESSING_ALGORITHM_ID) if USE_GLOVE: MODEL['GLOVE'] = {'SIZE': 200} GLOVE = f'glove.twitter.27B.{MODEL["GLOVE"]["SIZE"]}d.txt' GLOVE_FILE_PATH = f'./data/glove/{GLOVE}' GLOVE_EMBEDDINGS = get_glove_embeddings(GLOVE_FILE_PATH) MODEL['UUID'] = str(uuid.uuid4()) MODEL['PREPROCESSING_ALGORITHM'] = PREPROCESSING_ALGORITHM MODEL['PREPROCESSING_ALGORITHM_UUID'] = PREPROCESSING_ALGORITHM_ID MODEL['DIR'] = f'./data-saved-models/glove-false/{NETWORK_KEY}/' ensure_path_exists(MODEL['DIR']) MODEL['PREFIX'] = f'{NETWORK_KEY}-{PREPROCESSING_ALGORITHM_ID}-SEED-{SEED}' train_data['preprocessed'] = tweets_preprocessor.preprocess( train_data.text, PREPROCESSING_ALGORITHM, keywords=train_data.keyword, locations=train_data.location) test_data['preprocessed'] = tweets_preprocessor.preprocess( test_data.text, PREPROCESSING_ALGORITHM, keywords=test_data.keyword, locations=test_data.location) train_inputs, val_inputs, train_targets, val_targets = train_test_split(
def store_ip(temp_path, ip): utils.ensure_path_exists(temp_path) with open(os.path.join(temp_path, 'myip.prev_ip'), 'w') as f: f.write(ip)
#! /usr/bin/env python import numpy as np import matplotlib.pyplot as plt from damping_analyzer import Wave, Waves from math import pi from scipy import signal import matplotlib.gridspec as gridspec from utils import ensure_path_exists from os.path import join if __name__ == '__main__': sampling_rate = 200 t1 = 5 IMG_DIR = 'imgs/' ensure_path_exists(IMG_DIR) freqs = [0.5, 1, 1.5, 2, 2.5, 3, 3.3, 4, 5, 8] x_fmt_gen_eq = r'$x(t) = A e^{-\omega_0 \zeta t} \cos( \omega_d t )$' ############# # UNDERdamped x'(t) #fmt_gen_eq = r'$\dot{x}(t) = -\omega_0 \zeta A e^{-\omega_0 \zeta t} \cos( \omega_0 \sqrt{1-\zeta^2} t ) - \omega_0 \sqrt{1-\zeta^2} A e^{-\omega_0 \zeta t} \sin( \omega_0 \sqrt{1-\zeta^2} t )$' #fmt_gen_eq = r'$\dot{x}(t) = -\omega_0 A e^{-\omega_0 \zeta t} (\zeta \cos( \omega_0 \sqrt{1-\zeta^2} t ) + \omega_0 \sqrt{1-\zeta^2} \sin( \omega_0 \sqrt{1-\zeta^2} t ))$' #fmt_gen_eq = r'$\dot{x}(t) = -\omega_0 A e^{-\omega_0 \zeta t} (\zeta \cos( \omega_d t ) + \omega_d \sin( \omega_d t ))$' xdot_fmt_gen_eq = r'$\dot{x}(t) = -\omega_0 A e^{-\omega_0 \zeta t} (\zeta \cos( \omega_d t ) + \omega_d \sin( \omega_d t ))$' ############# # UNDERdamped x(t)