semvec/pypi-packages huggingface dataset:
phm-diagnosis 1.0.6
failure diagnosis

# phm-diagnosis

#### 介绍

故障诊断

使用上海九章云极公司的开源工具包-ylearn，实现故障诊断任务
ylearn主要依托，华为诺亚的gCastle推理包，torch，networkx完成以上任务，
在传参数时，尽可能使用`**kwargs`，如有不便于理解之处，可以直接阅读ylearn源码及注释。



包括:
- [x] 基于数据,生成故障树
- [x]
- [x]
- [x]
- [x]



#### 软件架构

软件架构说明

```

|─ phm_diagnosis
   ├── causal
   │   ├── api.py
   │   ├── __init__.py
   ├── __init__.py
   ├── phm_dataio
   │   ├── __init__.py
   │   ├── base.py
   │   ├── hbase_client.py
   │   ├── redis_client.py
   │   └── utils.py
   ├── phm_feature
       ├── __init__.py

```

#### 安装教程

> 使用pip进行安装
```
pip install phm-feature
```

#### 使用说明

1.  获得振动信号的特征值
```
import phm_feature
from phm_feature import *
enable_parallel(processnum=None) # 开启多线程模式
disable_parallel() # 开启单线程模式
feature_t(data) # 获取时间域特征
# feature_f # 获取频率域特征
fft(data, 50) # 快速离散傅里叶变换
power(data, 50) # 功率谱
ifft(data, 50) # 快速离散逆傅里叶变换
cepstrum(data, 50) # 倒谱
envelope(data) # 包络谱
window(data, 'hamming') # 加窗-汉明窗
divide(data, 50, 25) # 分帧
```

#### 参与贡献

1. 2022-07-04 v0.0.1
```
pypi上传初版本
pypi上传phm-feature初版本
```

2. 2022-07-04 v0.0.2
```
新增多线程模式
```

#### 特技

1.  使用 Readme\_XXX.md 来支持不同的语言，例如 Readme\_en.md, Readme\_zh.md
2.  Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
3.  你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
4.  [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目，是综合评定出的优秀开源项目
5.  Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6.  Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)
trace-skeleton 0.1.6
Trace and label skeleton of a 2D image.
Requires Python: >=3.6

# The `trace_skeleton` Python package

