Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ctest #2

Open
wants to merge 15 commits into
base: initb
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions WOPI_config_writer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import json

# class Config
# def __init__(self, )

def save_json(j_dict, file):
with open(file, 'w') as outfile:
json.dump(j_dict,outfile)


def write_heli_data(angles, blades, blade_length=8, fat=True):
blade_offsets = [int(angles*x/blades) for x in range(blades)]
base = [1 for x in range(angles)]
blade_names = ['blade_{}'.format(x) for x in range(blades)]
axes = ['' for x in range(angles)]

heli_dict = {'title': 'helicopter', 'colormap': 'jet', 'axes': axes, 'animated': True, 'frame_length': 40}

groups = dict()
for t in range(angles):
for b in range(blades):
pos = (t+blade_offsets[b]) % angles
data = base.copy()
data[pos] = blade_length
if fat:
data[(pos+1) % angles] = blade_length
content = {'name':blade_names[b],
'data':data,
'frame':t}
g_name = 'group_{}_{}'.format(b,t)
groups[g_name] = content
heli_dict['groups'] = groups
return heli_dict

# h_dict = write_heli_data(20,4)
# file = 'helicopter_3.json'
#
# save_json(h_dict, file)

def write_cm_fail(angles, blade_length=8, fat=True):
base = [1 for x in range(angles)]
axes = ['' for x in range(angles)]
color_dict = {'title': 'colormap example', 'colormap': 'Accent', 'axes': axes}

groups = dict()
for t in range(angles):
data = base.copy()
data[t] = blade_length
if fat:
data[(t+1) % angles] = blade_length
content = {'data': data,}
g_name = 'color_{}'.format(t)
groups[g_name] = content
color_dict['groups'] = groups
return color_dict

c_dict_1 = write_cm_fail(9)
c_dict_2 = write_cm_fail(8)
file_1 = 'failed_cm.json'
file_2 = 'succeed_cm.json'

save_json(c_dict_1, file_1)
save_json(c_dict_2, file_2)
1 change: 1 addition & 0 deletions helicopter_3.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"title": "helicopter", "colormap": "jet", "axes": ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""], "animated": true, "frame_length": 40, "groups": {"group_0_0": {"name": "blade_0", "data": [8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 0}, "group_1_0": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 0}, "group_2_0": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 0}, "group_3_0": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1], "frame": 0}, "group_0_1": {"name": "blade_0", "data": [1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 1}, "group_1_1": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 1}, "group_2_1": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1], "frame": 1}, "group_3_1": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1], "frame": 1}, "group_0_2": {"name": "blade_0", "data": [1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 2}, "group_1_2": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 2}, "group_2_2": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1], "frame": 2}, "group_3_2": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1], "frame": 2}, "group_0_3": {"name": "blade_0", "data": [1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 3}, "group_1_3": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 3}, "group_2_3": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1], "frame": 3}, "group_3_3": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8], "frame": 3}, "group_0_4": {"name": "blade_0", "data": [1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 4}, "group_1_4": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 4}, "group_2_4": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1], "frame": 4}, "group_3_4": {"name": "blade_3", "data": [8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8], "frame": 4}, "group_0_5": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 5}, "group_1_5": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 5}, "group_2_5": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1], "frame": 5}, "group_3_5": {"name": "blade_3", "data": [8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 5}, "group_0_6": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 6}, "group_1_6": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1], "frame": 6}, "group_2_6": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1], "frame": 6}, "group_3_6": {"name": "blade_3", "data": [1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 6}, "group_0_7": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 7}, "group_1_7": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1], "frame": 7}, "group_2_7": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1], "frame": 7}, "group_3_7": {"name": "blade_3", "data": [1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 7}, "group_0_8": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 8}, "group_1_8": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1], "frame": 8}, "group_2_8": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8], "frame": 8}, "group_3_8": {"name": "blade_3", "data": [1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 8}, "group_0_9": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 9}, "group_1_9": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1], "frame": 9}, "group_2_9": {"name": "blade_2", "data": [8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8], "frame": 9}, "group_3_9": {"name": "blade_3", "data": [1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 9}, "group_0_10": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 10}, "group_1_10": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1], "frame": 10}, "group_2_10": {"name": "blade_2", "data": [8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 10}, "group_3_10": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 10}, "group_0_11": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1], "frame": 11}, "group_1_11": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1], "frame": 11}, "group_2_11": {"name": "blade_2", "data": [1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 11}, "group_3_11": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 11}, "group_0_12": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1], "frame": 12}, "group_1_12": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1], "frame": 12}, "group_2_12": {"name": "blade_2", "data": [1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 12}, "group_3_12": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 12}, "group_0_13": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1], "frame": 13}, "group_1_13": {"name": "blade_1", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8], "frame": 13}, "group_2_13": {"name": "blade_2", "data": [1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 13}, "group_3_13": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 13}, "group_0_14": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1], "frame": 14}, "group_1_14": {"name": "blade_1", "data": [8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8], "frame": 14}, "group_2_14": {"name": "blade_2", "data": [1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 14}, "group_3_14": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 14}, "group_0_15": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1], "frame": 15}, "group_1_15": {"name": "blade_1", "data": [8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 15}, "group_2_15": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 15}, "group_3_15": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 15}, "group_0_16": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1], "frame": 16}, "group_1_16": {"name": "blade_1", "data": [1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 16}, "group_2_16": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 16}, "group_3_16": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1], "frame": 16}, "group_0_17": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1], "frame": 17}, "group_1_17": {"name": "blade_1", "data": [1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 17}, "group_2_17": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 17}, "group_3_17": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1], "frame": 17}, "group_0_18": {"name": "blade_0", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8], "frame": 18}, "group_1_18": {"name": "blade_1", "data": [1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 18}, "group_2_18": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 18}, "group_3_18": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1], "frame": 18}, "group_0_19": {"name": "blade_0", "data": [8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8], "frame": 19}, "group_1_19": {"name": "blade_1", "data": [1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 19}, "group_2_19": {"name": "blade_2", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1], "frame": 19}, "group_3_19": {"name": "blade_3", "data": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 1, 1, 1, 1], "frame": 19}}}
Loading