(GIT:638683E)X-Ray Python Library探测器

libDetXR的Python项目详细描述


探测器x射线python包

这些python脚本中的大多数可以使用选项'-h'调用,以获得更详细的帮助。

libdetxr.py

libdetxr.(dll,so)库的包装器。它们包含以下C功能:
  • 压缩算法
  • 成像算法
  • Bitmanip函数

详情见S.A.: C/C++:../src/README.rst

规格2HDF5.py

Input:*.cbf files and *.dat files
Output:one *.hdf5 file
Speedup:muptiprocess single node

在CSAXS光束线上收集扫描数据并将其存储在一个HDF5文件中

这将分析并将以下数据合并到一个HDF5文件中:

specES1/dat-files/specES1_started_2013_04_26_1604.dat
mcs/S00000-00999/S00033/e14472_00033.dat
eiger/S00000-00999/S00033/e14472_1_00033_00000_00001.cbf and many more
pilatus_1/S00000-00999/S00033/e14472_1_00033_00000_00001.cbf and many more
pilatus_2/S00000-00999/S00033/e14472_1_00033_00000_00001.cbf and many more

使用所有可用的核心,可以在一个计算节点上加速。

imgsource.py

imgsource是一个提供图像的帮助类。在zmqimagesource、procmoment、procroistat、procstxm中使用 目前支持以下来源:

Random values:
  --src rand    X    Y Z --type=DATATYPE
  --src rand 2560 2160 3 --type=uint16
Incremental values:
  --src inc    X    Y Z --type=uint16
  --src inc 2560 2160 6 --type=uint16
Raw data from files *.raw in a directory:
  --src raw    X    Y PATH                       --type=DATATYPE
  --src raw 2560 2160 /scratch/detectorData/PCO/ --type=uint16
TIFF data from files *.tif[f] in a directory:
  --src tif PATH
  --src tif /scratch/detectorData/PCO/
CBF data from files *.cbf in a directory:
  --src cbf PATH
  --src cbf /scratch/detectorData/e14472/pilatus_1/S00000-00999/S00033/
HDF file from a given object:
  --src hdf FILE ELEM
  --src hdf myfile.hdf5 entry/mygrp/dataset
ZMQ source stream (now only uncompressed 'chunk'-type is supported)
  --src zmq JSON-config (with server,optional (queueSz, ifType and timeout))
  --src zmq '{"server":"tcp://localhost:8080","queueSz":4,"ifType":"PULL"}',

zmqimagesource.py

ZeroMQ推送或发布服务器:
数据源可以是imgsource支持的类型之一。然后,它将这些图像作为zmq消息(块类型、原始或压缩)发送。
Input:a data source: *.cbf, *.tiff, *.hdf5 *.raw zmqStream etc. files
Output:one zmq-Streams with ‘chunk’ header (raw or compressed)
Speedup:only single process

procmoment.py

处理图像源(cbf、tiff、raw文件或hdf5文件)的力矩m00、m11、m01、m02、m10、m20,并将结果存储在输出的hdf5文件中。

Input:ImgSource.py data: (raw, tiff, cbf, hdf5, zmq-steam, etc.), optional MATLAB Mask file for valid pixels
Output:one *.hdf5 file or a zmq Stream
Speedup:only single process
可以进一步可视化这些时刻。
可以采用不同的实现:python/opencv或c
多进程加速尚未实现,但根据请求是可行的。
如果有要求,simd的实现速度也会加快。

单图像处理(32位,1679x1475 Pilatus_2图像,在PC 9477上): :python:0.5秒 :pyfast:0.03秒 :打开cv:0.005秒 :c:0.005秒 现在的速度主要是内存带宽限制。

procroistat.py

处理图像源(cbf、tiff、raw文件或hdf5文件)的多个roi的统计信息,并将每个roi的结果(avg、avgstd、sumsq)存储在输出的hdf5文件中。

Input:ImgSource.py data: (raw, tiff, cbf, hdf5, zmq-steam, etc.), and a MATLAB Roi file
Output:one *.hdf5 file or a zmq Stream
Speedup:only single process

roi定义的输入是csaxs波束线使用的matlab roi文件(例如pilatus_integration_mask.mat)。

