def test_bug_10(self): """Adding nodes when the correct root dimensions are still unknown should not raise an error. """ layout = Plasma() layout.add(object()) layout.add(object())
def group_velocity(soln): coils = np.array([-0.63, 0.63]) p = Plasma(0.3, coils) for i in range(0, 582): #soln[:,1].size,10): print i z = soln[i, 0] x = soln[i, 1] #p = Plasma(1) X = p.X([z, x]) Y = p.Yabs([z, x]) gamma = p.gamma(1) Nz = soln[i, 2] Nx = soln[i, 3] localN = Local_N(p.Yvec([z, x]), p.gradY([z, x]), np.array([Nz, Nx])) dNz_dN = localN.dNz_dN() dNx_dN = localN.dNx_dN() localNz = localN.Nz() localNx = localN.Nx() vgz.append((dD_dN(X, Y, gamma, localNz, localNx, dNz_dN, dNx_dN)[0] / dD_dw(X, Y, gamma, localNz, localNx))) vgx.append((dD_dN(X, Y, gamma, localNz, localNx, dNz_dN, dNx_dN)[1] / dD_dw(X, Y, gamma, localNz, localNx))) lNz.append(localN.Nz()) #print z,x,X,Y,Nz,Nx#dD_dN( X,Y,gamma,localNz,localNx,dNz_dN,dNx_dN )[0] , dD_dw( X,Y,gamma,localNz,localNx ) return np.array(vgz), np.array(vgx)
def test_access(self, root): layout = Plasma() layout.root = root layout.add('a') now = datetime.now() assert layout.root.find_payload('a').last_accessed < now layout.focus('a') assert layout.root.find_payload('a').last_accessed > now
def test_focus(self, root): layout = Plasma() layout.root = root a, b, c, d = 'abcd' layout.add(a) layout.add(b) layout.add(c) layout.add(d) assert layout.focus_first() == 'a' assert layout.focus_last() == 'd' assert layout.focus_next('b') == 'c' assert layout.focus_previous('c') == 'b' layout.focus('c') assert layout.focused is c
def checkNx(soln): p = Plasma(0.5, np.array([-1, 1])) i = 0 for x in soln[10345:10370, 1]: r = np.array([soln[i, 0], soln[i, 1]]) locN = Local_N(p.Yvec(r), p.gradY(r), np.array([soln[i, 2], soln[i, 3]])) print locN.Nx(), locN.Nz() plt.scatter(x, locN.Nx()) plt.scatter(x, locN.Nz()) i += 1
class Config: auto_fullscreen = True main = None groups = [ config.Group('g0'), config.Group('g1'), config.Group('g2'), config.Group('g3') ] layouts = [Plasma()] floating_layout = Floating() keys = [] mouse = [] screens = [] follow_mouse_focus = False
layout.TreeTab(font="Ubuntu", fontsize=10, sections=["FIRST", "SECOND"], section_fontsize=11, bg_color="141414", active_bg="90C435", active_fg="000000", inactive_bg="384323", inactive_fg="a0a0a0", padding_y=5, section_top=10, panel_width=320), Plasma(border_normal="#2d3c4a", border_focus="#517cb0", border_normal_fixed="#2d3c4a", border_focus_fixed="#517cb0", border_width=2, border_width_single=2, margin=7), layout.VerticalTile(**layout_theme), layout.Floating(**layout_theme), layout.RatioTile(**layout_theme), layout.Max(**layout_theme) ] # COLORS FOR THE BAR def init_colors(): return [ ["#2f343f", "#2F343F"], # color 0
keys.append(Key([mod], workspace["key"], lazy.group[workspace["name"]].toscreen())) keys.append(Key([mod, "shift"], workspace["key"], lazy.window.togroup(workspace["name"]))) ##### DEFAULT THEME SETTINGS FOR LAYOUTS ##### layout_theme = {"border_width": 3, "margin": 16, "border_focus": BLUE, "border_normal": BLACK } layouts = [ Plasma( border_normal_fixed=BLACK, border_focus_fixed=CYAN, border_width_single=5, **layout_theme, ), layout.MonadTall(**layout_theme), layout.Stack(num_stacks=2, **layout_theme), # layout.Max(), # Try more layouts by unleashing below layouts. layout.Bsp(**layout_theme), # layout.Columns(), # layout.Matrix(), # layout.MonadWide(), # layout.RatioTile(), # layout.Tile(), # layout.TreeTab(), # layout.VerticalTile(), # layout.Zoomy(),
# keys for scratchpads keys.append(EzKey('M-<Down>', lazy.group['SPD'].dropdown_toggle("term"))) keys.append(EzKey('M-m', lazy.group['SPD'].dropdown_toggle("music"))) layout_cfg = dict( border_focus='#79740e', border_normal='#282828', border_width=1, border_width_single=0, margin=10, margin_single=0, ) layouts = [ Plasma(**layout_cfg), # layout.Bsp(**layout_cfg), # I prefer Plasma layout.Tile(**layout_cfg), layout.Max(), ] widget_defaults = dict( font='MesloLGS Nerd Font', fontsize=14, padding=3, ) groupbox_config = dict( urgent_alert_method='text', highlight_method="line", highlight_color=[color(6), color(14)],
from __future__ import division import numpy as np import matplotlib.pyplot as plt from hotDiTen import HotDiTen from plasma import Plasma from local_N import Local_N from derivForHamEq_EBW2 import * p = Plasma(0.5, np.array([-1,1])) #X = p.X() def check_hdt(soln): #ind=np.where(np.isnan(soln[:,3]))[0][0] #print ind #ind = ind - 1 ind = soln[:-1,3].size-1 r = [soln[ind-1,0],soln[ind-1,1]] Nz = soln[ind-1,2] Nx = soln[ind-1,3] globalN = np.array([Nz,Nx]) locN = Local_N(p.Yvec(r), p.gradY(r),globalN) hdt = HotDiTen(p.X(r),p.Yabs(r),p.gamma(r),locN.Nz(),locN.Nx(),20) print "lam",hdt.lam() print "zeta",hdt.zeta(10)
for a, i in enumerate(groups): keys.extend([ # mod1 + letter of group = switch to group Key([MOD], wps_shortcuts[a], lazy.group[i.name].toscreen()), # mod1 + shift + letter of group = switch to & move focused window to group Key([MOD, "shift"], wps_shortcuts[a], lazy.window.togroup(i.name)), ]) layouts = [ Plasma( border_normal='#333333', border_focus="#b5ded6", border_normal_fixed='#006863', border_focus_fixed='#00e8dc', border_width=2, border_width_single=1, margin=20 ) ] widget_defaults = dict( font='FontAwesome', fontsize=13, padding=3, ) extension_defaults = widget_defaults.copy() # Drag floating layouts. mouse = [
from lighthouse import Lighthouse lenx = 7 leny = 21 strip2D = Strip2D(lenx, leny) effects = [ [Police1(strip2D), 3], [Rainbow(strip2D), 10], [Police2(strip2D), 3], [Bump1(strip2D), 3], [Police3(strip2D), 3], [Lemmings1(strip2D), 10], [CMorph(strip2D), 7], [Plasma(strip2D), 30], [Fire(strip2D), 30], [Fire2(strip2D), 30], [Night(strip2D), 30], [Fade1(strip2D), 3], [Fade2(strip2D), 3], [Stars1(strip2D), 15], [Stars2(strip2D), 10], [Hourglass(strip2D), 30], [Matrix(strip2D), 20], [Power(strip2D), 12], [Weird1(strip2D), 12], [Weird2(strip2D), 12], [Weird3(strip2D), 20], [Lighthouse(strip2D), 10], [Flash(strip2D), 10],
def test_init(self): layout = Plasma() assert isinstance(layout.root, Node)
import numpy as np import matplotlib.pyplot as plt from plasma import Plasma a = 0.38 coils = np.array([-0.63, 0.63], np.newaxis) p = Plasma(a, coils) plotX = np.zeros((500, 500)) plotY = np.zeros((500, 500)) plotYx = np.zeros((500, 500)) plotYz = np.zeros((500, 500)) plotFlux = np.zeros((500, 500)) i = 0 for z in np.linspace(-0.63, 0.63, 500): j = 0 for x in np.linspace(-0.38, 0.38, 500): plotX[i, j] = p.X(np.array([z, x])) plotY[i, j] = p.Yabs(np.array([z, x])) plotYx[i, j] = p.Yx(np.array([z, x])) plotYz[i, j] = p.Yz(np.array([z, x])) plotFlux[i, j] = p.flux(np.array([z, x])) j += 1 i += 1 #np.where(plotY)
i.name, lazy.group[i.name].toscreen(), desc="Switch to group {}".format(i.name)), Key([mod, "shift"], i.name, lazy.window.togroup(i.name, switch_group=True), desc="Switch to & move focused window to group {}".format(i.name)), ]) from plasma import Plasma layouts = [ Plasma(border_normal='#333333', border_focus='#00e891', border_normal_fixed='#006863', border_focus_fixed='#00e8dc', border_width=1, border_width_single=0, margin=5), layout.Max(), # Try more layouts by unleashing below layouts. # layout.Stack(num_stacks=2), # layout.Bsp(), # layout.Columns(), # layout.Matrix(), # layout.MonadTall(), # layout.MonadWide(), # layout.RatioTile(), # layout.Tile(), # layout.TreeTab(), # layout.VerticalTile(),
def shoot(self): self.all_plasma.add(Plasma(self.weapon)) Sounds.lazer.play() self.weapon.reset()
def main(): import argparse import os os.system('') parser = argparse.ArgumentParser(description='Display image to terminal') parser.add_argument('-img', help='Image file to display', default=None) parser.add_argument('-plasma', action='store_true') parser.add_argument('-width', default=78, help='Character width of output', type=int) parser.add_argument('-vid', help='Show video, default is usb camera', default='') parser.add_argument('-col', help='Colour scheme to use', choices=[4, 8, 24], default=8, type=int) parser.add_argument('-cl', help='Use opencl', action='store_true') args = parser.parse_args() fname = args.img my_width = args.width print("\x1b[2J") if args.plasma: rows, columns = [ int(x.decode('ascii')) for x in subprocess.check_output(['stty', 'size']).split() ] plasma_gen = Plasma(rows, columns) count = 0 start_time = time() while 1: print("\x1b[;H", img_24bit(plasma_gen(), rows, columns), '\x1B[0m', sep='') print("FPS:", count / (time() - start_time)) count += 1 if args.cl: lut = {4: cols_4bit_items, 8: cols}[args.col] cl, cl_func, queue, ctx, g_lut, g_lut_idx = fast_setup(lut) # g_img_a = {'img': None} def func(img, height, width): # if g_img_a['img'] is None: # g_img_a['img'] = cl.Buffer(ctx, cl.mem_flags.READ_WRITE, img.nbytes) # cl.enqueue_copy(queue, g_img_a['img'], img).wait() mapped = img_fast(cl, img, height, width, cl_func, queue, ctx, g_lut, g_lut_idx) out = [] for y in range(height // 2): y2 = 2 * y for x in range(width): top_pxl = str(mapped[y2, x]) bot_pxl = str(mapped[y2 + 1, x]) out.append(''.join( ("\x1B[38;5;", top_pxl, ";48;5;", bot_pxl, "m▀"))) out.append('\n') return ''.join(out) else: func = {4: img_4bit, 8: img_8bit, 24: img_24bit}[args.col] # print("\x1b[2J") if fname: image = cv2.imread(fname) new_size = get_new_size(my_width, image) image = cv2.resize(src=image, dsize=new_size) # import matplotlib.pyplot as plt # plt.imshow(image[:,:,::-1]) # plt.show() chars = func(image, new_size[1], new_size[0]) print("\x1b[;H", chars, '\x1b[0m', sep='') else: if args.vid == '': cam = cv2.VideoCapture(0) else: cam = cv2.VideoCapture(args.vid) start_time = time() count = 0 retval, image = cam.read() new_size = get_new_size(my_width, image) while 1: if not cam.isOpened(): break try: retval, image = cam.read() if retval != 1: break image = cv2.resize(src=image, dsize=new_size) print("\x1b[;H", func(image, new_size[1], new_size[0]), '\x1B[0m', sep='') print("FPS:", count / (time() - start_time)) count += 1 except KeyboardInterrupt: print("FPS:", count / (time() - start_time)) break cam.release()
"margin": 6, "border_focus": "e1acff", "border_normal": "1D2330" } layouts = [ #layout.Bsp(**layout_theme), #layout.Stack(stacks=2, **layout_theme), #layout.Columns(**layout_theme), #layout.RatioTile(**layout_theme), #layout.Tile(shift_windows=True, **layout_theme), #layout.VerticalTile(**layout_theme), #layout.Zoomy(**layout_theme), layout.MonadTall(**layout_theme), layout.MonadWide(**layout_theme), Plasma(**layout_theme), layout.Matrix(**layout_theme), layout.Max(**layout_theme), layout.Stack(num_stacks=2), layout.RatioTile(**layout_theme), #layout.TreeTab( # font = "Ubuntu", # fontsize = 10, # sections = ["FIRST", "SECOND", "THIRD", "FOURTH"], # section_fontsize = 10, # border_width = 2, # bg_color = "1c1f24", # active_bg = "c678dd", # active_fg = "000000", # inactive_bg = "a9a1e1", # inactive_fg = "1c1f24",