Esempio n. 1
0
 def test_fillvalue_as_keyword_argument_only(self):
     """Test can be called with fillvalue (but only as keyword arg)."""
     inputs = [1, 2, 3]
     outputs = [(1, 2, 3, 0)]
     self.assertIterableEqual(window(inputs, 4, fillvalue=0), outputs)
     with self.assertRaises(TypeError):
         window(inputs, 4, 0)
Esempio n. 2
0
 def received_message(self, resp):
     resp = json.loads(str(resp))
     data = resp['data']
     if type(data) is dict:
         for a in data:
             print(time.time())
             window.window(str(time.time()))
Esempio n. 3
0
 def test_window_size_larger_than_iterable(self):
     self.assertIterableEqual(window([], 1), [(None, )])
     self.assertIterableEqual(window([1, 2], 3), [(
         1,
         2,
         None,
     )])
     self.assertIterableEqual(window([1, 2, 3], 4), [(1, 2, 3, None)])
Esempio n. 4
0
 def __init__(self):
     self.window = wind.window(600, 400)
     self.obj_list = {}
     self.ppc_list = {}
     self.ppc_translation_matrix = np.matrix([[1, 0, 0], [0, 1, 0],
                                              [0, 0, 1]])
     self.descriptor = OBJDescriptor()
Esempio n. 5
0
 def test_returns_lazy_iterable(self):
     inputs = (n**2 for n in [1, 2, 3, 4, 5])
     iterable = window(inputs, 2)
     self.assertEqual(iter(iterable), iter(iterable))
     self.assertEqual(next(iterable), (1, 4))
     self.assertEqual(next(inputs), 9)
     self.assertEqual(list(iterable), [(4, 16), (16, 25)])
Esempio n. 6
0
 def __init__(self):
     self.window = window.window(800, 600, "jogo", imagens.menu, 0, 0)
     self.window.setBack(imagens.menu, (0, 0))
     self.window.setBackSup(sup.sound, imagens.soundOn,
                            (0, 0))  #posição da imagem dentro da superficie
     self.window.superficie(sup.sound, (750, 0))
     self.menu()
def VKE_method(z, w, width=320., overlap=160., c=0.021, m0=1., mc=0.1):
    """
    Estimate turbulent kinetic energy dissipation from large scale vertical
    kinetic energy (VKE).

    Parameters
    ----------
    z : array
        Height (negative depth), must be regularly spaced [m]
    w : array
        Vertical velocity [m s-1]
    width : float, optional
        Width of box over which to calculate VKE (wider boxes use more
        measurements) [m]
    overlap : float, optional
        Box overlap [m]
    c : float, optional
        Parameterisation coefficient that is quoted in reference [1] [s-0.5]
    m0 : float, optional
        Another parameterisation coefficient [rad m-1]
    mc : float, optional
        Cut off high wavernumber for fit [rad m-1]

    Returns
    -------
    z_mid : array
        Height at box middles [m]
    epsilon : array
        Turbulent kinetic energy dissipation (same length as input w). [W kg-1]


    References
    ----------
    [1] Thurnherr et. al. 2015

    """
    C = c*m0**2
    wdws = wdw.window(z, w, width, overlap, cap_left=True, cap_right=True)
    epsilon = []
    z_mid = []

    for i, (z_, w_) in enumerate(wdws):
        m, VKE = sig.periodogram(w_)
        # Convert to radian units.
        VKE /= 2*np.pi
        m *= 2*np.pi
        use = (m < mc) & (m != 0)
        VKE = VKE[use]
        m = m[use]
        B = np.polyfit(np.zeros(len(VKE)), np.log(VKE) + 2*np.log(m), 0)
        p0 = np.exp(B)
        eps = (p0/C)**2
        epsilon.append(eps)
        z_mid.append((z_[0] + z_[-1])/2.)

    return np.asarray(z_mid), np.asarray(epsilon)
Esempio n. 8
0
 def test_returns_lazy_iterable(self):
     inputs = (n**2 for n in [1, 2, 3, 4, 5])
     iterable = window(inputs, 2)
     self.assertEqual(iter(iterable), iter(iterable))
     self.assertEqual(next(iterable), (1, 4))
     # The below line tests that the incoming generator isn't exhausted.
     # It may look odd to test the input like this, but this is correct
     # because after 1 item has been consumed from the output, the input
     # iterator should only have the first 2 items consumed
     self.assertEqual(next(inputs), 9)
     self.assertEqual(list(iterable), [(4, 16), (16, 25)])