A python package for tracing the skeleton of a 2D image. This work uses the
[Skeleton Tracing algorithm](https://github.com/LingDong-/skeleton-tracing)
developed by [LingDong](https://github.com/LingDong-).
This repo provides an easy to install python package for tracing the skeleton.
This is done to ease the use of the algorithm in other Python projects. We've
taken the SWIG C implementation for optimal performance.

## Usage
Quick and easy installation:
```bash
pip install trace-skeleton
```

## Example
The examples shown are a copy-paste from the
[original repo](https://github.com/LingDong-/skeleton-tracing).

```python
import trace_skeleton
import cv2
import random

im = cv2.imread("../test_images/opencv-thinning-src-img.png",0)

_,im = cv2.threshold(im,128,255,cv2.THRESH_BINARY);

polys = trace_skeleton.from_numpy(im);

for l in polys:
	c = (200*random.random(),200*random.random(),200*random.random())
	for i in range(0,len(l)-1):
		cv2.line(im,(l[i][0],l[i][1]),(l[i+1][0],l[i+1][1]),c)

cv2.imshow('',im);cv2.waitKey(0)
```

## Advanced

The aforementioned API's have a tiny linear time overhead for transforming input
and output between internal datastructures and python objects. Alternatively,
you can use the following: 

```python
from trace_skeleton import *

im = "\0\1\0\0\1\0\0\1\0 ..... " #image stored as a (char*)
w = 128 #dimensions
h = 64

trace(im,w,h)

# iterate over each point in each polyline
# by popping them off the internal datastructure
# len_polyline() gets the length of current polyline
# -1 means no more polylines
while (len_polyline() != -1):
	n = len_polyline();
	for i in range(0,n):
		# pop_point() retrieve and remove the next point
		# on the polyline. It returns the flat index in image
		# mod/div it with width to get (x,y) coordinate
		idx = pop_point()
		x = idx % w;
		y = idx //w;
		print(x,y)
	print("\n")
```
dsagraph 0.0.5
This is a graph library which allows user to make a graph, plot the graph and also make a adjacency list and matrix of the graph.
Requires Python: >=3.7

This is a graph library which allows user to make a graph, plot the graph and also make a adjacency list and matrix of the graph.

A graph is a non-linear data structure consisting of vertices (V) and edges (E). The most commonly used representations of a graph are adjacency matrix (a 2D array of size V x V where V is the number of vertices in a graph) and adjacency list (an array of lists represents the list of vertices adjacent to each vertex).

An adjacency list is a collection of unordered lists used to represent a finite graph.

An adjacency matrix is a way of representing a graph as a matrix of booleans (0's and 1's). A finite graph can be represented in the form of a square matrix on a computer, where the boolean value of the matrix indicates if there is a direct path between two vertices.

This library is made for the college project and is not made for any industrial project. If this library is related to any of the hosted library it is completely coincidental.
newsmile 1.1
A Package containing tools for decoding/encoding Smile Format data to/from python object
Requires Python: >=3.7

# NewSmile
## Another Smile Format Decoder/Encoder for Python 3

### Encoding ###
- Import SmileEncoder
```python 
from newsmile import SmileEncoder
```
- Create Encoder object, with arguments:
    - **raw_binary** (bool), default = **False**: contains binary data
    - **shared_values** (bool), default = **False**: maintains shared values buffer and references
    - **shared_keys** (bool), default = **True**: maintains shared keys buffer and references
    - **float_precision** (0|4|8), default = **0**: float values precisions (0=auto)
    - **encoding** (string), default = **'utf-8'**: encoding used for unicode values and keys

(Note: specs implies shared values are defaulted to False)
```python
encoder = SmileEncoder(shared_values=True)
```
- Encode data

If data is a dictionnary, it is encoded as is. If data is a string, it is considered as a json string.
```python
# Example with a dictionary
an_object = {'a': 123, 'b':[4, 5, 6], 'c':{'d': 'a_string', 'e':None}}
result = encoder.encode(an_object)
print(result)
```
```
>>> b':)\n\x03\xfa\x80a$\x03\xb6\x80b\xf8\xc8\xca\xcc\xf9\x80c\xfa\x80dGa_string\x80e!\xfb\xfb'
```
```python
# Example with json
import json
an_object = {'a': 123, 'b':[4, 5, 6], 'c':{'d': 'a_string', 'e':None}}
result = encoder.encode(json.dumps(an_object))
print(result)
```
```
>>> b':)\n\x03\xfa\x80a$\x03\xb6\x80b\xf8\xc8\xca\xcc\xf9\x80c\xfa\x80dGa_string\x80e!\xfb\xfb'
```

### Decoding ###
- Import SmileEncoder
```python 
from newsmile import SmileDecoder
```
- Create Decoder object, with arguments:
    - **encoding** (string), default = **'utf-8'**: encoding used for unicode values and keys
```python
decoder = SmileDecoder()
```
- Decode value
```python
decoder.decode(result)
decoded_object = decoder.decode(result)
print(decoded_object)
```
```
>>> {'a': 123, 'b': [4, 5, 6], 'c': {'d': 'a_string', 'e': None}}
```

### Encoding example, from file
```python
import json
from newsmile import SmileEncoder
encoder = SmileEncoder(shared_values=True, encoding='iso-8859-1')
dico = {'a': 1, 'b': [2, 3, 4], 'c': {'subkey': 'a string'}}
smile_data = encoder.encode(json.dumps(dico))
```

### Decoding example, from file
```python
from newsmile import SmileDecoder
decoder = SmileDecoder()
with open('smile-data-file', 'rb') as smile_file:
    data = decoder.decode(smile_file.read())
```

### Running tests
```bash
cd tests
```
```python
python test.py
```