deepKernel 0.0.1__tar.gz → 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {deepkernel-0.0.1 → deepkernel-0.0.3}/PKG-INFO +1 -1
- deepkernel-0.0.3/deepKernel/__init__.py +1 -0
- deepkernel-0.0.3/deepKernel/base.py +74 -0
- deepkernel-0.0.3/deepKernel/configuration.py +6 -0
- deepkernel-0.0.3/deepKernel/deepline.py +86 -0
- deepkernel-0.0.3/deepKernel/information.py +104 -0
- deepkernel-0.0.3/deepKernel/input.py +12 -0
- {deepkernel-0.0.1 → deepkernel-0.0.3}/deepKernel.egg-info/PKG-INFO +1 -1
- deepkernel-0.0.3/deepKernel.egg-info/SOURCES.txt +13 -0
- deepkernel-0.0.3/deepKernel.egg-info/top_level.txt +1 -0
- {deepkernel-0.0.1 → deepkernel-0.0.3}/setup.py +1 -1
- deepkernel-0.0.1/deepKernel.egg-info/SOURCES.txt +0 -7
- deepkernel-0.0.1/deepKernel.egg-info/top_level.txt +0 -1
- {deepkernel-0.0.1 → deepkernel-0.0.3}/LICENSE +0 -0
- {deepkernel-0.0.1 → deepkernel-0.0.3}/README.md +0 -0
- {deepkernel-0.0.1 → deepkernel-0.0.3}/deepKernel.egg-info/dependency_links.txt +0 -0
- {deepkernel-0.0.1 → deepkernel-0.0.3}/setup.cfg +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import deepline
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import deepline
|
|
2
|
+
import json,operator
|
|
3
|
+
import math
|
|
4
|
+
|
|
5
|
+
def _init():
|
|
6
|
+
global _global_dict
|
|
7
|
+
_global_dict={}
|
|
8
|
+
|
|
9
|
+
def set_config_path(path):
|
|
10
|
+
data = {
|
|
11
|
+
'func': 'SET_CONFIG_PATH',
|
|
12
|
+
'paras': {
|
|
13
|
+
'path': path
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
#print(json.dumps(data))
|
|
17
|
+
return deepline.process(json.dumps(data))
|
|
18
|
+
|
|
19
|
+
#获取当前层feature数
|
|
20
|
+
def get_layer_feature_count(jobName, stepName, layerName):
|
|
21
|
+
data = {
|
|
22
|
+
'func': 'GET_LAYER_FEATURE_COUNT',
|
|
23
|
+
'paras': {'jobName': jobName,
|
|
24
|
+
'stepName': stepName,
|
|
25
|
+
'layerName': layerName}
|
|
26
|
+
}
|
|
27
|
+
return deepline.process(json.dumps(data))
|
|
28
|
+
|
|
29
|
+
def get_opened_jobs():
|
|
30
|
+
data = {
|
|
31
|
+
'func': 'GET_OPENED_JOBS'
|
|
32
|
+
}
|
|
33
|
+
#print(json.dumps(data))
|
|
34
|
+
return deepline.process(json.dumps(data))
|
|
35
|
+
|
|
36
|
+
def open_job(path, job):
|
|
37
|
+
data = {
|
|
38
|
+
'func': 'OPEN_JOB',
|
|
39
|
+
'paras': [{'path': path},
|
|
40
|
+
{'job': job}]
|
|
41
|
+
}
|
|
42
|
+
# print(json.dumps(data))
|
|
43
|
+
ret = deepline.process(json.dumps(data))
|
|
44
|
+
return ret
|
|
45
|
+
|
|
46
|
+
def get_matrix(job):
|
|
47
|
+
data = {
|
|
48
|
+
'func': 'GET_MATRIX',
|
|
49
|
+
'paras': {'job': job}
|
|
50
|
+
}
|
|
51
|
+
# print(json.dumps(data))
|
|
52
|
+
return deepline.process(json.dumps(data))
|
|
53
|
+
|
|
54
|
+
def has_profile(job, step):
|
|
55
|
+
data = {
|
|
56
|
+
'func': 'HAS_PROFILE',
|
|
57
|
+
'paras': {
|
|
58
|
+
'job': job,
|
|
59
|
+
'step': step
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
#print(json.dumps(data))
|
|
63
|
+
return deepline.process(json.dumps(data))
|
|
64
|
+
|
|
65
|
+
def get_profile_box(job, step):
|
|
66
|
+
data = {
|
|
67
|
+
'func': 'PROFILE_BOX',
|
|
68
|
+
'paras': {'job': job,
|
|
69
|
+
'step': step}
|
|
70
|
+
}
|
|
71
|
+
js = json.dumps(data)
|
|
72
|
+
#print(js)
|
|
73
|
+
ret = deepline.process(json.dumps(data))
|
|
74
|
+
return ret
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import ctypes
|
|
2
|
+
import os
|
|
3
|
+
import json
|
|
4
|
+
|
|
5
|
+
dll = None
|
|
6
|
+
bin_path = None
|
|
7
|
+
isInit = False
|
|
8
|
+
|
|
9
|
+
def init(path):
|
|
10
|
+
global dll
|
|
11
|
+
global bin_path
|
|
12
|
+
bin_path = path
|
|
13
|
+
os.environ['path'] += (r";" + bin_path)
|
|
14
|
+
|
|
15
|
+
dll = ctypes.CDLL(bin_path + r"\LIB_DL.dll")
|
|
16
|
+
dll.process.restype = ctypes.c_char_p
|
|
17
|
+
dll.init_func_map.restype = ctypes.c_char_p
|
|
18
|
+
dll.init_orig_func_map.restype = ctypes.c_char_p
|
|
19
|
+
dll.getVersion.restype = ctypes.c_char_p
|
|
20
|
+
# dll.getVersion.restype = ctypes.c_char_p
|
|
21
|
+
dll.process.argtypes = [ctypes.c_char_p]
|
|
22
|
+
ret = dll.init_func_map()
|
|
23
|
+
ret = dll.init_orig_func_map()
|
|
24
|
+
global isInit
|
|
25
|
+
isInit = True
|
|
26
|
+
return ret.decode('utf-8')
|
|
27
|
+
|
|
28
|
+
def set_use_times(times):
|
|
29
|
+
times.encode('utf-8')
|
|
30
|
+
#print(type(json))
|
|
31
|
+
times_str = bytes(times, encoding='utf-8')
|
|
32
|
+
dll.setUseTimes(times_str)
|
|
33
|
+
|
|
34
|
+
def process(json):
|
|
35
|
+
if isInit == False:
|
|
36
|
+
print('Please init first')
|
|
37
|
+
return
|
|
38
|
+
|
|
39
|
+
json.encode('utf-8')
|
|
40
|
+
#print(type(json))
|
|
41
|
+
string_buff = bytes(json, encoding='utf-8')
|
|
42
|
+
#print(type(string_buff), string_buff)
|
|
43
|
+
ret = dll.process(string_buff)
|
|
44
|
+
#print(ret)
|
|
45
|
+
return ret.decode('utf-8')
|
|
46
|
+
|
|
47
|
+
# def view_cmd(vjson):
|
|
48
|
+
# string_vjson = bytes(vjson, encoding='utf-8')
|
|
49
|
+
# vdll.view_cmd(string_vjson)
|
|
50
|
+
|
|
51
|
+
def getVersion():
|
|
52
|
+
ret = dll.getVersion()
|
|
53
|
+
ret = ret.decode('utf-8')
|
|
54
|
+
return json.loads(ret)
|
|
55
|
+
|
|
56
|
+
# def uiprocess(json):
|
|
57
|
+
# json.encode('utf-8')
|
|
58
|
+
# #print(type(json))
|
|
59
|
+
# string_buff = bytes(json, encoding='utf-8')
|
|
60
|
+
# #print(type(string_buff), string_buff)
|
|
61
|
+
# ret = uidll.process(string_buff)
|
|
62
|
+
# #print(ret)
|
|
63
|
+
# return ret.decode('utf-8')
|
|
64
|
+
|
|
65
|
+
# def readPathFactoryJson(vjson):
|
|
66
|
+
# string_vjson = bytes(vjson, encoding='utf-8')
|
|
67
|
+
# ret = matrixdll.readPathFactoryJson(string_vjson)
|
|
68
|
+
# return ret.decode('gbk')
|
|
69
|
+
|
|
70
|
+
# def readPathTemplateConfigJson(vjson):
|
|
71
|
+
# string_vjson = bytes(vjson, encoding='utf-8')
|
|
72
|
+
# ret = matrixdll.readPathTemplateConfigJson(string_vjson)
|
|
73
|
+
# return ret.decode('gbk')
|
|
74
|
+
|
|
75
|
+
# def getMatchedLayers(vjson):
|
|
76
|
+
# string_vjson = bytes(vjson, encoding='utf-8')
|
|
77
|
+
# ret = matrixdll.getMatchedLayers(string_vjson)
|
|
78
|
+
# return ret.decode('gbk')
|
|
79
|
+
|
|
80
|
+
# def saveNewMatchRule(vjson):
|
|
81
|
+
# string_vjson = bytes(vjson, encoding='utf-8')
|
|
82
|
+
# ret = matrixdll.saveNewMatchRule(string_vjson)
|
|
83
|
+
# return ret.decode('gbk')
|
|
84
|
+
|
|
85
|
+
def get_config_path():
|
|
86
|
+
return bin_path
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import os, sys, json, math
|
|
2
|
+
import deepline, base
|
|
3
|
+
|
|
4
|
+
#打开料号
|
|
5
|
+
def open_job(job:str, path:str)->bool:
|
|
6
|
+
try:
|
|
7
|
+
ret= json.loads(base.open_job(path, job))['paras']['status']
|
|
8
|
+
return ret
|
|
9
|
+
except Exception as e:
|
|
10
|
+
print(e)
|
|
11
|
+
return False
|
|
12
|
+
|
|
13
|
+
def get_profile_box(job:str, step:str)->dict:
|
|
14
|
+
try:
|
|
15
|
+
#转成小写
|
|
16
|
+
job= job.lower()
|
|
17
|
+
step= step.lower()
|
|
18
|
+
info= check_matrix_info(job, step)
|
|
19
|
+
if info:
|
|
20
|
+
ret_= base.has_profile(job,step)
|
|
21
|
+
data_= json.loads(ret_)['result']
|
|
22
|
+
if data_:
|
|
23
|
+
ret = base.get_profile_box(job, step)
|
|
24
|
+
data = json.loads(ret)
|
|
25
|
+
box = data['paras']
|
|
26
|
+
profile_box = {}
|
|
27
|
+
profile_box['xmax'] = box['Xmax']
|
|
28
|
+
profile_box['xmin'] = box['Xmin']
|
|
29
|
+
profile_box['ymax'] = box['Ymax']
|
|
30
|
+
profile_box['ymin'] = box['Ymin']
|
|
31
|
+
return profile_box
|
|
32
|
+
print('没有profile!')
|
|
33
|
+
return {}
|
|
34
|
+
return None
|
|
35
|
+
except Exception as e:
|
|
36
|
+
print(e)
|
|
37
|
+
return None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def check_matrix_info(job:str, step:str='', layers:list=[])->bool:
|
|
41
|
+
try:
|
|
42
|
+
if isinstance(job, str) and isinstance(step, str) and isinstance(layers, list):
|
|
43
|
+
open_jobs = get_opened_jobs()
|
|
44
|
+
if job in open_jobs:
|
|
45
|
+
if step == '' and layers == []:
|
|
46
|
+
return False
|
|
47
|
+
step_lst= get_steps(job)
|
|
48
|
+
layer_lst = get_layers(job)
|
|
49
|
+
if step!='':
|
|
50
|
+
if step not in step_lst:
|
|
51
|
+
print('step不存在')
|
|
52
|
+
return False
|
|
53
|
+
if layers!=[]:
|
|
54
|
+
for layer in layers:
|
|
55
|
+
if layer not in layer_lst:
|
|
56
|
+
print(layer + ' 不存在')
|
|
57
|
+
return False
|
|
58
|
+
else:
|
|
59
|
+
print(f'{job}:未打开,请查找原因!')
|
|
60
|
+
return False
|
|
61
|
+
else:
|
|
62
|
+
print("请检查填写的参数类型!")
|
|
63
|
+
return False
|
|
64
|
+
except Exception as e:
|
|
65
|
+
return False
|
|
66
|
+
print(e)
|
|
67
|
+
return True
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def get_opened_jobs()->list:
|
|
71
|
+
try:
|
|
72
|
+
ret= base.get_opened_jobs()
|
|
73
|
+
data= json.loads(ret)
|
|
74
|
+
if 'paras' in data:
|
|
75
|
+
return data['paras']
|
|
76
|
+
else:
|
|
77
|
+
return []
|
|
78
|
+
except Exception as e:
|
|
79
|
+
print(repr(e))
|
|
80
|
+
return None
|
|
81
|
+
|
|
82
|
+
def get_steps(job:str)->list:
|
|
83
|
+
try:
|
|
84
|
+
ret = base.get_matrix(job)
|
|
85
|
+
data = json.loads(ret)
|
|
86
|
+
steps = data['paras']['steps']
|
|
87
|
+
return steps
|
|
88
|
+
except Exception as e:
|
|
89
|
+
print(e)
|
|
90
|
+
return []
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def get_layers(job:str)->list:
|
|
94
|
+
try:
|
|
95
|
+
ret = base.get_matrix(job)
|
|
96
|
+
data = json.loads(ret)
|
|
97
|
+
layer_infos = data['paras']['info']
|
|
98
|
+
layer_list = []
|
|
99
|
+
for i in range(0, len(layer_infos)):
|
|
100
|
+
layer_list.append(layer_infos[i]['name'])
|
|
101
|
+
return layer_list
|
|
102
|
+
except Exception as e:
|
|
103
|
+
print(e)
|
|
104
|
+
return []
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
deepKernel/__init__.py
|
|
5
|
+
deepKernel/base.py
|
|
6
|
+
deepKernel/configuration.py
|
|
7
|
+
deepKernel/deepline.py
|
|
8
|
+
deepKernel/information.py
|
|
9
|
+
deepKernel/input.py
|
|
10
|
+
deepKernel.egg-info/PKG-INFO
|
|
11
|
+
deepKernel.egg-info/SOURCES.txt
|
|
12
|
+
deepKernel.egg-info/dependency_links.txt
|
|
13
|
+
deepKernel.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
deepKernel
|
|
@@ -6,7 +6,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
|
|
6
6
|
|
|
7
7
|
setuptools.setup(
|
|
8
8
|
name="deepKernel", # Replace with your desired PyPI package name (must be unique)
|
|
9
|
-
version="0.0.
|
|
9
|
+
version="0.0.3", # Initial version number
|
|
10
10
|
author="pz", # Replace with your name
|
|
11
11
|
author_email="meichiyuan@pzeda.com", # Replace with your email
|
|
12
12
|
description="A simple example package", # Short description
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|