当前仅实现avg。
速度远高于原始的Matlab实现。
多进程加速尚未实现,但根据请求是可行的。
如果有要求,simd的实现速度也会加快。
单图像处理(32位,1679x1475 Pilatus_2图像,在PC 9477上):
加速取决于面罩。使用的掩码是一个16段的pilatus_integration_mask.mat
加速c实现vesus python:41-42倍
python的实现比原来的matlab快得多。
python:0.235 sec
c:0.006sec

因此,与Matlab程序相比,我们可以达到100-500倍的加速比。 现在的速度主要是内存带宽限制。

过程Py

图像源的stxm处理和可视化。目前的实现是非常基本的,只是作为模板,稍后将有一个更快更灵活的脚本处理脚本。

Input:ImgSource.py data: (raw, tiff, cbf, hdf5, zmq-steam, etc.), optional MATLAB Mask file for valid pixels
Output:x,y,t during processing on console. STXM viewer and /tmp/result.npz file when processing is finished.
Speedup:only single process, multiproc-single node for hdf5->hdf5 processing

zmqwriter.py

zmqwriter连接到发送json和二进制数据消息的zmq服务器。

Input:one or multiple zmq-Streams with ‘chunk’ or ‘pilatus’(cbf-files) header
Output:one *.hdf5 file
Speedup:muptiprocess single node (compression). Single process writing to file.
这些数据存储在hdf5文件中,或者它可以复制*.cbf文件。
程序也可以作为rest服务器启动。
rest服务器和每个writer都是一个独立的进程。

无法预见writer进程的多进程压缩加速,因为zmqwriter旨在接收压缩块。无论如何:zmqwriter可以将图像转换为所需的压缩方案,但这将是单线程的,因此可能是时间关键的:

1. *.cbf-Files            -> *.cbf-Files
2. raw image              -> hdf5-File (uncompressed, byte-shuffle, zlib lz4, lzf)
3. *.cbf-Files            -> hdf5-File (uncompressed, byte-shuffle, zlib lz4, lzf)
4. compressed image-chunk -> hdf5-File (compressed as the received image-chunk)

制作中使用的模式是1对于来自pilatus的cbf文件,对于带有eiger的hdf5文件,为4。

模式2和3用于测试和准备HDF5格式,不建议用于生产。它们不起作用

cbf2晶体felhdf5.py

将CBF文件转换为Crystfel HDF5文件。 程序搜索目录中的所有*.cbf文件并将其转换。 美国http://www.desy.de/~twhite/crystfel/

其他帮助类

utilities.py:utilities to create HDF5 objects
CbfParser.py:class to parse ^{tt1}$ files. It gets the header and decompress the binary part to a numpy array
DatParser.py:class to parse ^{tt3}$ files at the cSAXS beamline.
zmq2imgGL.py:
a zmq sink to show an show a colored image that is received.
^{tt1}$ zmq messages, uncompressed and compressed chunks are supported.
FileNameGen.py:generate filenames with a given filename pattern. (Currently not used)
hdf5vis.py:Simple Test application to show movies of image series in a hdf5-file
libDetXRTester.py:
sample code to test the libDetXR functionality.
testPerfHdf5ChunkWrite.py:
Test the performance of Chunk writing:
all source data is first read into ram, then a HDF5 file is written.
diffferent interprocess communications are tested and compared:
^{tt5}$

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

推荐PyPI第三方库


热门话题
Java Hibernate@ManyToMany mapping只在一个方向上在数据库中添加记录   java将文件上载到tomcat服务器外部的文件夹   java将摄像头捕获的图像上传到服务器   java如何创建Rest API并为进程添加时间延迟?   springmodulesvalidation0中缺少java注释包。8a源文件   如何在java中打印SOAP头   Spring security中的java自定义消息,包括UserDetailsService实现和异常   java如何使用Htmlunit中的表单数据登录站点   web如何在WildFly上自动运行java文件   java如何从已经使用另一个方法传递的参数的方法中获取返回值?   java我在JFrame上有一个索引越界。setContentPane   java中的循环序列/系列打印   java maven 3 webapp没有要运行的测试吗?   java CORS不允许POST请求   java再次在派生类中的Jackson中添加字段,该字段在基类中被忽略   爪哇坑测试显示仆从由于超时而异常退出   java寻找第10001个素数   java jboss是否更改web应用程序上下文根?