小编San*_*ndy的帖子

如何使用可点击的python事件单击一个绘图以获取更多信息来生成多个绘图

我正在开发一个应用程序,它可以通过单击第一个图中的数据点来生成第二个图.我正在使用事件来实现这一目标.

题:

  1. 如何通过单击第二个绘图数据点生成第三个绘图?是否有可能实现这一目标?
  2. 如何生成更简单的3层合成数据?

我到目前为止的代码:

"""
compute the mean and stddev of 100 data sets and plot mean vs stddev.
When you click on one of the mu, sigma points, plot the raw data from
the dataset that generated the mean and stddev
"""
import numpy as np
import matplotlib.pyplot as plt

X = np.random.rand(100, 1000)
xs = np.mean(X, axis=1)
ys = np.std(X, axis=1)

fig = plt.figure()
ax = fig.add_subplot(211)
bx = fig.add_subplot(212)

# ax.set_title('click on point to plot time …
Run Code Online (Sandbox Code Playgroud)

python plot matplotlib

14
推荐指数
1
解决办法
582
查看次数

python visa/gpib模块中的等效函数ibwrtfW和ibwrtfA

我正在实验室仪器的自动化过程中.我有一个像函数的要求将通过VISA GPIB从主机PC发送文件/二进制数据到仪器.

在Ni4882.h中,有以下函数在Visual Studio 2010中传输文件/二进制数据,它正在工作.我非常精通发送命令作为GPIB字符串.

但我从未遇到通过GPIB命令发送文件.

这些是我在c ++中尝试过的函数.我使用ni4882.obj文件(有这些功能的定义)并创建了一个应用程序,所以我能够将文件PC传输到仪器.但是我无法在python中找到等效的函数

unsigned long NI488CC ibwrtfA  (int ud, const char * filename);
unsigned long NI488CC ibwrtfW  (int ud, const wchar_t * filename);
Run Code Online (Sandbox Code Playgroud)

谁能告诉我pyvisa或visa python包中的等效功能? - 或 - 任何等效的模块替代它.

我浏览了pyvisa和签证的所有功能,但我找不到相应的功能.

提前致谢!!

python gpib visa

6
推荐指数
1
解决办法
346
查看次数

如何将字典转换为默认字典python?

mapfile = {
    1879048192: 0,
    1879048193: 0,
    1879048194: 0,
    1879048195: 0,
    1879048196: 4,
    1879048197: 3,
    1879048198: 2,
    1879048199: 17,
    1879048200: 0,
    1879048201: 1,
    1879048202: 0,
    1879048203: 0,
    1879048204: 4,
    # intentionally missing byte
    1879048206: 2,
    1879048207: 1,
    1879048208: 0 # single byte cannot make up a dword
}

_buf = {}
for x in (x for x in mapfile.keys() if 0==x%4):
    try:
        s = "0x{0:02x}{1:02x}{2:02x}{3:02x}".format(mapfile[x+3],mapfile[x+2],mapfile[x+1],mapfile[x+0])
        print "offset ", x, " value ", s
        _buf[x] = int(s, 16)
    except KeyError as …
Run Code Online (Sandbox Code Playgroud)

python dictionary

4
推荐指数
3
解决办法
2482
查看次数

如何在python中动态更新字典

我正在尝试动态更新字典

for I in range(0,4):
    var = method(I) # var = "abc:def:ghi:1234"
    [a,b,c,d]= var.split(':')
    d = d.rstrip('\n')
    rdict = {i:d}
    rdict = rdict .update({i:d})
Run Code Online (Sandbox Code Playgroud)

但问题是,如果我打印rdict,它不打印.我,我缺少一些基本步骤.请帮忙.

python dictionary

1
推荐指数
1
解决办法
119
查看次数

如何对64位数据进行位操作并输出到dll中的C函数

我想将表示寄存器的压缩数组传递给接受a的C函数(在DLL中)char *.这是我到目前为止的代码:

from ctypes import * 
class BitField():
    def __init__(self,position,size):
        self.position = position
        self.size = size

class Reg1(BitField):
    self.dll = "win32.dll"
    self.B6 = BitField(self,58,6)
    self.B5 = BitField(self,54,4)
    self.B4 = BitField(self,48,6)
    self.B3 = BitField(self,36,12)
    self.B2 = BitField(self,24,12)
    self.B1 = BitField(self,16,8)
    self.B0 = BitField(self,0,16)

pack_register(Reg1,(expects a tuple)):
   pass    # created a stub , need help on this   
#I want to pack the to 64 bit data, by padding all other zero's, 
#if none of bit #fields specified by user.

obj …
Run Code Online (Sandbox Code Playgroud)

python string bit-manipulation

0
推荐指数
1
解决办法
263
查看次数

标签 统计

python ×5

dictionary ×2

bit-manipulation ×1

gpib ×1

matplotlib ×1

plot ×1

string ×1

visa ×1