用于读取/写入STDF/ATDF文件的库
项目描述
Semi-ATE的STDF库
Standard Test Data Format
此库并不旨在成为世界上速度最快的!
人们经常在寻找“最快的”STDF解析器。如果您正在寻找这个,继续寻找 并无论如何,稍后撞墙,那时您可能考虑回来! 🤣
好吧,首先应该使用C或C++(可能)编写一个快速的解析器,因为要真正地快速,它必须摒弃大量的检查/纠正,甚至可能丢弃一些被认为不够有趣的信息(后来证明这些信息至关重要)。然而,在现实生活中,STDF文件远非完美,这意味着快速解析器将无法完成它们预期的工作!你可能对环境中的某个ATE进行一些调整,但这个解析器绝对不是万能的!
无论如何,当你开始解析STDF数据,并希望与数据交互时,正如他们所说,你“来得太晚了,太晚了”...你还在上上个世纪(更不用说上千年了 🤪)生活。
一个好的解析器是用高级语言(如Python)编写的,并且会进行大量的检查(必要时还会进行纠正),不会丢弃任何信息,以确保返回完整、有意义的正确数据!这当然会使它变慢。可以通过使用Cython或numba(可能)来稍微优化一下,但这不是重点。
重点是,STDF数据应在生成时转换为可用的格式,如pandas(仅使用numpy是不够的,因为许多数据不是数值的)同时进行生成,最好是事后而不是使用前!
可以这样想:从ATE的角度看,STDF是一个非常好的格式,因为如果测试程序崩溃,我们几乎不会丢失数据!此外,在STDF中,与ATE相关的所有信息都有其定义的位置!(与CSV或类似的东西相比...呃,你不能称之为“格式”,对吧?)无论如何,STDF从数据分析的角度看是一个不可用的格式!因此,我们需要将数据转换为可用的格式。(如果你现在在考虑SQL,那么我可以证实你是一个真正的自虐者,因为你显然对数据科学(data science)一无所知!🧐)
无论如何,我推荐使用pandas,因为Semi-ATE是基于Python(>=3.7)的,但为了公平起见,你也可以选择SAS或R,但这些在Semi-ATE概念中意义不大。
无论如何,Semi-ATE输出STDF数据,所以无论你有什么(遗留)系统,Semi-ATE都会与之很好地配合!
Semi-ATE-Metis项目基于Semi-ATE-STDF/numpy/scipy/pandas/GStreamer/HDF5/matplotlib,为半导体测试行业提供定制的数据分析...开源!
吃掉那Mentor/Galaxy!多年来你白拿钱,最后还是让客户失望(参照PAT)。我的银色 lining:现在我们将做一些让客户失望的事情!看看感觉如何!😋
这不仅仅是解析器!
在Semi-ATE中,我们还需要写入STDF文件!
事实上,以下是Semi-ATE-STDF库的规范
- 字节序:小端和大端
- 格式: STDF & ATDF
- 版本和扩展
- 模式:读 & 写
- 压缩方式:(在 所有 模式下!)
- 编码
- 浮点数扩展
- IEEE 754-1985(又称:NaN,nan,Infinity,Inf,inf,...)
(Python 2 的支持已废弃)
- Python 3.7
- Python 3.8 ---add-badges-here---(代码覆盖率,构建)
- Python 3.9
- 打包:
安装
独立
conda
$ conda install Semi-ATE-STDF
pip
$ pip install Semi-ATE-STDF
作为 Semi-ATE 套件的一部分
conda(推荐)
$ conda install Semi-ATE
pip(不推荐,因为 Semi-ATE 为 Spyder 提供了一个插件)
$ pip install Semi-ATE
使用示例
这个 STDF 库是 Semi-ATE 套件的一部分,它共享命名空间。
在标准输出上以人类可读的形式打印 STDF
from Semi_ATE import STDF
for REC in STDF.records_from_file("blahbla.stdf"):
print(REC)
处理存储为压缩形式(lzma)的 STDF 文件
from Semi_ATE import STDF
for REC in STDF.records_from_file("blahbla.stdf.xz"):
print(REC)
将 STDF 文件转换为 ATDF 文件
from Semi_ATE import STDF
basename = "blahblah"
with open(f"{basename}.atdf", "w") as atdf:
for REC in STDF.records_from_file(f"{basename}.stdf"):
atdf.write(REC.to_atdf())
处理 STDF 记录类
import time
from Semi_ATE import STDF
def test_records_from_file():
# Make 2 records and put them into one STDF file
record = STDF.FAR()
# Example of getting binary data:
data = record.__repr__()
record = STDF.WIR()
# Example of set_value functon:
record.set_value('HEAD_NUM', 1)
record.set_value('SITE_GRP', 1)
record.set_value('START_T', int(time.time()))
record.set_value('WAFER_ID', "WFR_ID_123456789")
# Example of collecting all records:
data += record.__repr__()
# Example of saving file :
f = open("test.stdf", mode="wb")
file_name = f.name
f.write(data)
f.close()
f = open(file_name)
print("\nDump content of the STDF file in text format")
# Example of printng binary data from the STDF file in text format:
for REC in STDF.records_from_file(file_name):
print(REC)
print("\nShow usage of get_fields function")
# Example of getting information about available fields:
for REC in STDF.records_from_file(file_name):
# Print name of the record
print(f" RECORD {REC.id}")
print(REC.get_fields())
print("\nShow usage of get_value function")
# Example of getting fields values:
for REC in STDF.records_from_file(file_name):
# Print name of the record
print(f" RECORD {REC.id}")
fields = REC.get_fields()
for field in fields:
value = REC.get_value(field)
print(f" Field {field} = {value}")
print("\nShow usage of to_dict function")
# Example of usage to_dict function:
for REC in STDF.records_from_file(file_name):
stdf_dict = REC.to_dict()
if REC.id=="WIR":
print(f"Get HEAD_NUM field value from dictinary : {stdf_dict['HEAD_NUM']}")
print(f"Get SITE_GRP field value from dictinary : {stdf_dict['SITE_GRP']}")
print(f"Get START_T field value from dictinary : {stdf_dict['START_T']}")
print(f"Get WAFER_ID field value from dictinary : {stdf_dict['WAFER_ID']}")
print("\nShow usage of reset function")
# Example of reseting data in a single record:
for REC in STDF.records_from_file(file_name):
if REC.id=="WIR":
REC.reset()
print(REC)
f.close()
注意
您可以使用这个库来制作自己的“转换器”,然而这是 Semi-ATE-Metis 项目的目标,所以通过使用 Semi-ATE-Metis(它依赖于 Semi-ATE-STDF),您不再需要处理“转换”了,您可以直接动手制作您想要的“工具”!!! :thumbsup
项目详情
Semi-ATE-STDF-0.1.28.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dc1ae69718922c2a637b1de9030e64746a94bc3fa8afc1d9e751b5f0fdf61e07 |
|
MD5 | b02d15d366ded36450ba4db898dfcffa |
|
BLAKE2b-256 | 366b28208b7c874f8aa682d9a14cc68ce73e09568dcc76945207374d8dd23288 |