射频腔拉珠测量软件

beadpull的Python项目详细描述


说明

这是一个用珠拉法测量粒子加速度结构的软件。 它利用PyVISA设备通信库作为中间设备通信层,以支持多个平台。 特定于设备的代码在驱动程序对象中是隔离的;添加新的设备驱动程序是实现一组对象方法的问题。

此程序包括电机驱动程序:

  • 假马达(占位符驱动程序)
  • 随机失效的软件马达(用于程序调试)
  • UIRobot motor driver

此程序包括矢量分析仪的驱动程序:

  • 假分析器(占位符驱动程序)
  • 随机失效的软件分析器(用于程序调试)
  • Agilent8753et

安装

获取python和pip

下载并安装python和pip。

您可以为此使用包管理器。例如,在debian安装命令中,如下所示:

sudo apt-get install python3 python3-pip

如果没有包管理器,请从python web site下载安装程序。

您需要安装ni驱动程序(用于Windows安装)或linux gpib驱动程序。

安装ni驱动程序

如果需要使用ni驱动程序,请使用this manual进行安装。

安装linux gpib驱动程序

为了使用Linux-GPIB驱动程序,必须编译它们并安装python绑定。

注意。驱动程序是为当前的linux内核构建的。因此,在内核更新之后,需要重新编译gpib驱动程序。

获取源

要继续,您需要安装其他程序:

apt install -y git git-svn

获取最新来源:

git svn clone -r HEAD https://svn.code.sf.net/p/linux-gpib/code/trunk linux-gpib-code

现在您有了linux gpib的最新源代码:

cd linux-gpib-code

编译驱动程序

要编译驱动程序,您需要Linux源代码:

sudo apt install linux-source
cd linux-gpib-kernel

发出以下命令开始编译:

make

然后:

make install

这是用来编译驱动程序的。返回一个文件夹。

cd ..

编译用户空间实用程序

cd linux-gpib-user

由于我们使用来自project repo的源代码,因此需要准备autotools安装脚本:

apt install autotools-dev
./bootstrap
./configure --sysconfdir=/etc
make
make install

安装python3绑定

转到python绑定文件夹:

cd language/python

创建和安装python3模块:

python3 setup.py sdist
pip3 install dist/*.tar.gz

配置gpib设备

下载GPIB板固件表单https://linux-gpib.sourceforge.io/firmware/

本文档稍后将使用agilent_82350a设备。 固件存档假定位于~/Downloads/文件夹中。

/etc/gpib.conf中配置板。咨询configuration manual。 配置如下:

interface {minor=0       /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */        board_type = "agilent_82350b"   /* type of interface board being used */        name = "violet" /* optional name, allows you to get a board descriptor using ibfind() */        pad = 0 /* primary address of interface             */        sad = 0 /* secondary address of interface           */        timeout = T3s   /* timeout for commands */eos=0x0a      /* EOS Byte, 0xa is newline and 0xd is carriage return*/set-reos=yes  /* Terminate read if EOS */        set-bin = no    /* Compare EOS 8-bit */        set-xeos = no   /* Assert EOI whenever EOS byte is sent */        set-eot = yes   /* Assert EOI with last byte on writes *//* settings for boards that lack plug-n-play capability */base=0        /* Base io ADDRESS                  */        irq  = 0        /* Interrupt request level */        dma  = 0        /* DMA channel (zero disables)      */}device {minor=0       /* minor number for interface board this device is connected to */        name = "analyzer"       /* device mnemonic */        pad = 7 /* The Primary Address */        sad = 0 /* Secondary Address */        timeout = T3seos=0xa       /* EOS Byte */        set-reos = no /* Terminate read if EOS */        set-bin = no /* Compare EOS 8-bit */}

如有必要,上载板固件:

sudo gpib_config --init-data ~/Downloads/gpib_firmware-2008-08-10/hp_82350a/agilent_82350a.bin

配置udev规则

有些主板需要在每次启动时上传固件。 此外,与设备通信需要超级用户权限。 为了消除这些问题,让我们为设备添加udev规则。

首先,让我们创建一个新组,它将能够使用gpib设备:

addgroup gpib

将设备固件复制到/usr/local/sbin。 命令如下:

cp Downloads/gpib_firmware-2008-08-10/hp_82350a/agilent_82350a.bin /usr/local/sbin/

然后,创建一个包含以下内容的文件/usr/local/sbin/load_agilent

#!/bin/bash

gpib_config --init-data /usr/local/sbin/agilent_82350a.bin

并允许其执行:

chmod 755 /usr/local/sbin/load_agilent

将以下行添加到/etc/udev/rules.d/99-gpib.rules文件:

KERNEL=="gpib0", SUBSYSTEM=="gpib_common", GROUP="gpib", MODE="0660", RUN+="/usr/local/sbin/load_agilent"

现在设备将对组gpib中的用户可用,其固件将自动加载。

安装beadpull

从终端发出命令

pip3 install beadpull

用于全系统安装,或

pip3 install --user beadpull

用于本地安装。

将用户添加到设备通信组[可选]

gnu/linux发行版限制对外围设备的访问。

要向用户授予对串行设备的访问权限,请发出命令:

adduser user dialout

USB设备:

adduser user plugdev

GPIB设备(如果已配置):

adduser user gpib

运行

为了运行程序,从终端发出命令

beadpull

如果找不到,则必须修改PATH环境变量以包含python scripts文件夹(unix guidewindows guide)或提供程序的完整路径。

其他

更新beadpull

要更新程序,请从终端发出命令

pip3 install --upgrade beadpull

用于全系统安装,或

pip3 install --upgrade --user beadpull

用于本地安装。

beadpull设置重置为默认值

程序将其设置保存在 APPDATA/beadupll在windows和$XDG_CONFIG_HOME/beadpull$HOME/.config/beadpull在其他系统上。 要重置设置,只需删除保存的设置文件夹。

问题提交

如果程序有问题,请在issue tracker中创建问题。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JPanel不会对键绑定做出反应   当时间大于零时,不得在UI线程上调用java Await   JTextArea的java线程安全。追加   Java用户输入的字和行计数器   java以spreedsheat格式将数据保存到文件中   java构造函数的意义是什么?   java findViewById返回null,尽管组件的ID存在   java如何向按钮添加图像   java如何中断ExecutorService的线程   java如何将属性(例如枚举)绑定到不同类型的组件属性(例如每个枚举的映像)?   随机森林分类器的java实现   html使用java连接到一个站点并发布,HTTP状态代码200   从类访问属性时发生java编译错误   Java自动填充ArrayList,搜索更好的选项