How to use frames method in storybook-root

Best JavaScript code snippet using storybook-root

TestVSCode_stackTrace.py

Source:TestVSCode_stackTrace.py Github

copy

Full Screen

1"""2Test lldb-vscode setBreakpoints request3"""4from __future__ import print_function5import unittest26import vscode7from lldbsuite.test.decorators import *8from lldbsuite.test.lldbtest import *9from lldbsuite.test import lldbutil10import lldbvscode_testcase11import os12class TestVSCode_stackTrace(lldbvscode_testcase.VSCodeTestCaseBase):13 mydir = TestBase.compute_mydir(__file__)14 name_key_path = ['name']15 source_key_path = ['source', 'path']16 line_key_path = ['line']17 def verify_stackFrames(self, start_idx, stackFrames):18 frame_idx = start_idx19 for stackFrame in stackFrames:20 # Don't care about frame above main21 if frame_idx > 20:22 return23 self.verify_stackFrame(frame_idx, stackFrame)24 frame_idx += 125 def verify_stackFrame(self, frame_idx, stackFrame):26 frame_name = self.get_dict_value(stackFrame, self.name_key_path)27 frame_source = self.get_dict_value(stackFrame, self.source_key_path)28 frame_line = self.get_dict_value(stackFrame, self.line_key_path)29 if frame_idx == 0:30 expected_line = self.recurse_end31 expected_name = 'recurse'32 elif frame_idx < 20:33 expected_line = self.recurse_call34 expected_name = 'recurse'35 else:36 expected_line = self.recurse_invocation37 expected_name = 'main'38 self.assertTrue(frame_name == expected_name,39 'frame #%i name "%s" == "%s"' % (40 frame_idx, frame_name, expected_name))41 self.assertTrue(frame_source == self.source_path,42 'frame #%i source "%s" == "%s"' % (43 frame_idx, frame_source, self.source_path))44 self.assertTrue(frame_line == expected_line,45 'frame #%i line %i == %i' % (frame_idx, frame_line,46 expected_line))47 @skipIfWindows48 @skipIfDarwin # Skip this test for now until we can figure out why tings aren't working on build bots49 @no_debug_info_test50 def test_stackTrace(self):51 '''52 Tests the 'stackTrace' packet and all its variants.53 '''54 program = self.getBuildArtifact("a.out")55 self.build_and_launch(program)56 source = 'main.c'57 self.source_path = os.path.join(os.getcwd(), source)58 self.recurse_end = line_number(source, 'recurse end')59 self.recurse_call = line_number(source, 'recurse call')60 self.recurse_invocation = line_number(source, 'recurse invocation')61 lines = [self.recurse_end]62 # Set breakoint at a point of deepest recuusion63 breakpoint_ids = self.set_source_breakpoints(source, lines)64 self.assertTrue(len(breakpoint_ids) == len(lines),65 "expect correct number of breakpoints")66 self.continue_to_breakpoints(breakpoint_ids)67 startFrame = 068 # Verify we get all stack frames with no arguments69 stackFrames = self.get_stackFrames()70 frameCount = len(stackFrames)71 self.assertTrue(frameCount >= 20,72 'verify we get at least 20 frames for all frames')73 self.verify_stackFrames(startFrame, stackFrames)74 # Verify all stack frames by specifying startFrame = 0 and levels not75 # specified76 stackFrames = self.get_stackFrames(startFrame=startFrame)77 self.assertTrue(frameCount == len(stackFrames),78 ('verify same number of frames with startFrame=%i') % (79 startFrame))80 self.verify_stackFrames(startFrame, stackFrames)81 # Verify all stack frames by specifying startFrame = 0 and levels = 082 levels = 083 stackFrames = self.get_stackFrames(startFrame=startFrame,84 levels=levels)85 self.assertTrue(frameCount == len(stackFrames),86 ('verify same number of frames with startFrame=%i and'87 ' levels=%i') % (startFrame, levels))88 self.verify_stackFrames(startFrame, stackFrames)89 # Get only the first stack frame by sepcifying startFrame = 0 and90 # levels = 191 levels = 192 stackFrames = self.get_stackFrames(startFrame=startFrame,93 levels=levels)94 self.assertTrue(levels == len(stackFrames),95 ('verify one frame with startFrame=%i and'96 ' levels=%i') % (startFrame, levels))97 self.verify_stackFrames(startFrame, stackFrames)98 # Get only the first 3 stack frames by sepcifying startFrame = 0 and99 # levels = 3100 levels = 3101 stackFrames = self.get_stackFrames(startFrame=startFrame,102 levels=levels)103 self.assertTrue(levels == len(stackFrames),104 ('verify %i frames with startFrame=%i and'105 ' levels=%i') % (levels, startFrame, levels))106 self.verify_stackFrames(startFrame, stackFrames)107 # Get only the first 15 stack frames by sepcifying startFrame = 5 and108 # levels = 16109 startFrame = 5110 levels = 16111 stackFrames = self.get_stackFrames(startFrame=startFrame,112 levels=levels)113 self.assertTrue(levels == len(stackFrames),114 ('verify %i frames with startFrame=%i and'115 ' levels=%i') % (levels, startFrame, levels))116 self.verify_stackFrames(startFrame, stackFrames)117 # Verify we cap things correctly when we ask for too many frames118 startFrame = 5119 levels = 1000120 stackFrames = self.get_stackFrames(startFrame=startFrame,121 levels=levels)122 self.assertTrue(len(stackFrames) == frameCount - startFrame,123 ('verify less than 1000 frames with startFrame=%i and'124 ' levels=%i') % (startFrame, levels))125 self.verify_stackFrames(startFrame, stackFrames)126 # Verify level=0 works with non-zerp start frame127 startFrame = 5128 levels = 0129 stackFrames = self.get_stackFrames(startFrame=startFrame,130 levels=levels)131 self.assertTrue(len(stackFrames) == frameCount - startFrame,132 ('verify less than 1000 frames with startFrame=%i and'133 ' levels=%i') % (startFrame, levels))134 self.verify_stackFrames(startFrame, stackFrames)135 # Verify we get not frames when startFrame is too high136 startFrame = 1000137 levels = 1138 stackFrames = self.get_stackFrames(startFrame=startFrame,139 levels=levels)140 self.assertTrue(0 == len(stackFrames),...

