update
|
@ -1,76 +1,12 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//QAxWidget/\u663E\u793Aword_excel_pdf.py=utf-8
|
||||
encoding//QListView/CustomWidgetSortItem.py=utf-8
|
||||
encoding//QListView/SortItemByRole.py=utf-8
|
||||
encoding//QProxyStyle/Lib/TabBarStyle.py=utf-8
|
||||
encoding//QProxyStyle/TabTextDirection.py=utf-8
|
||||
encoding//QTableView/CopyContent/CopyContent.py=utf-8
|
||||
encoding//QTableView/CopyContent/__main__.py=utf-8
|
||||
encoding//QTableWidget/SqlQuery/SqlQuery.py=utf-8
|
||||
encoding//QTableWidget/SqlQuery/__main__.py=utf-8
|
||||
encoding//QSplitter/RewriteHandle.py=utf-8
|
||||
encoding//QThread/moveToThread.py=utf-8
|
||||
encoding//QTreeWidget/ParsingJson.py=utf-8
|
||||
encoding//\u5176\u5B83/C\u548CC++\u6269\u5C55/py\u8F6Cpyd/pydmod.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest1.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest2.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/res_rc.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/textread.py=utf-8
|
||||
encoding//\u5176\u5B83/\u4E32\u53E3\u8C03\u8BD5\u5C0F\u52A9\u624B/UiSerialPort.py=utf-8
|
||||
encoding//\u5176\u5B83/\u4E32\u53E3\u8C03\u8BD5\u5C0F\u52A9\u624B/\u4E32\u53E3\u8C03\u8BD5\u5C0F\u52A9\u624B.py=utf-8
|
||||
encoding//\u5176\u5B83/\u4EBA\u8138\u63CF\u70B9\u68C0\u6D4B/OpencvWidget.py=utf-8
|
||||
encoding//\u5176\u5B83/\u5168\u5C40\u70ED\u952E/HotKey.py=utf-8
|
||||
encoding//\u5176\u5B83/\u53F3\u4E0B\u89D2\u5F39\u51FA\u6846/WindowNotify.py=utf-8
|
||||
encoding//\u5176\u5B83/\u5B57\u4F53\u6D4B\u8BD5/FontAwesome.py=utf-8
|
||||
encoding//\u5176\u5B83/\u5B57\u4F53\u6D4B\u8BD5/TestFontAwesome.py=utf-8
|
||||
encoding//\u5176\u5B83/\u5B57\u4F53\u6D4B\u8BD5/TestFontRoboto.py=utf-8
|
||||
encoding//\u5176\u5B83/\u6D88\u606F\u63D0\u793A/BubbleTips.py=utf-8
|
||||
encoding//\u5176\u5B83/\u6D88\u606F\u63D0\u793A/Notification.py=utf-8
|
||||
encoding//\u5176\u5B83/\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u52A8\u66F4\u65B0/mylibs/testlibs.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u52A8\u66F4\u65B0/test.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u5B9A\u4E49import/IronyImporter.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u5B9A\u4E49import/build.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u5B9A\u4E49import/main.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u5B9A\u4E49import/src/test.py=utf-8
|
||||
encoding//\u5176\u5B83/\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5/\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5.py=utf-8
|
||||
encoding//\u52A8\u753B/\u53F3\u952E\u83DC\u5355\u52A8\u753B.py=utf-8
|
||||
encoding//\u52A8\u753B/\u591A\u9875\u9762\u5207\u6362\u52A8\u753B/SlidingStackedWidget.py=utf-8
|
||||
encoding//\u52A8\u753B/\u591A\u9875\u9762\u5207\u6362\u52A8\u753B/UiImageSlider.py=utf-8
|
||||
encoding//\u52A8\u753B/\u591A\u9875\u9762\u5207\u6362\u52A8\u753B/\u56FE\u7247\u8F6E\u64AD\u52A8\u753B.py=utf-8
|
||||
encoding//\u52A8\u753B/\u6309\u94AE\u653E\u5927\u7F29\u5C0F\u52A8\u753B.py=utf-8
|
||||
encoding//\u52A8\u753B/\u70B9\u9635\u7279\u6548/\u70B9\u9635\u7279\u6548.py=utf-8
|
||||
encoding//\u52A8\u753B/\u7A97\u53E3\u6DE1\u5165\u6DE1\u51FA.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u4E16\u754C\u5730\u56FE/WorldMap.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u663E\u793A\u56FE\u7247\u53CA\u7F29\u653E.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u6DFB\u52A0QWidget.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u7B80\u5355\u56FE\u50CF\u5904\u7406/SimpleImagePs.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u7B80\u5355\u56FE\u50CF\u5904\u7406/SimpleImageThread.py=utf-8
|
||||
encoding//\u56FE\u5F62\u89C6\u56FE/\u7B80\u5355\u56FE\u50CF\u5904\u7406/SimpleImageView.py=utf-8
|
||||
encoding//\u56FE\u7247/\u4EFF\u7F51\u9875\u56FE\u7247\u9519\u4F4D\u7279\u6548.py=utf-8
|
||||
encoding//\u56FE\u7247/\u56FE\u7247\u52A0\u8F7D/res_rc.py=utf-8
|
||||
encoding//\u56FE\u7247/\u56FE\u7247\u52A0\u8F7D/xpmres.py=utf-8
|
||||
encoding//\u56FE\u7247/\u56FE\u7247\u52A0\u8F7D/\u56FE\u7247\u52A0\u8F7D.py=utf-8
|
||||
encoding//\u56FE\u7247/\u56FE\u7247\u65CB\u8F6C.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/pyd\u7248\u672C/QtNinePatch/sip/configure.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/pyd\u7248\u672C/QtNinePatch/sip/testQtNinePatch.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/\u7EAFpython\u7248\u672C1/NinePatch.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/\u7EAFpython\u7248\u672C1/testNinePatch.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/\u7EAFpython\u7248\u672C2/QtNinePatch.py=utf-8
|
||||
encoding//\u56FE\u7247/\u663E\u793A.9\u683C\u5F0F\u56FE\u7247/\u7EAFpython\u7248\u672C2/testQtNinePatch.py=utf-8
|
||||
encoding//\u591A\u9875\u9762/QScrollArea/\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/SettingUi.py=utf-8
|
||||
encoding//\u591A\u9875\u9762/QScrollArea/\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/\u4EFFQQ\u8BBE\u7F6E\u9762\u677F.py=utf-8
|
||||
encoding//\u591A\u9875\u9762/QStackedWidget/\u5DE6\u4FA7\u9009\u9879\u5361/\u5DE6\u4FA7\u9009\u9879\u5361.py=utf-8
|
||||
encoding//\u6D4F\u89C8\u5668/QWebView/\u68A6\u5E7B\u6811/\u68A6\u5E7B\u6811.py=utf-8
|
||||
encoding//\u6ED1\u52A8\u6761/\u6ED1\u52A8\u6761\u70B9\u51FB\u5B9A\u4F4D.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u5206\u5272\u7A97\u53E3\u7684\u5206\u5272\u6761\u91CD\u5199.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/FramelessWindow.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/win\u65E0\u8FB9\u6846\u8C03\u6574\u5927\u5C0F.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u6D88\u606F\u5BF9\u8BDD\u6846\u5012\u8BA1\u65F6\u5173\u95ED.py=utf-8
|
||||
encoding//\u7A97\u53E3/\u7A97\u53E3\u91CD\u542F.py=utf-8
|
||||
encoding//\u7F8E\u5316/Effect/AnimationShadowEffect.py=utf-8
|
||||
encoding//\u7F8E\u5316/Effect/\u56FE\u7247\u6309\u94AE\u8F93\u5165\u6846\u9634\u5F71.py=utf-8
|
||||
encoding//\u7F8E\u5316/QLabel/\u5706\u5F62\u56FE\u7247.py=utf-8
|
||||
encoding//QWebView/DreamTree.py=utf-8
|
||||
encoding//\u7F8E\u5316/QProgressBar/Metro\u8FDB\u5EA6\u6761.py=utf-8
|
||||
encoding//\u7F8E\u5316/QProgressBar/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/ProgressBar.py=utf-8
|
||||
encoding//\u7F8E\u5316/QProgressBar/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761.py=utf-8
|
||||
|
@ -78,7 +14,3 @@ encoding//\u7F8E\u5316/QSlider/PaintQSlider.py=utf-8
|
|||
encoding//\u7F8E\u5316/QWidget/CustomPaintWidget.py=utf-8
|
||||
encoding//\u7F8E\u5316/QWidget/CustomWidget.py=utf-8
|
||||
encoding//\u7F8E\u5316/QWidget/QWidget\u6837\u5F0F\u6D4B\u8BD5.py=utf-8
|
||||
encoding//\u83DC\u5355/\u83DC\u5355\u591A\u9009\u4E0D\u5173\u95ED.py=utf-8
|
||||
encoding//\u8868\u683C/QTableView/\u8868\u683C\u5185\u5BB9\u590D\u5236.py=utf-8
|
||||
encoding//\u8868\u683C/QTableWidget/\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/main.py=utf-8
|
||||
encoding//\u8868\u683C/QTableWidget/\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/mainui.py=utf-8
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
#%%cython
|
||||
import numpy as np
|
||||
cimport numpy as np
|
||||
np.import_array()
|
||||
|
||||
# 参考http://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html?highlight=cdef%20extern%20from
|
||||
# 参考https://www.zhihu.com/question/23003213
|
||||
|
||||
cdef extern from "CalSpecSpeaLib.h":
|
||||
void cal_spec_accel(double acc[], int len, double dt, double maxPeriod, double periodStep, double dampRatio, double *Period, double *Fre, double *MAcc, double *MVel, double *MDis, int numt)
|
||||
|
||||
def calspecaccel(np.ndarray[double, ndim=1, mode="c"] acc, int length, double dt, double maxPeriod, double periodStep, double dampRatio):
|
||||
cdef int numt = int(maxPeriod / periodStep) + 1
|
||||
# 初始化各存储数据
|
||||
cdef np.ndarray[double, ndim=1] Fre = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MDis = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MVel = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MAcc = np.zeros(numt, float)
|
||||
#产生501个
|
||||
cdef np.ndarray[double, ndim=1] Period = np.arange(0.0, maxPeriod + periodStep, periodStep) # 10.0 + 0.02, 0.02
|
||||
Period[0] = 0.001
|
||||
# 调用CalSpecSpeaLib.cpp定义的函数对数组进行处理
|
||||
cal_spec_accel(<double*> np.PyArray_DATA(acc), length, dt, maxPeriod, periodStep, dampRatio,
|
||||
<double*> np.PyArray_DATA(Period), <double*> np.PyArray_DATA(Fre),
|
||||
<double*> np.PyArray_DATA(MAcc), <double*> np.PyArray_DATA(MVel),
|
||||
<double*> np.PyArray_DATA(MDis), numt)
|
||||
#%%cython
|
||||
import numpy as np
|
||||
cimport numpy as np
|
||||
np.import_array()
|
||||
|
||||
# 参考http://cython.readthedocs.io/en/latest/src/userguide/wrapping_CPlusPlus.html?highlight=cdef%20extern%20from
|
||||
# 参考https://www.zhihu.com/question/23003213
|
||||
|
||||
cdef extern from "CalSpecSpeaLib.h":
|
||||
void cal_spec_accel(double acc[], int len, double dt, double maxPeriod, double periodStep, double dampRatio, double *Period, double *Fre, double *MAcc, double *MVel, double *MDis, int numt)
|
||||
|
||||
def calspecaccel(np.ndarray[double, ndim=1, mode="c"] acc, int length, double dt, double maxPeriod, double periodStep, double dampRatio):
|
||||
cdef int numt = int(maxPeriod / periodStep) + 1
|
||||
# 初始化各存储数据
|
||||
cdef np.ndarray[double, ndim=1] Fre = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MDis = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MVel = np.zeros(numt, float)
|
||||
cdef np.ndarray[double, ndim=1] MAcc = np.zeros(numt, float)
|
||||
#产生501个
|
||||
cdef np.ndarray[double, ndim=1] Period = np.arange(0.0, maxPeriod + periodStep, periodStep) # 10.0 + 0.02, 0.02
|
||||
Period[0] = 0.001
|
||||
# 调用CalSpecSpeaLib.cpp定义的函数对数组进行处理
|
||||
cal_spec_accel(<double*> np.PyArray_DATA(acc), length, dt, maxPeriod, periodStep, dampRatio,
|
||||
<double*> np.PyArray_DATA(Period), <double*> np.PyArray_DATA(Fre),
|
||||
<double*> np.PyArray_DATA(MAcc), <double*> np.PyArray_DATA(MVel),
|
||||
<double*> np.PyArray_DATA(MDis), numt)
|
||||
return Period, Fre, MAcc, MVel, MDis
|
|
@ -1,63 +1,63 @@
|
|||
#include "CalSpecSpeaLib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
double maxabs(double num[], int len)
|
||||
{
|
||||
//略
|
||||
return abs(num[0]);
|
||||
|
||||
}
|
||||
bool isALLvaluezero(double num[], int len)
|
||||
{
|
||||
//略
|
||||
return false;
|
||||
|
||||
}
|
||||
void cal_spec_accel(double acc[], int len, double dt, double maxPeriod, double periodStep, double dampRatio, double *Period, double *Fre, double *MAcc, double *MVel, double *MDis, int numt)
|
||||
{
|
||||
//略
|
||||
Period[0] = 99.95;
|
||||
Fre[0] = 99.96;
|
||||
MAcc[0] = 99.97;
|
||||
MVel[0] = 99.98;
|
||||
MDis[0] = 99.99;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
double acc[20] = { 0.0038,0.0049,0.0061,0.0075,0.0088,0.01,0.0112,0.0123,0.0133,0.0140,0.0146,0.0152,0.0157,0.0162,0.0167,0.0172,0.0175,0.0178,0.0179,0.0179 };
|
||||
int len = 20;
|
||||
double dt = 0.005;
|
||||
double maxPeriod = 10.0;
|
||||
double periodStep = 0.02;
|
||||
double dampRatio = 0.05;
|
||||
int numt = int(maxPeriod / periodStep) + 1;
|
||||
double *Fre = new double[numt];
|
||||
double *MDis = new double[numt];
|
||||
double *MVel = new double[numt];
|
||||
double *MAcc = new double[numt];
|
||||
double *Period = new double[numt];
|
||||
for (int i = 0; i<numt; i++) {
|
||||
Period[i] = periodStep*i;
|
||||
Fre[i] = 0;
|
||||
MDis[i] = 0;
|
||||
MVel[i] = 0;
|
||||
MAcc[i] = 0;
|
||||
}
|
||||
Period[0] = 0.001;
|
||||
//cal_spec_accel(double acc[], int len,double dt,double maxPeriod,double periodStep,double dampRatio,double *Period,double *Fre,double *MAcc,double *MVel,double *MDis)
|
||||
cal_spec_accel(acc, len, dt, maxPeriod, periodStep, dampRatio, Period, Fre, MAcc, MVel, MDis, numt);
|
||||
|
||||
for (int i = 0; i<numt; i++)
|
||||
{
|
||||
cout << MAcc[i] << endl;
|
||||
}
|
||||
|
||||
delete[] Fre;
|
||||
return 0;
|
||||
#include "CalSpecSpeaLib.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <math.h>
|
||||
using namespace std;
|
||||
|
||||
|
||||
double maxabs(double num[], int len)
|
||||
{
|
||||
//略
|
||||
return abs(num[0]);
|
||||
|
||||
}
|
||||
bool isALLvaluezero(double num[], int len)
|
||||
{
|
||||
//略
|
||||
return false;
|
||||
|
||||
}
|
||||
void cal_spec_accel(double acc[], int len, double dt, double maxPeriod, double periodStep, double dampRatio, double *Period, double *Fre, double *MAcc, double *MVel, double *MDis, int numt)
|
||||
{
|
||||
//略
|
||||
Period[0] = 99.95;
|
||||
Fre[0] = 99.96;
|
||||
MAcc[0] = 99.97;
|
||||
MVel[0] = 99.98;
|
||||
MDis[0] = 99.99;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
double acc[20] = { 0.0038,0.0049,0.0061,0.0075,0.0088,0.01,0.0112,0.0123,0.0133,0.0140,0.0146,0.0152,0.0157,0.0162,0.0167,0.0172,0.0175,0.0178,0.0179,0.0179 };
|
||||
int len = 20;
|
||||
double dt = 0.005;
|
||||
double maxPeriod = 10.0;
|
||||
double periodStep = 0.02;
|
||||
double dampRatio = 0.05;
|
||||
int numt = int(maxPeriod / periodStep) + 1;
|
||||
double *Fre = new double[numt];
|
||||
double *MDis = new double[numt];
|
||||
double *MVel = new double[numt];
|
||||
double *MAcc = new double[numt];
|
||||
double *Period = new double[numt];
|
||||
for (int i = 0; i<numt; i++) {
|
||||
Period[i] = periodStep*i;
|
||||
Fre[i] = 0;
|
||||
MDis[i] = 0;
|
||||
MVel[i] = 0;
|
||||
MAcc[i] = 0;
|
||||
}
|
||||
Period[0] = 0.001;
|
||||
//cal_spec_accel(double acc[], int len,double dt,double maxPeriod,double periodStep,double dampRatio,double *Period,double *Fre,double *MAcc,double *MVel,double *MDis)
|
||||
cal_spec_accel(acc, len, dt, maxPeriod, periodStep, dampRatio, Period, Fre, MAcc, MVel, MDis, numt);
|
||||
|
||||
for (int i = 0; i<numt; i++)
|
||||
{
|
||||
cout << MAcc[i] << endl;
|
||||
}
|
||||
|
||||
delete[] Fre;
|
||||
return 0;
|
||||
}
|
|
@ -1,3 +1,3 @@
|
|||
double maxabs(double num[], int len);
|
||||
bool isALLvaluezero(double num[], int len);
|
||||
double maxabs(double num[], int len);
|
||||
bool isALLvaluezero(double num[], int len);
|
||||
void cal_spec_accel(double acc[], int len, double dt, double maxPeriod, double periodStep, double dampRatio, double *Period, double *Fre, double *MAcc, double *MVel, double *MDis, int numt);
|
|
@ -1,7 +1,7 @@
|
|||
cd %~dp0
|
||||
|
||||
python setup.py build
|
||||
|
||||
python test.py
|
||||
|
||||
cd %~dp0
|
||||
|
||||
python setup.py build
|
||||
|
||||
python test.py
|
||||
|
||||
pause
|
|
@ -1,11 +1,11 @@
|
|||
from distutils.core import setup, Extension
|
||||
|
||||
from Cython.Distutils import build_ext
|
||||
import numpy
|
||||
|
||||
|
||||
setup(
|
||||
cmdclass={'build_ext': build_ext},
|
||||
ext_modules=[Extension("CalSpecSpea", sources=[
|
||||
"CalSpecSpea.pyx", "CalSpecSpeaLib.cpp"], language="c++", include_dirs=[numpy.get_include()])]
|
||||
)
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
from Cython.Distutils import build_ext
|
||||
import numpy
|
||||
|
||||
|
||||
setup(
|
||||
cmdclass={'build_ext': build_ext},
|
||||
ext_modules=[Extension("CalSpecSpea", sources=[
|
||||
"CalSpecSpea.pyx", "CalSpecSpeaLib.cpp"], language="c++", include_dirs=[numpy.get_include()])]
|
||||
)
|
|
@ -1,32 +1,32 @@
|
|||
import sys
|
||||
import time
|
||||
|
||||
sys.path.append(
|
||||
'./build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor))
|
||||
|
||||
|
||||
from CalSpecSpea import calspecaccel
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
t1 = time.time()
|
||||
acc = np.loadtxt('hf_acc.txt')
|
||||
dt = 0.005
|
||||
maxPeriod = 10.0
|
||||
periodStep = 0.02
|
||||
dampRatio = 0.05
|
||||
|
||||
Period, Fre, MAcc, MVel, MDis = calspecaccel(
|
||||
acc, acc.shape[0], dt, maxPeriod, periodStep, dampRatio)
|
||||
|
||||
print('Period[0]', Period[0])
|
||||
print('Fre[0]', Fre[0])
|
||||
print('MAcc[0]', MAcc[0])
|
||||
print('MVel[0]', MVel[0])
|
||||
print('MDis[0]', MDis[0])
|
||||
|
||||
t2 = time.time() - t1
|
||||
print(t2)
|
||||
|
||||
plt.plot(Period, MAcc)
|
||||
plt.show()
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.path.append(
|
||||
'./build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor))
|
||||
|
||||
|
||||
from CalSpecSpea import calspecaccel
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
t1 = time.time()
|
||||
acc = np.loadtxt('hf_acc.txt')
|
||||
dt = 0.005
|
||||
maxPeriod = 10.0
|
||||
periodStep = 0.02
|
||||
dampRatio = 0.05
|
||||
|
||||
Period, Fre, MAcc, MVel, MDis = calspecaccel(
|
||||
acc, acc.shape[0], dt, maxPeriod, periodStep, dampRatio)
|
||||
|
||||
print('Period[0]', Period[0])
|
||||
print('Fre[0]', Fre[0])
|
||||
print('MAcc[0]', MAcc[0])
|
||||
print('MVel[0]', MVel[0])
|
||||
print('MDis[0]', MDis[0])
|
||||
|
||||
t2 = time.time() - t1
|
||||
print(t2)
|
||||
|
||||
plt.plot(Period, MAcc)
|
||||
plt.show()
|
|
@ -1,7 +1,7 @@
|
|||
cd %~dp0
|
||||
|
||||
python setup.py build
|
||||
|
||||
python test.py
|
||||
|
||||
cd %~dp0
|
||||
|
||||
python setup.py build
|
||||
|
||||
python test.py
|
||||
|
||||
pause
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# Created on 2018年5月6日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com, https://github.com/892768447
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file:
|
||||
# description:
|
|
@ -1,9 +1,9 @@
|
|||
from distutils.core import setup, Extension
|
||||
|
||||
from Cython.Distutils import build_ext
|
||||
|
||||
|
||||
setup(
|
||||
cmdclass={'build_ext': build_ext},
|
||||
ext_modules=[Extension("pydmod", sources=["pydmod.py"])]
|
||||
)
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
from Cython.Distutils import build_ext
|
||||
|
||||
|
||||
setup(
|
||||
cmdclass={'build_ext': build_ext},
|
||||
ext_modules=[Extension("pydmod", sources=["pydmod.py"])]
|
||||
)
|
|
@ -1,7 +1,7 @@
|
|||
import sys
|
||||
sys.path.insert(0,
|
||||
'./build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor))
|
||||
|
||||
import pydmod
|
||||
print(pydmod)
|
||||
print(pydmod.sum(1, 5))
|
||||
import sys
|
||||
sys.path.insert(0,
|
||||
'./build/lib.{0}-{1}.{2}'.format(sys.platform, sys.version_info.major, sys.version_info.minor))
|
||||
|
||||
import pydmod
|
||||
print(pydmod)
|
||||
print(pydmod.sum(1, 5))
|
|
@ -1,34 +1,34 @@
|
|||
# 图片加载测试
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
### 分别通过2种情况加载图片文件和资源文件
|
||||
|
||||
1. 通过pyrcc5转换res.qrc为res_rc.py文件,可以直接import加载
|
||||
- 转换命令pyrcc5 res.qrc -o res_rc.py
|
||||
- import res_rc
|
||||
- 此时可以通过QPixmap(":/images/head.jpg")来加载
|
||||
|
||||
2. 通过rcc命令转成为二进制文件res.rcc
|
||||
- 转换命令cd tools
|
||||
- rcc.exe -binary ../res.qrc -o ../res.data
|
||||
- 通过QResource.registerResource("res.data")注册
|
||||
- 此时可以通过QPixmap(":/images/head.jpg")来加载
|
||||
|
||||
3. 文本资源读取
|
||||
|
||||
```
|
||||
def readText(path):
|
||||
file = QFile(path)
|
||||
if not file.open(QIODevice.ReadOnly):
|
||||
return ''
|
||||
stream = QTextStream(file)
|
||||
#下面这句设置编码根据文件的编码自行确定
|
||||
stream.setCodec(QTextCodec.codecForName('UTF-8'))
|
||||
data = stream.readAll()
|
||||
file.close()
|
||||
del stream
|
||||
return data
|
||||
```
|
||||
|
||||
# 图片加载测试
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
### 分别通过2种情况加载图片文件和资源文件
|
||||
|
||||
1. 通过pyrcc5转换res.qrc为res_rc.py文件,可以直接import加载
|
||||
- 转换命令pyrcc5 res.qrc -o res_rc.py
|
||||
- import res_rc
|
||||
- 此时可以通过QPixmap(":/images/head.jpg")来加载
|
||||
|
||||
2. 通过rcc命令转成为二进制文件res.rcc
|
||||
- 转换命令cd tools
|
||||
- rcc.exe -binary ../res.qrc -o ../res.data
|
||||
- 通过QResource.registerResource("res.data")注册
|
||||
- 此时可以通过QPixmap(":/images/head.jpg")来加载
|
||||
|
||||
3. 文本资源读取
|
||||
|
||||
```
|
||||
def readText(path):
|
||||
file = QFile(path)
|
||||
if not file.open(QIODevice.ReadOnly):
|
||||
return ''
|
||||
stream = QTextStream(file)
|
||||
#下面这句设置编码根据文件的编码自行确定
|
||||
stream.setCodec(QTextCodec.codecForName('UTF-8'))
|
||||
data = stream.readAll()
|
||||
file.close()
|
||||
del stream
|
||||
return data
|
||||
```
|
||||
|
||||
其它方式见https://github.com/892768447/PyQt/tree/master/%E5%9B%BE%E7%89%87%E5%8A%A0%E8%BD%BD
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2018年05月01日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: qrctest1
|
||||
@description:
|
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2018年05月01日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: qrctest2
|
||||
@description:
|
|
@ -8,7 +8,7 @@ import res_rc # @UnresolvedImport @UnusedImport
|
|||
|
||||
# Created on 2018年5月1日
|
||||
# author: Irony
|
||||
# site: https://pyqt5.com, https://github.com/892768447
|
||||
# site: https://pyqt5.com , https://github.com/892768447
|
||||
# email: 892768447@qq.com
|
||||
# file: QRC资源文件使用.textread
|
||||
# description:
|
Before Width: | Height: | Size: 988 KiB After Width: | Height: | Size: 988 KiB |
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 344 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 74 KiB |
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2018年1月29日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: OpencvWidget
|
||||
@description:
|
|
@ -1,17 +1,17 @@
|
|||
# Opencv 人脸描点检测
|
||||
|
||||
简单联系PyQt 结合 Opencv 进行人脸检测;
|
||||
由于直接在主线程中进行特征点获取,效率比较低
|
||||
|
||||
### 依赖文件
|
||||
- [opencv](https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv)
|
||||
- [numpy](https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
|
||||
- [dlib](http://dlib.net/)
|
||||
- [dlib-19.4.0.win32-py2.7.exe](dist/dlib-19.4.0.win32-py2.7.exe)
|
||||
- [dlib-19.4.0.win32-py3.4.exe](dist/dlib-19.4.0.win32-py3.4.exe)
|
||||
- [dlib-19.4.0.win32-py3.5.exe](dist/dlib-19.4.0.win32-py3.5.exe)
|
||||
- [shape-predictor-68-face-landmarks.dat.bz2](http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2)
|
||||
|
||||
截图
|
||||
|
||||
# Opencv 人脸描点检测
|
||||
|
||||
简单联系PyQt 结合 Opencv 进行人脸检测;
|
||||
由于直接在主线程中进行特征点获取,效率比较低
|
||||
|
||||
### 依赖文件
|
||||
- [opencv](https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv)
|
||||
- [numpy](https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy)
|
||||
- [dlib](http://dlib.net/)
|
||||
- [dlib-19.4.0.win32-py2.7.exe](dist/dlib-19.4.0.win32-py2.7.exe)
|
||||
- [dlib-19.4.0.win32-py3.4.exe](dist/dlib-19.4.0.win32-py3.4.exe)
|
||||
- [dlib-19.4.0.win32-py3.5.exe](dist/dlib-19.4.0.win32-py3.5.exe)
|
||||
- [shape-predictor-68-face-landmarks.dat.bz2](http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2)
|
||||
|
||||
截图
|
||||
|
||||
![1](ScreenShot/1.png)
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年12月11日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: HotKey
|
||||
@description:
|
|
@ -1,23 +1,23 @@
|
|||
# PyQt全局热键 For Windows Test
|
||||
|
||||
pip install keyboard
|
||||
|
||||
https://github.com/892768447/keyboard
|
||||
|
||||
* keyboard
|
||||
* 该模块使用全局低级钩子的方式hook键盘来处理,对系统有一定的影响
|
||||
* 有反映说弹出对话框假死,这里粗略解决下使用信号槽的方式来弹出对话框
|
||||
* 该模块里使用了每次产生一个子线程来回调函数
|
||||
```
|
||||
def call_later(fn, args=(), delay=0.001):
|
||||
"""
|
||||
Calls the provided function in a new thread after waiting some time.
|
||||
Useful for giving the system some time to process an event, without blocking
|
||||
the current execution flow.
|
||||
"""
|
||||
thread = _Thread(target=lambda: (_time.sleep(delay), fn(*args)))
|
||||
thread.start()
|
||||
```
|
||||
|
||||
# 截图
|
||||
# PyQt全局热键 For Windows Test
|
||||
|
||||
pip install keyboard
|
||||
|
||||
https://github.com/892768447/keyboard
|
||||
|
||||
* keyboard
|
||||
* 该模块使用全局低级钩子的方式hook键盘来处理,对系统有一定的影响
|
||||
* 有反映说弹出对话框假死,这里粗略解决下使用信号槽的方式来弹出对话框
|
||||
* 该模块里使用了每次产生一个子线程来回调函数
|
||||
```
|
||||
def call_later(fn, args=(), delay=0.001):
|
||||
"""
|
||||
Calls the provided function in a new thread after waiting some time.
|
||||
Useful for giving the system some time to process an event, without blocking
|
||||
the current execution flow.
|
||||
"""
|
||||
thread = _Thread(target=lambda: (_time.sleep(delay), fn(*args)))
|
||||
thread.start()
|
||||
```
|
||||
|
||||
# 截图
|
||||
![截图](ScreenShot/1.gif)
|
Before Width: | Height: | Size: 245 KiB After Width: | Height: | Size: 245 KiB |
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com, https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: 单实例应用.Application
|
||||
@description:
|
|
@ -1,6 +1,6 @@
|
|||
#单实例应用 Application
|
||||
|
||||
###[Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
- 方法1:QSharedMemory
|
||||
#单实例应用 Application
|
||||
|
||||
###[Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
- 方法1:QSharedMemory
|
||||
- 方法2:QLocalSocket, QLocalServer
|
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com, https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: TestQSharedMemory
|
||||
@description:
|
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com, https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: TestQSingleApplication
|
||||
@description:
|
|
@ -1,7 +1,7 @@
|
|||
# 右下角弹出框
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
# 截图
|
||||
![截图](ScreenShot/1.png)
|
||||
# 右下角弹出框
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
# 截图
|
||||
![截图](ScreenShot/1.png)
|
||||
![截图](ScreenShot/2.png)
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com, https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: WindowNotify
|
||||
@description:
|
|
@ -4,7 +4,7 @@
|
|||
'''
|
||||
Created on 2017年3月30日
|
||||
@author: Irony."[讽刺]
|
||||
@site: https://pyqt5.com, https://github.com/892768447
|
||||
@site: https://pyqt5.com , https://github.com/892768447
|
||||
@email: 892768447@qq.com
|
||||
@file: FontAwesome
|
||||
@description:
|
|
@ -1,9 +1,9 @@
|
|||
# 字体测试
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
### 其中Roboto字体通过TTF编辑器修改了family,方便QFont加载
|
||||
|
||||
# 截图
|
||||
![截图](ScreenShot/1.png)
|
||||
# 字体测试
|
||||
|
||||
### [Python3.4.4 or Python3.5][PyQt5]
|
||||
|
||||
### 其中Roboto字体通过TTF编辑器修改了family,方便QFont加载
|
||||
|
||||
# 截图
|
||||
![截图](ScreenShot/1.png)
|
||||
![截图](ScreenShot/2.png)
|