Esempio n. 9
0
 def begin(self):
     info = self.roomentry.get(), self.nameentry.get()
     self.window = window.window(info)
     self._print_('準備連接:' + self.roomentry.get() + '中...')
     self.net = network.begin(self.window, info)
     self.window.setIp(self.net)
     self._print_('已連接')
     main = threading.Thread(target=self.net.start)
     main.setDaemon(True)
     main.start()
     self.destroy()
     self.window.mainloop()
Esempio n. 10
0
    def findPartitions(self, n):
        """Partitions GPS data into n+1 subsets.
		
		Args:
			n (int): Number of subsets.
		
		Returns:
			tuple: Tuple containing:
			
				* list: List of subsets (windows).
				* lust: Indices that define windows.
		
		"""

        # Create random numbers
        N = len(self.dt)
        I = bam.getIncreasingRandInt(n, N)

        # Close intervals
        I = np.array(list(I) + [N])

        # Array of windows
        windows = []
        Idxs = []

        # Create indices interval
        k = 0
        for i in I:

            idxs = np.arange(k, i)
            k = i

            windows.append(window(idxs, self))

            Idxs.append(idxs)

        return windows, idxs
Esempio n. 11
0
 def test_window_size_3(self):
     inputs = [1, 2, 3, 4, 5, 6]
     outputs = [(1, 2, 3), (2, 3, 4), (3, 4, 5), (4, 5, 6)]
     self.assertIterableEqual(window(inputs, 3), outputs)
Esempio n. 12
0
 def test_string(self):
     inputs = "hey"
     outputs = [('h', 'e'), ('e', 'y')]
     self.assertIterableEqual(window(inputs, 2), outputs)
Esempio n. 13
0
 def test_none(self):
     inputs = [None, None]
     outputs = [(None, None)]
     self.assertIterableEqual(window(inputs, 2), outputs)
Esempio n. 14
0
 def test_window_size_1(self):
     self.assertIterableEqual(window([1, 2, 3], 1), [(1,), (2,), (3,)])
     self.assertIterableEqual(window([1], 1), [(1,)])
Esempio n. 15
0
 def test_window_size_2(self):
     inputs = [1, 2, 3]
     outputs = [(1, 2), (2, 3)]
     self.assertIterableEqual(window(inputs, 2), outputs)
Esempio n. 16
0
##axs[0].plot(rho_1_td, zw, label='int td')
##axs[0].plot(rho_1_bu, zw, label='int bu')
#axs[0].plot(rho_1_av, zw, label='int av')
#axs[0].plot(rho_1s, zw, label='sorted')
#axs[0].legend(loc=0)
#axs[1].plot(thorpe_disp, zw, 'yo-')
#axs[1].plot(thorpe_scales, zw, 'k')
#axs[1].plot(L_o, zw, 'b')
#axs[1].plot(L_neg, zw, 'r')
#axs[1].plot(L_pos, zw, 'g')
#axs[2].plot(R, zw)
#axs[2].vlines(R0, *axs[2].get_ylim())


width = 200.
binned = wdw.window(zw, eps_thorpe, width=width, overlap=0)
eps_av = np.zeros(len(binned))
z_av = np.zeros(len(binned))
for i, (z_, ep_) in enumerate(binned):
    eps_av[i] = np.trapz(ep_, z_)/width
    z_av[i] = np.mean(z_)

# Integrated dissipation from Thorpe
use = z < -100.
eps_thorpe_int = np.abs(np.trapz(eps_thorpe[use], zw[use])*1025.)
print("Thorpe integrated dissipation: {} mWm-2".format(1000.*eps_thorpe_int))