Full Screen

Full Screen

get_raw_skes_data.py

Source:get_raw_skes_data.py Github

copy

Full Screen

1# Copyright (c) Microsoft Corporation. All rights reserved.2# Licensed under the MIT License.3import os.path as osp4import os5import numpy as np6import pickle7import logging8import gc910def get_raw_bodies_data(skes_path, ske_name, frames_drop_skes, frames_drop_logger):11 """12 Get raw bodies data from a skeleton sequence.1314 Each body's data is a dict that contains the following keys:15 - joints: raw 3D joints positions. Shape: (num_frames x 25, 3)16 - colors: raw 2D color locations. Shape: (num_frames, 25, 2)17 - interval: a list which stores the frame indices of this body.18 - motion: motion amount (only for the sequence with 2 or more bodyIDs).1920 Return:21 a dict for a skeleton sequence with 3 key-value pairs:22 - name: the skeleton filename.23 - data: a dict which stores raw data of each body.24 - num_frames: the number of valid frames.25 """26 ske_file = osp.join(skes_path, ske_name + '.skeleton')27 assert osp.exists(ske_file), 'Error: Skeleton file %s not found' % ske_file28 # Read all data from .skeleton file into a list (in string format)29 # print('Reading data from %s' % ske_file[-29:])30 with open(ske_file, 'r') as fr:31 str_data = fr.readlines()3233 num_frames = int(str_data[0].strip('\r\n'))34 frames_drop = []35 bodies_data = dict()36 valid_frames = -1 # 0-based index37 current_line = 13839 for f in range(num_frames):40 num_bodies = int(str_data[current_line].strip('\r\n'))41 current_line += 14243 if num_bodies == 0: # no data in this frame, drop it44 frames_drop.append(f) # 0-based index45 continue4647 valid_frames += 148 joints = np.zeros((num_bodies, 25, 3), dtype=np.float32)49 colors = np.zeros((num_bodies, 25, 2), dtype=np.float32)5051 for b in range(num_bodies):52 bodyID = str_data[current_line].strip('\r\n').split()[0]53 current_line += 154 num_joints = int(str_data[current_line].strip('\r\n')) # 25 joints55 current_line += 15657 for j in range(num_joints):58 temp_str = str_data[current_line].strip('\r\n').split()59 joints[b, j, :] = np.array(temp_str[:3], dtype=np.float32)60 colors[b, j, :] = np.array(temp_str[5:7], dtype=np.float32)61 current_line += 16263 if bodyID not in bodies_data: # Add a new body's data64 body_data = dict()65 body_data['joints'] = joints[b] # ndarray: (25, 3)66 body_data['colors'] = colors[b, np.newaxis] # ndarray: (1, 25, 2)67 body_data['interval'] = [valid_frames] # the index of the first frame68 else: # Update an already existed body's data69 body_data = bodies_data[bodyID]70 # Stack each body's data of each frame along the frame order71 body_data['joints'] = np.vstack((body_data['joints'], joints[b]))72 body_data['colors'] = np.vstack((body_data['colors'], colors[b, np.newaxis]))73 pre_frame_idx = body_data['interval'][-1]74 body_data['interval'].append(pre_frame_idx + 1) # add a new frame index7576 bodies_data[bodyID] = body_data # Update bodies_data7778 num_frames_drop = len(frames_drop)79 assert num_frames_drop < num_frames, \80 'Error: All frames data (%d) of %s is missing or lost' % (num_frames, ske_name)81 if num_frames_drop > 0:82 frames_drop_skes[ske_name] = np.array(frames_drop, dtype=np.int)83 frames_drop_logger.info('{}: {} frames missed: {}\n'.format(ske_name, num_frames_drop,84 frames_drop))8586 # Calculate motion (only for the sequence with 2 or more bodyIDs)87 if len(bodies_data) > 1:88 for body_data in bodies_data.values():89 body_data['motion'] = np.sum(np.var(body_data['joints'], axis=0))9091 return {'name': ske_name, 'data': bodies_data, 'num_frames': num_frames - num_frames_drop}929394def get_raw_skes_data():95 skes_name = np.loadtxt(skes_name_file, dtype=str)9697 num_files = skes_name.size98 print('Found %d available skeleton files.' % num_files) # 56578 for rgbd-6099100 raw_skes_data = []101 frames_cnt = np.zeros(num_files, dtype=np.int)102103 for (idx, ske_name) in enumerate(skes_name):104 ##############################################105 gc.collect()106 if idx == 0:107 skes_path = '/content/skeleton1/nturgb+d_skeletons/'108 if idx == 56578:109 skes_path = '/content/skeleton2/'110 ##############################################111 bodies_data = get_raw_bodies_data(skes_path, ske_name, frames_drop_skes, frames_drop_logger)112 raw_skes_data.append(bodies_data)113 frames_cnt[idx] = bodies_data['num_frames']114 if (idx + 1) % 1000 == 0:115 print('Processed: %.2f%% (%d / %d)' % \116 (100.0 * (idx + 1) / num_files, idx + 1, num_files))117118 with open(save_data_pkl, 'wb') as fw:119 pickle.dump(raw_skes_data, fw, pickle.HIGHEST_PROTOCOL)120 np.savetxt(osp.join(save_path, 'raw_data', 'frames_cnt.txt'), frames_cnt, fmt='%d')121122 print('Saved raw bodies data into %s' % save_data_pkl)123 print('Total frames: %d' % np.sum(frames_cnt))124125 with open(frames_drop_pkl, 'wb') as fw:126 pickle.dump(frames_drop_skes, fw, pickle.HIGHEST_PROTOCOL)127128if __name__ == '__main__':129 save_path = './'130131 stat_path = osp.join(save_path, 'statistics')132 if not osp.exists('./raw_data'):133 os.makedirs('./raw_data')134135 skes_name_file = osp.join(stat_path, 'skes_available_name.txt')136 save_data_pkl = osp.join(save_path, 'raw_data', 'raw_skes_data.pkl')137 frames_drop_pkl = osp.join(save_path, 'raw_data', 'frames_drop_skes.pkl')138139 frames_drop_logger = logging.getLogger('frames_drop')140 frames_drop_logger.setLevel(logging.INFO)141 frames_drop_logger.addHandler(logging.FileHandler(osp.join(save_path, 'raw_data', 'frames_drop.log')))142 frames_drop_skes = dict()143144 get_raw_skes_data()145146 with open(frames_drop_pkl, 'wb') as fw: ...

