Category Archives: Others

ImportError: cannot import name Publisher When Using py2exe

1. change from wx.lib.pubsub import Publisher to from wx.lib.pubsub import setuparg1 #must be setuparg1! not setupv1. otherwise cause problem: sendMessage() takes exactly 2 arguments (3 given) py2exe from wx.lib.pubsub import pub Publisher = pub.Publisher() 2. put this in the setup.py: … Continue reading

Posted in Others | Leave a comment

A easy way to clip over the area outside a path in matplotlib

See code in http://codepad.org/3I2wQrGF it’s a copy from internet: http://stackoverflow.com/questions/3320311/fill-outside-of-polygon-mask-array-where-indicies-are-beyond-a-circular-bounda

Posted in Others | Tagged | Leave a comment

Thermocouple temperature emf converter (Type C thermocouple included) [Python subroutine]

Type C thermocouple is “weird”! Not many people use it and most emf2T converters available online do not include it. Moreover, I cannot find a standard polynomial expression to translate emf to T or vice verse. The following python subroutine … Continue reading

Posted in Others | Tagged | Leave a comment

How to fix “AnyConnect was not able to establish a connection” or “VPN client driver encountered an error” Cisco AnyConnect VPN error messages

This post describes how to fix the following error messages when using Windows 8 Pro: AnyConnect was not able to establish a connection to the specified secure gateway.  Please try connecting again. The VPN client driver encountered an error.  Please … Continue reading

Posted in Others | 6 Comments

CFX CEL Mesh quality

1。mshqlty.fc是一个command程序。你在build里检查网格质量的时候,实际上是运行了cfx-solver并启动了一个userfortran程序USRTRN ,自动产生一个mshqlty.fc ,solver利用这个command程序进行了一次计算,生成了一个包含网格质量信息的dump文件,然后将网格信息输出到终端窗口,系统接下来将生成的dump删除,但保留mshqlty.fc 2。在cfx里,网格质量是由 正交性orthogonality,网格扩展率grid expansion,网格体积cell volume ,倾斜程度skew, 扭曲度twist,锥度taper六项来表示的 。 1)正交性由每个网格相配对的两个面的夹角表示 ,0度表示最好,90度最差。 2)网格扩展率是通过计算一个体网格与其相邻的六个体网格的体积比,取其中最大的比率,最好保证你的网格扩展率在1。2以下,实在由困难,也别超过1。4 3)网格体积只是计算出你的计算区域那最大网格的体积和最小网格的体积 4)倾斜程度是体网格内最大对角线与最小对角线的比率,1表示最好,越大则越差。 5)扭曲度最好是 0度,最大是90度,而大于90度则表示存在负的体网格或者严重扭曲的网格。 6)锥度,体网格相对的面积比率,最好是1,越大表示越差。 In CFX help, searching  “Measures of Mesh Quality” for details and for CEL expressions. ”

Posted in Others | Leave a comment

去掉Origin8 Legend的红框

选择菜单命令Format/Page或者在Graph窗口的灰色部分双击鼠标,打开Plot Details对话框,在左边的窗口中选中Graph名称,再在右边的窗口选中Legends。将其第三个复选框前的选项去掉,即 Indicate Active Dataset ;选中的话,如果图层有几组数据,那么就可以通过单击曲线图例来选中该组数据,被选中的数据曲线图例带有个小方框!

Posted in Experimental, Others | Leave a comment

Matlab批量处理图像思路

%% Matlab批处理图像框架 %————————————————————————————————– % 此m文件是批量处理图像的框架 % 2009.10.12 shine shuchong1987@sina.com %————————————————————————————————– %% 命令集 t = cd(‘xxxxx’); % dos命令cd重置当前路径,自行设置,其下包含全部待处理文件 allnames = struct2cell(dir);%dos命令dir列出所有的文件,用struct2cell转换为元胞数组 [m,n] = size(allnames); for i= 3:n name = allnames{1,i} %逐次取出文件名 filename = [t,’\’,name]%组成文件名 I = imread(filename);%本人测试了一下,imread要比importdata效率高一些 //Do your own work … Continue reading

Posted in Others | Leave a comment

vb.net access数据库,常用的连接数据库和记录集操作的方法

vb.net中是不是一般都不用adodb连接和操作记录集了呀? 那现在最好的方法是什么呢?有方便效率又高的方法是什么呢? 我看到很多都用 OleDbConnection连接数据库,然后用 OleDbDataAdapter把记录集 把数据复付到dataset里,还有更好的方法吗?最常用,效率最高的是什么呢? 是的,用oledb 毕竟ADO.NET和ADO在设计的思路上存在本质的差异,适应了就好用了. 单从效率和速度考虑,应该使用OleDbDataReader 通过 OleDbCommand.ExecuteReader() 方法获得 DataReader 对象。 因为DataReader对象是ReadOnly,ForwardOnly的。 一次只从数据库取一条记录,对于数据量比较大的操作可以考虑使用DataReader 但是DataReader操作不如DataTable方便。 oledb对access数据库进行操作: Dim objConn As New OleDb.OleDbConnection Dim objComm As New OleDb.OleDbCommand Dim objda As New OleDb.OleDbDataAdapter Dim objds As New DataSet objConn.ConnectionString = “provider=microsoft.jet.oledb.4.0;user;password=;data source=d:\1.mdb” 字串4 objComm.CommandText = “select … Continue reading

Posted in Others | Leave a comment

Read individual variables in CFX

If need to read the such individual variables in CFX as current timestep, current loop and so on, the subroutines  ‘USER_GET_TRANS_INF’ and ‘PEEKI/PEEKR’ are used. (Not ‘USER_GETVAR’). When use PEEKI/PEEKR/PEEKL/PEEKD to get the variables, user should note that which function … Continue reading

Posted in Others | Leave a comment

利用matlab求图片的灰度并利用灰度值绘图

一、求图片的灰度值: I=imread(‘sample.jpg’); !读取图片的RGB值 J=rgb2gray(I);!转换为灰度值 二、利用灰度值绘制图片: imshow(J) 三、绘制等高线 contour(J) contourf(J) 颜色填充

Posted in Others | Leave a comment