###############################################################################
# %% LEM
zmin = np.ceil(np.min(zw))
zmax = np.floor(np.max(zw))
Esempio n. 17
0
    stop_x = 800  #end of the bucket
    step_x = 1  #step inside the bucket
    width_x = 200  #window width

    start_y = 0
    stop_y = 800
    step_y = 1
    width_y = 200

    #if oute of range, then call NAFF without windowing, and return the prominent frequencies
    if stop_x > (len(ob.TURN) - width_x):
        amplitude_X, counter_X, naff_x_list = naff_transformation(
            len(ob.TURN), np.array(ob.X), naff_x_list)
    else:
        fig = plt.figure(figsize=(7, 5))
        mean_X, frequency_X = window(start_x, stop_x, step_x, width_x, ob.X,
                                     ob.TURN)
        plt.title(r'$x - plane$, $Chromaticity = %d$' % chromaticities[i])
        plt.show()
        mean_x_list.append(mean_X)
        freq_x_list.append(frequency_X)

    if stop_y > (len(ob.TURN) - width_y):
        amplitude_Y, counter_Y, naff_y_list = naff_transformation(
            len(ob.TURN), np.array(ob.Y), naff_y_list)
    else:
        fig = plt.figure(figsize=(7, 5))
        mean_Y, frequency_Y = window(start_y, stop_y, step_y, width_y, ob.Y,
                                     ob.TURN)
        plt.title(r'$y - plane$, $Chromaticity = %d$' % chromaticities[i])
        plt.show()
        mean_y_list.append(mean_Y)
Esempio n. 18
0
import wx

from db_wrapper import db_wrapper
from window import window

db_wrap = db_wrapper()
#print("TABLE NAMES")
#[print(x) for x in db_wrap.table_names]

#print("\nMATERIAL_NAMES")
#[print(x) for x in db_wrap.material_names]

test_data = db_wrap.get_table_data_raw('Steel_Thermal_Conductivity')
app = wx.App()
window(None, 'Material Properties GUI', db_wrap)
app.MainLoop()
Esempio n. 19
0
 def __init__(self):
     self.window = window.window(800, 600, "Jogo", imagens.back,
                                 musica.menu, 0)
     self.window.setBack(imagens.back, (0, 0))
     self.fonte = pygame.font.SysFont("comicsans", 24, True)
     self.main()
Esempio n. 20
0
11/2019
'''
#===============================================================================
# Imports
import tkinter as tk
from tkinter import ttk
from tkinter import scrolledtext
from tkinter import Menu
import window

import textmanagement

#===============================================================================
#Core code

#===============================================================================
# GUI

# Instantiate
winder = window.window("Project Continuity")

# Add a title
#win.title("Project Continuity")

# Create a container to hold scrolled textboxes
#textbox_frame = ttk.LabelFrame(win, text='Sections')
#textbox_frame.grid(column=0, row=0)

# Begin loop
winder.mainloop()
Esempio n. 21
0
# Signal generator
sine1 = dds_gen(N, Fs, 1, Fo, True)

# HighPass Filter
fa = Fs/D
B,A = sigs.butter(1,0.5/(fa/2),btype='high')

# Memory Filter Coefficients
axy = 0.1                                              # coordinates gain
ar = 0.51                                              # radius gain
# Circular Buffer Declaration
buff = circbuffer(Nd,Nd*10,'complex')

# Sliding window Declaration
win = window(int(Nd),int(500*Nd),'right')
# initializing plots
plt.ion()
fig = plt.figure()

# plot2 sliding window
lenX = len(win.get())
t = np.arange(0, lenX)/(Fs/D)
fig2 = plt.figure()
plt2 = plt.plot(t, win.get())
#plt.ylim(-(np.max(np.abs(signal))),(np.max(np.abs(signal))))
plt.ylim(-1,1)

if realtime is False:
# main cycle
    for nf in range (0,Nframes):
Esempio n. 22
0
File: game.py Progetto: nonsix/u18
import libtcodpy as libtcod
from window import window

WIDTH = 65
HEIGHT = 50

win = window(WIDTH, HEIGHT, libtcod)
#game loop
win.draw()
Esempio n. 23
0
import pygame, sys, window, player, menu, level
  
## -- -- ## -- -- ## -- -- ## -- -- Initializations -- -- ## -- -- ## -- -- ## -- -- ##
   

##Title of Window
title = "BATTLESNAKES"

dimensions = [800, 600]
        
##Player Attribute Dimensions
spawnPoint = [80, 320]
playerFrame = [60, 80, 100]

window = window.window(dimensions[0], dimensions[1])
menu = menu.menu()
level = level.level(window, player)
player = player.player(spawnPoint[0], spawnPoint[1],playerFrame[1], playerFrame[1])


## -- -- ## -- -- ## -- -- ## -- -- Main loop -- -- ## -- -- ## -- -- ## -- -- ##


##Initialization
pygame.init()
pygame.font.init()

##SFX Start
#Music 
pygame.mixer.music.load('sfx/Pulsar.wav')
Esempio n. 24
0
 def test_window_size_0(self):
     self.assertIterableEqual(window([1, 2, 3], 0), [])
     self.assertIterableEqual(window([], 0), [])
Esempio n. 25
0
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
'''
/*
 * @Author: Jeay 
 * @Date: 2018-05-21 08:00:24 
 * @Last Modified by: Jeay
 * @Last Modified time: 2018-05-21 08:04:20
 */