Full Screen

Full Screen

pydevd_custom_frames.py

Source:pydevd_custom_frames.py Github

copy

Full Screen

1from _pydevd_bundle.pydevd_constants import get_thread_id, Null2from pydevd_file_utils import get_abs_path_real_path_and_base_from_frame3from _pydev_imps._pydev_saved_modules import thread, threading4import sys5DEBUG = False6#=======================================================================================================================7# CustomFramesContainer8#=======================================================================================================================9class CustomFramesContainer:10 # Actual Values initialized later on.11 custom_frames_lock = None #: :type custom_frames_lock: threading.Lock12 custom_frames = None13 _next_frame_id = None14 _py_db_command_thread_event = None15def custom_frames_container_init(): #Note: no staticmethod on jython 2.1 (so, use free-function)16 CustomFramesContainer.custom_frames_lock = thread.allocate_lock()17 # custom_frames can only be accessed if properly locked with custom_frames_lock!18 # Key is a string identifying the frame (as well as the thread it belongs to).19 # Value is a CustomFrame.20 #21 CustomFramesContainer.custom_frames = {}22 # Only to be used in this module23 CustomFramesContainer._next_frame_id = 024 # This is the event we must set to release an internal process events. It's later set by the actual debugger25 # when we do create the debugger.26 CustomFramesContainer._py_db_command_thread_event = Null()27#Initialize it the first time (it may be reinitialized later on when dealing with a fork).28custom_frames_container_init()29#=======================================================================================================================30# CustomFrame31#=======================================================================================================================32class CustomFrame:33 def __init__(self, name, frame, thread_id):34 # 0 = string with the representation of that frame35 self.name = name36 # 1 = the frame to show37 self.frame = frame38 # 2 = an integer identifying the last time the frame was changed.39 self.mod_time = 040 # 3 = the thread id of the given frame41 self.thread_id = thread_id42def add_custom_frame(frame, name, thread_id):43 CustomFramesContainer.custom_frames_lock.acquire()44 try:45 curr_thread_id = get_thread_id(threading.currentThread())46 next_id = CustomFramesContainer._next_frame_id = CustomFramesContainer._next_frame_id + 147 # Note: the frame id kept contains an id and thread information on the thread where the frame was added48 # so that later on we can check if the frame is from the current thread by doing frame_id.endswith('|'+thread_id).49 frame_id = '__frame__:%s|%s' % (next_id, curr_thread_id)50 if DEBUG:51 sys.stderr.write('add_custom_frame: %s (%s) %s %s\n' % (52 frame_id, get_abs_path_real_path_and_base_from_frame(frame)[-1], frame.f_lineno, frame.f_code.co_name))53 CustomFramesContainer.custom_frames[frame_id] = CustomFrame(name, frame, thread_id)54 CustomFramesContainer._py_db_command_thread_event.set()55 return frame_id56 finally:57 CustomFramesContainer.custom_frames_lock.release()58addCustomFrame = add_custom_frame # Backward compatibility59def update_custom_frame(frame_id, frame, thread_id, name=None):60 CustomFramesContainer.custom_frames_lock.acquire()61 try:62 if DEBUG:63 sys.stderr.write('update_custom_frame: %s\n' % frame_id)64 try:65 old = CustomFramesContainer.custom_frames[frame_id]66 if name is not None:67 old.name = name68 old.mod_time += 169 old.thread_id = thread_id70 except:71 sys.stderr.write('Unable to get frame to replace: %s\n' % (frame_id,))72 import traceback;traceback.print_exc()73 CustomFramesContainer._py_db_command_thread_event.set()74 finally:75 CustomFramesContainer.custom_frames_lock.release()76def get_custom_frame(thread_id, frame_id):77 '''78 :param thread_id: This should actually be the frame_id which is returned by add_custom_frame.79 :param frame_id: This is the actual id() of the frame80 '''81 CustomFramesContainer.custom_frames_lock.acquire()82 try:83 frame_id = int(frame_id)84 f = CustomFramesContainer.custom_frames[thread_id].frame85 while f is not None:86 if id(f) == frame_id:87 return f88 f = f.f_back89 finally:90 f = None91 CustomFramesContainer.custom_frames_lock.release()92def remove_custom_frame(frame_id):93 CustomFramesContainer.custom_frames_lock.acquire()94 try:95 if DEBUG:96 sys.stderr.write('remove_custom_frame: %s\n' % frame_id)97 CustomFramesContainer.custom_frames.pop(frame_id, None)98 CustomFramesContainer._py_db_command_thread_event.set()99 finally:100 CustomFramesContainer.custom_frames_lock.release()...

Full Screen

Full Screen

calculateExtractiveSummaryAccuracy.py

Source:calculateExtractiveSummaryAccuracy.py Github

copy

Full Screen

1import sys2import os3import csv4startFrames = []5endFrames = []6writer = 07FL =["FL"]8DM = ["DM"]9FB1 = ["FB1"]10FB2 = ["FB2"]11FB3 = ["FB3"]12def runAlgo(folder, experiment):13 print folder14 print experiment15 path = os.path.join(folder, experiment)16 path = os.path.join(path, "keyFrames")17 imageFrames = []18 imageExtension = ".jpg"19 for image in os.listdir(path):20 if image.endswith(imageExtension):21 image = image[:-len(imageExtension)]22 imageFrames.append(int(image))23 imageFrames.sort()24 print "Keyframes:"25 print "\t" + str(imageFrames)26 shotIndex = 027 truePositive = 028 trueNegative = 029 falsePositive = 030 falseNegative = 031 shotScore = 032 for keyframe in imageFrames:33 for i in range(0, len(startFrames)-1):34 if keyframe >= startFrames[i] and keyframe <= startFrames[i+1]:35 shotIndex = i36 break37 # print "Keyframe " + str(keyframe)38 # print "Shot index " + str(shotIndex)39 # print "Start frame " + str(startFrames[shotIndex])40 # print "End frame " + str(endFrames[shotIndex])41 if keyframe >= startFrames[shotIndex] and keyframe <= endFrames[shotIndex]:42 truePositive = truePositive + 143 print "Adding " + str(keyframe)44 else:45 falsePositive = falsePositive + 146 for i in range(0, len(startFrames)):47 shotList = list(range(startFrames[i],endFrames[i]))48 # print "Start: " + str(startFrames[i])49 # print "End: " + str(endFrames[i])50 # print "ShotList " + str(shotList)51 exclusionList = set(shotList) - set(imageFrames)52 print "Exclusion " + str(exclusionList)53 falseNegative = falseNegative + len(exclusionList)54 commonSet = list(set(shotList).intersection(imageFrames))55 print "Common " + str(commonSet)56 if len(commonSet) > 0:57 shotScore = shotScore + 158 # break59 print "True Positive " + str(truePositive)60 print "False Positive " + str(falsePositive)61 print "False Negative " + str(falseNegative)62 shotScoreScaled = float(shotScore)/len(startFrames)63 print "Shot Score " + str(shotScoreScaled)64 if "FL" in experiment:65 FL.append("="+str(shotScore)+"/"+str(len(startFrames)))66 elif "DM" in experiment:67 DM.append("="+str(shotScore)+"/"+str(len(startFrames)))68 elif "FB1" in experiment:69 FB1.append("="+str(shotScore)+"/"+str(len(startFrames)))70 elif "FB2" in experiment:71 FB2.append("="+str(shotScore)+"/"+str(len(startFrames)))72 elif "FB3" in experiment:73 FB3.append("="+str(shotScore)+"/"+str(len(startFrames)))74if __name__ == "__main__":75 if len(sys.argv) < 4:76 print "\n\nUSAGE: calculateExtractiveSummaryAccuracy.py <shot/video/location> <keyframes/folder> <output/csv/file/path>\n\n"77 sys.exit()78 shotFolder = sys.argv[1]79 resultsFolder = sys.argv[2]80 outputFilePath = sys.argv[3]81 csvFile = open(outputFilePath, "wb")82 writer = csv.writer(csvFile, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)83 rowData = ["Shot Path", shotFolder]84 writer.writerow(rowData)85 rowData = ["Keyframe folder", resultsFolder]86 writer.writerow(rowData)87 for file in os.listdir(shotFolder):88 if file.endswith(".avi"):89 file = file[:-4]90 splitData = file.split("-")91 startFrames.append(int(splitData[0]))92 endFrames.append(int(splitData[1]))93 startFrames.sort()94 print "Start times:"95 print "\t" + str(startFrames)96 endFrames.sort()97 print "End times:"98 print "\t" + str(endFrames)99 print "Start Frame count " + str(len(startFrames))100 print "End Frame count " + str(len(endFrames))101 print "Shot data ready"102 subFolders = [int(d[:-1]) for d in os.listdir(resultsFolder) if os.path.isdir(os.path.join(resultsFolder, d))]103 # print subFolders104 subFolders.sort()105 # print subFolders106 writer.writerow([""]+subFolders)107 for folder in subFolders:108 folderName = str(folder) + "%"109 folderPath = os.path.join(resultsFolder, folderName)110 experimentFolders = [d for d in os.listdir(folderPath) if os.path.isdir(os.path.join(folderPath, d))]111 print experimentFolders112 for experiment in experimentFolders:113 path = os.path.join(folderPath,experiment)114 path = os.path.join(path, "keyFrames")115 runAlgo(folderPath, experiment)116 writer.writerow(FL)117 writer.writerow(DM)118 writer.writerow(FB1)119 writer.writerow(FB2)...