'''

import window

window.window()
Esempio n. 26
0
 def test_accepts_iterator(self):
     inputs = (n**2 for n in [1, 2, 3, 4])
     outputs = [(1, 4), (4, 9), (9, 16)]
     self.assertIterableEqual(window(inputs, 2), outputs)
Esempio n. 27
0
 def __init__(self):
     self.app = QApplication([])
     self.main_window = window()
     self.main_window.show()
     self.app.exec_()
Esempio n. 28
0
 def test_string(self):
     inputs = "hey"
     outputs = [("h", "e"), ("e", "y")]
     self.assertIterableEqual(window(inputs, 2), outputs)
Esempio n. 29
0
    def __init__(self):
        self.keyboard = np.zeros((16, ), dtype=np.uint8)
        self.reg = np.zeros((16, ), dtype=np.uint8)

        self.mem = np.zeros((4096, ), dtype=np.uint8)

        self.stack = np.zeros((16, ), dtype=np.uint16)
        self.stack_pointer = 0

        self.gfx = np.zeros((64 * 32, ), dtype=np.uint8)

        self.pc = 0x200
        self.I = 0

        self.sound_timer = 0
        self.delay_timer = 0

        self.inst = -1

        self.print_memory = False

        self.WINDOW_HIGHT = 32
        self.WINDOW_WIDTH = 64
        self.PIXEL_SIZE = 10
        self.DRAW_COLOR = (0, 0, 0)

        self.wind = window(self.PIXEL_SIZE * self.WINDOW_WIDTH,
                           self.PIXEL_SIZE * self.WINDOW_HIGHT,
                           self.DRAW_COLOR)

        self.wind.draw_window()

        self.lookup_special_ops = {
            0x00E0: self.clear_screen,
            0x00EE: self.return_from_subroutine
        }

        self.lookup_vx_vy = {
            0x5000: self.skip_vx_vy_equal,
            0x8000: self.store_vy_in_vx,
            0x8001: self.set_vx_to_vx_or_vy,
            0x8002: self.set_vx_to_vx_and_vy,
            0x8003: self.set_vx_to_vx_xor_vy,
            0x8004: self.add_vy_to_vx,
            0x8005: self.subtract_vy_from_vx,
            0x8006: self.shift_vx_left_1,
            0x8007: self.subtract_vy_from_vx,
            0x800e: self.shift_vx_left_1,
            0x9000: self.skip_vx_vy_not_equal
        }

        self.lookup_nnn = {
            0x0000: self.jump_machine_language_subrutine_at_nnn,
            0x1000: self.jump_to_address_nnn,
            0x2000: self.execute_subroutine_at_nnn,
            0xA000: self.store_nnn_in_i_register,
        }

        self.lookup_vx_byte = {
            0x3000: self.skip_vx_nn_equal,
            0x4000: self.skip_vx_nn_not_equal,
            0x6000: self.store_nn_in_vx,
            0x7000: self.add_nn_to_vx,
            0xc000: self.set_vx_to_random_number_with_mask_nn,
            0xd000: self.draw_sprite_at_position_vx_vy
        }

        self.lookup_vx = {
            0xE09E: self.skip_on_key_pressed,
            0xE0A1: self.skip_on_key_not_press,
            0xF007: self.store_delay_in_vx,
            0xF00A: self.wait_for_keypress_store_result_in_vx,
            0xF015: self.set_delay_timer_to_vx,
            0xF018: self.set_sound_timer_to_vx,
            0xF01E: self.add_vx_to_register_i,
            0xF029: self.set_i_to_sprite_address,
            0xF033: self.store_bcd_of_vx,
            0xF055: self.store_v0_to_vx_in_memory,
            0xF065: self.fill_registers_with_memory_starting_at_i
        }

        self.debug = False
Esempio n. 30
0
 def commit_username():
     alias_name = input_text.get()
     inital_root.destroy()
     window.window(alias_name)
Esempio n. 31
0
from window import window
'''
Inicio do main - inicio da aplicacao shisen sho
'''
principal = window()

if __name__ == '__main__':
    principal.inicializa()