Full Screen

Full Screen

views.py

Source:views.py Github

copy

Full Screen

...28 return render(request, 'about.html') #the about page29def character(request):30 #return HttpResponse('character')31 return render(request, 'character.html')32def frames(request):33 #return HttpResponse('frames')34 return render(request,'frames.html')35def KanoHome(request):36 #return HttpResponse('Kano')37 KanoBasicFrames = KanoBasicAttack.objects.all()38 KanoStringFrames = KanoStringAttack.objects.all()39 KanoSpecialFrames = KanoSpecialAttack.objects.all()40 KanoRipperFrames = KanoRipperAttack.objects.all()41 KanoDirtbagFrames = KanoDirtbagAttack.objects.all()42 return render(request, 'KanoHome.html',43 {'KanoBasicFrames': KanoBasicFrames ,'KanoStringFrames': KanoStringFrames ,44 'KanoSpecialFrames': KanoSpecialFrames, 'KanoRipperFrames':KanoRipperFrames, 'KanoDirtbagFrames': KanoDirtbagFrames})45def NightwolfHome(request):46 #return HttpResponse('Nightwolf')...

Full Screen

Full Screen

vpxtest.py

Source:vpxtest.py Github

copy

Full Screen

...9def main():10 camera = Camera(0, dict(width=640, height=480))11 clock = Clock(RATE)12 # capture frames as scv images13 frames = list(capture_frames(camera, clock, NUM_FRAMES))14 print '=== REALTIME ==='15 decoded_frames = run_test(frames, vpx.VPX_DL_REALTIME)16 playback(clock, decoded_frames)17 print '=== GOOD QUALITY ==='18 decoded_frames = run_test(frames, vpx.VPX_DL_GOOD_QUALITY)19 playback(clock, decoded_frames)20 print '=== BEST QUALITY ==='21 decoded_frames = run_test(frames, vpx.VPX_DL_BEST_QUALITY)22 playback(clock, decoded_frames)23def capture_frames(camera, clock, num_frames):24 for fno in xrange(num_frames):25 clock.tick()26 yield camera.getImage()27def playback(clock, frames):28 for img in frames:29 clock.tick()30 img.show()31def run_test(frames, deadline):32 # Encode frames33 start = time.time()34 w,h = frames[0].width, frames[0].height35 clip = M.Clip.encode(w,h,frames, deadline=deadline)36 elapsed = time.time() - start37 print '%d frames encoded in %fs, %.2f fps (avg) (%d kB)' % (...

Full Screen

Full Screen

VideoFrame.py

Source:VideoFrame.py Github

copy

Full Screen

1"""Dummy Dataset and data loader for frames in single video."""2import os3import skvideo.io4import torch.utils.data as data5class VideoFrame(data.Dataset):6 """Dummy dataset for frames in single video."""7 def __init__(self, filepath, num_frames, transform=None):8 """Init VideoFrame dataset."""9 super(VideoFrame, self).__init__()10 self.filepath = filepath11 self.num_frames = num_frames12 self.transform = transform13 self.frames = None14 self.decode()15 def __getitem__(self, index):16 """Get frames from video."""17 frame = self.frames[index, ...]18 if self.transform is not None:19 frame = self.transform(frame)20 return frame21 def __len__(self):22 """Get number of the frames."""23 return self.num_frames24 def decode(self):25 """Decode frames from video."""26 if os.path.exists(self.filepath):27 try:28 self.frames = skvideo.io.vread(29 self.filepath, num_frames=self.num_frames)30 except AssertionError:31 self.frames = skvideo.io.vread(self.filepath)32 # return numpy.ndarray (N x H x W x C)33 self.frames = skvideo.utils.vshape(self.frames)34 self.num_frames = self.frames.shape[0]35 else:...

Full Screen

Full Screen

preprocessor.py

Source:preprocessor.py Github

copy

Full Screen

1import json2import numpy as np3import seaborn as sns4import matplotlib.pylab as plt5# Raw frames are joined into sequences of 16 frames (about 2 seconds each)6# The sequences are then saved as samples for training7raw_data_folder=r"C:\chalmers_thesis\data\TurnAround_201956203615"8destination_data_folder=r"C:\training_data\turn_around"9frames=[]10prefix="\\frame"11frame_rate=1612num_doppler_bins=1613num_range_bins=6414start_index=115end_index=1250+start_index+frame_rate16for i in range(start_index,end_index):17 frames.append(np.nan_to_num(np.array(json.load(open(raw_data_folder+prefix+str(i)+".txt")),dtype="float")[0:frame_rate,18:82]))18 frames[-1]=((frames[-1])/(np.max(frames[-1]))).tolist()19for i in range(len(frames)-frame_rate):20 sequence=[]21 sequence.append(frames[i])22 sequence.append(frames[i+1])23 sequence.append(frames[i+2])24 sequence.append(frames[i+3])25 sequence.append(frames[i+4])26 sequence.append(frames[i+5])27 sequence.append(frames[i+6])28 sequence.append(frames[i+7])29 sequence.append(frames[i+8])30 sequence.append(frames[i+9])31 sequence.append(frames[i+10])32 sequence.append(frames[i+11])33 sequence.append(frames[i+12])34 sequence.append(frames[i+13])35 sequence.append(frames[i+14])36 sequence.append(frames[i+15])...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { frames } from 'storybook-root';2import { frames } from 'storybook-root';3import { frames } from 'storybook-root';4import { frames } from 'storybook-root';5import { frames } from 'storybook-root';6import { frames } from 'storybook-root';7import { frames } from 'storybook-root';8import { frames } from 'storybook-root';9import { frames } from 'storybook-root';10import { frames } from 'storybook-root';11import { frames } from 'storybook-root';12import { frames } from 'storybook-root';13import { frames } from 'storybook-root';14import { frames } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/react';3import { Frame } from 'storybook-addon-frames';4const storybookRoot = storiesOf('storybook-root', module);5storybookRoot.add('frames', () => (6));7import React from 'react';8import { storiesOf } from '@storybook/react';9import { Frame } from 'storybook-addon-frames';10const storybookRoot = storiesOf('storybook-root', module);11storybookRoot.add('frames', () => (12));13import React from 'react';14import { storiesOf } from '@storybook/react';15import { Frame } from 'storybook-addon-frames';16const storybookRoot = storiesOf('storybook-root', module);17storybookRoot.add('frames', () => (18));19import React from 'react';20import { storiesOf } from '@storybook/react';21import { Frame } from 'storybook-addon-frames';22const storybookRoot = storiesOf('storybook-root', module);23storybookRoot.add('frames', () => (24));25import React from 'react';26import { storiesOf } from '@storybook/react';27import { Frame } from 'storybook-addon-frames';28const storybookRoot = storiesOf('storybook-root', module);29storybookRoot.add('frames', () => (30));31import React from 'react';32import { storiesOf } from '@storybook/react';33import { Frame } from 'storybook-addon-frames';34const storybookRoot = storiesOf('storybook-root', module);35storybookRoot.add('frames', () => (

Full Screen

Using AI Code Generation

copy

Full Screen

1import { frames } from 'storybook-root';2import { storiesOf } from '@storybook/react';3import { action } from '@storybook/addon-actions';4import { linkTo } from '@storybook/addon-links';5import { Button, Welcome } from '@storybook/react/demo';6import { stories } from './stories';7import React from 'react';8import { storiesOf } from '@storybook/react';9const stories = storiesOf('Button', module);10stories.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>);11stories.add('with some emoji', () => (12 <Button onClick={action('clicked')}>13));14stories.add('with some emoji and action', () => (15 <Button onClick={action('clicked')}>16));17stories.add('with some emoji and action', () => (18 <Button onClick={action('clicked')}>19));20frames(stories);21import { storiesOf } from '@storybook/react';22const stories = storiesOf('Button', module);23stories.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>);24stories.add('with some emoji', () => (25 <Button onClick={action('clicked')}>26));27stories.add('with some emoji and action', () => (28 <Button onClick={action('clicked')}>29));30stories.add('with some emoji and action', () => (31 <Button onClick={action('clicked')}>32));

Full Screen

Using AI Code Generation

copy

Full Screen

1import React from 'react';2import { storiesOf } from '@storybook/react';3import { withFrames } from 'storybook-addon-frames';4const stories = storiesOf('Frames', module);5stories.addDecorator(withFrames);6stories.add('Test', () => {7 return (8 );9});10stories.frames([11 {12 },13]);14import { configure } from '@storybook/react';15import { configureViewport } from '@storybook/addon-viewport';16import { withInfo } from '@storybook/addon-info';17import { withA11y } from '@storybook/addon-a11y';18import { withKnobs } from '@storybook/addon-knobs';19import { withOptions } from '@storybook/addon-options';20import { withFrames } from 'storybook-addon-frames';21import 'storybook-addon-frames/register';22configureViewport({23});24addDecorator(withInfo);25addDecorator(withA11y);26addDecorator(withKnobs);27addDecorator(withFrames);28addDecorator(29 withOptions({30 }),31);32const req = require.context('../src', true, /\.story\.js$/);33function loadStories() {34 req.keys().forEach(filename => req(filename));35}36configure(loadStories, module);37const path = require('path');38const webpack = require('webpack');39module.exports = async ({ config }) => {40 config.module.rules.push({41 include: path.resolve(__dirname, '../'),42 });43 config.plugins.push(44 new webpack.DefinePlugin({45 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),46 }),47 );

Full Screen

Using AI Code Generation

copy

Full Screen

1const { frames } = require('@storybook/core/client');2const root = frames().storybookRoot;3const shadowRoot = root.shadowRoot;4const iframe = shadowRoot.querySelector('iframe');5const iframeContentDocument = iframe.contentDocument;6const iframeBody = iframeContentDocument.body;7const iframeShadowRoot = iframeBody.shadowRoot;8const iframeStorybookPreview = iframeShadowRoot.querySelector('storybook-preview');9const iframeStorybookPreviewShadowRoot = iframeStorybookPreview.shadowRoot;10const iframeStorybookPreviewIframe = iframeStorybookPreviewShadowRoot.querySelector('iframe');11const iframeStorybookPreviewIframeContentDocument = iframeStorybookPreviewIframe.contentDocument;12const iframeStorybookPreviewIframeBody = iframeStorybookPreviewIframeContentDocument.body;13const iframeStorybookPreviewIframeShadowRoot = iframeStorybookPreviewIframeBody.shadowRoot;14const iframeStorybookPreviewWrapper = iframeStorybookPreviewIframeShadowRoot.querySelector('storybook-preview-wrapper');15const iframeStorybookPreviewWrapperShadowRoot = iframeStorybookPreviewWrapper.shadowRoot;16const iframeStorybookPreviewWrapperIframe = iframeStorybookPreviewWrapperShadowRoot.querySelector('iframe');17const iframeStorybookPreviewWrapperIframeContentDocument = iframeStorybookPreviewWrapperIframe.contentDocument;18const iframeStorybookPreviewWrapperIframeBody = iframeStorybookPreviewWrapperIframeContentDocument.body;19const iframeStorybookPreviewWrapperIframeShadowRoot = iframeStorybookPreviewWrapperIframeBody.shadowRoot;20const iframeStorybookPreviewWrapperStorybookPreview = iframeStorybookPreviewWrapperIframeShadowRoot.querySelector('storybook-preview');

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storybookRoot } from 'storybook-root';2import { addDecorator } from '@storybook/react';3import { withA11y } from '@storybook/addon-a11y';4import { withKnobs } from '@storybook/addon-knobs';5const storybookRootFrames = storybookRoot.frames();6const storybookRootFrame = storybookRootFrames[storybookRootFrames.length - 1];7const storybookRootFrameExports = storybookRootFrame.exports;8const storybookRootFrameExportsDefault = storybookRootFrameExports.default;9const storybookRootFrameExportsDefaultAddDecorator = storybookRootFrameExportsDefault.addDecorator;10storybookRootFrameExportsDefaultAddDecorator(withA11y);11storybookRootFrameExportsDefaultAddDecorator(withKnobs);12import { storybookRoot } from 'storybook-root';13import { addDecorator } from '@storybook/react';14import { withA11y } from '@storybook/addon-a11y';15import { withKnobs } from '@storybook/addon-knobs';16const storybookRootFrames = storybookRoot.frames();17const storybookRootFrame = storybookRootFrames[storybookRootFrames.length - 1];18const storybookRootFrameExports = storybookRootFrame.exports;19const storybookRootFrameExportsDefault = storybookRootFrameExports.default;20const storybookRootFrameExportsDefaultAddDecorator = storybookRootFrameExportsDefault.addDecorator;21storybookRootFrameExportsDefaultAddDecorator(withA11y);22storybookRootFrameExportsDefaultAddDecorator(withKnobs);

Full Screen

Using AI Code Generation

copy

Full Screen

1import {frames} from 'storybook-root'2frames().forEach(frame => {3 const {window} = frame4 const {document} = window5})6import {frames} from 'storybook-root'7frames().forEach(frame => {8 const {window} = frame9 const {document} = window10})11import {frames} from 'storybook-root'12frames().forEach(frame => {13 const {window} = frame14 const {document} = window15})16import {frames} from 'storybook-root'17frames().forEach(frame => {18 const {window} = frame19 const {document} = window20})21import {frames} from 'storybook-root'22frames().forEach(frame => {23 const {window} = frame24 const {document} = window25})26import {frames} from 'storybook-root'27frames().forEach(frame => {28 const {window} = frame29 const {document} = window30})31import {frames} from 'storybook-root'32frames().forEach(frame => {33 const {window} = frame

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = this;2var frame = root.frames().add();3var node = frame.nodes().add();4node.name("new node");5node.position(0,0,0);6node.scale(10,10,10);7node.rotation(0,0,0);8node.color(1,0,0);9node.opacity(1.0);10node.visible(true);11node.locked(false);12node.selected(true);13var root = this;14var frame = root.frames().add();15var node = frame.nodes().add();16node.name("new node");17node.position(0,0,0);18node.scale(10,10,10);19node.rotation(0,0,0);20node.color(1,0,0);21node.opacity(1.0);22node.visible(true);23node.locked(false);24node.selected(true);25var root = this;26var frame = root.frames().add();27var node = frame.nodes().add();28node.name("new node");29node.position(0,0,0);30node.scale(10,10,10);31node.rotation(0,0,0);32node.color(1,0,0);33node.opacity(1.0);34node.visible(true);35node.locked(false);36node.selected(true);37var root = this;38var frame = root.frames().add();39var node = frame.nodes().add();40node.name("new node");41node.position(0,0,0);42node.scale(10,10,10);43node.rotation(0,0,0);44node.color(1,0,0);45node.opacity(1.0);46node.visible(true);47node.locked(false);48node.selected(true);49var root = this;50var frame = root.frames().add();

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful