ams-adf-reader 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ams_adf_reader-0.2.2/LICENSE +21 -0
- ams_adf_reader-0.2.2/MANIFEST.in +1 -0
- ams_adf_reader-0.2.2/PKG-INFO +27 -0
- ams_adf_reader-0.2.2/README.md +3 -0
- ams_adf_reader-0.2.2/VERSION +1 -0
- ams_adf_reader-0.2.2/pyproject.toml +3 -0
- ams_adf_reader-0.2.2/setup.cfg +4 -0
- ams_adf_reader-0.2.2/setup.py +50 -0
- ams_adf_reader-0.2.2/src/ams-adf-reader/Measurement.py +126 -0
- ams_adf_reader-0.2.2/src/ams-adf-reader/__init__.py +1 -0
- ams_adf_reader-0.2.2/src/ams_adf_reader.egg-info/PKG-INFO +27 -0
- ams_adf_reader-0.2.2/src/ams_adf_reader.egg-info/SOURCES.txt +13 -0
- ams_adf_reader-0.2.2/src/ams_adf_reader.egg-info/dependency_links.txt +1 -0
- ams_adf_reader-0.2.2/src/ams_adf_reader.egg-info/requires.txt +1 -0
- ams_adf_reader-0.2.2/src/ams_adf_reader.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Hüseyin YİĞİT
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include VERSION
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ams-adf-reader
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Antenna Measurement Software (AMS) File Format (ADF) Reader
|
|
5
|
+
Home-page: https://github.com/yigithsyn/ams-adf-reader
|
|
6
|
+
Author: Hüseyin YİĞİT
|
|
7
|
+
Author-email: yigit.hsyn@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: Any
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Intended Audience :: Other Audience
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Requires-Python: >= 3.4
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: h5py
|
|
24
|
+
|
|
25
|
+
# ams-adf-reader
|
|
26
|
+
|
|
27
|
+
Antenna Measurement Software (AMS) File Format (ADF) Reader
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.2.2
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
import pathlib
|
|
4
|
+
from setuptools import setup, find_packages, find_namespace_packages
|
|
5
|
+
|
|
6
|
+
# The directory containing this file
|
|
7
|
+
HERE = pathlib.Path(__file__).parent
|
|
8
|
+
|
|
9
|
+
# The text of the README file
|
|
10
|
+
README = (HERE / "README.md").read_text()
|
|
11
|
+
|
|
12
|
+
# Version: major.minor.patch
|
|
13
|
+
VERSION = (HERE / "VERSION").read_text().strip()
|
|
14
|
+
|
|
15
|
+
# License
|
|
16
|
+
LICENSE = 'MIT License'
|
|
17
|
+
|
|
18
|
+
# Required Python version
|
|
19
|
+
PYTHON_VERSION = '>= 3.4'
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
setup \
|
|
23
|
+
( name = "ams-adf-reader"
|
|
24
|
+
, version = VERSION
|
|
25
|
+
, description = "Antenna Measurement Software (AMS) File Format (ADF) Reader "
|
|
26
|
+
, long_description = README
|
|
27
|
+
, long_description_content_type='text/markdown'
|
|
28
|
+
, license = LICENSE
|
|
29
|
+
, author = "Hüseyin YİĞİT"
|
|
30
|
+
, author_email = "yigit.hsyn@gmail.com"
|
|
31
|
+
, install_requires = \
|
|
32
|
+
[ 'h5py' ]
|
|
33
|
+
, packages = find_namespace_packages(where='src'),
|
|
34
|
+
package_dir = {"": "src"}
|
|
35
|
+
, platforms = 'Any'
|
|
36
|
+
, url = "https://github.com/yigithsyn/ams-adf-reader"
|
|
37
|
+
, python_requires = PYTHON_VERSION
|
|
38
|
+
, classifiers = \
|
|
39
|
+
[ 'Development Status :: 2 - Pre-Alpha'
|
|
40
|
+
, 'License :: OSI Approved :: ' + LICENSE
|
|
41
|
+
, 'Operating System :: OS Independent'
|
|
42
|
+
, 'Programming Language :: Python'
|
|
43
|
+
, 'Programming Language :: Python :: 3'
|
|
44
|
+
, 'Intended Audience :: Science/Research'
|
|
45
|
+
, 'Intended Audience :: Other Audience'
|
|
46
|
+
, 'Topic :: Scientific/Engineering'
|
|
47
|
+
, 'Topic :: Scientific/Engineering :: Mathematics'
|
|
48
|
+
, 'Topic :: Scientific/Engineering :: Physics'
|
|
49
|
+
]
|
|
50
|
+
)
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import os, pathlib, datetime
|
|
2
|
+
from enum import Flag, auto
|
|
3
|
+
import h5py
|
|
4
|
+
|
|
5
|
+
class MeasurementType(Flag):
|
|
6
|
+
PLANAR_XSCAN = auto()
|
|
7
|
+
PLANAR_YSCAN = auto()
|
|
8
|
+
PLANAR = PLANAR_XSCAN | PLANAR_YSCAN
|
|
9
|
+
CUSTOM = auto()
|
|
10
|
+
|
|
11
|
+
class Measurement:
|
|
12
|
+
|
|
13
|
+
r""" Antenna Measurement System (AMS) data file object
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
filename : str
|
|
18
|
+
measurement file name
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
def __init__(self, filename: str):
|
|
22
|
+
if os.path.exists(filename):
|
|
23
|
+
if pathlib.Path(filename).suffix == ".adf":
|
|
24
|
+
self.hdf = h5py.File(filename, 'r')
|
|
25
|
+
|
|
26
|
+
datetimestr = self.hdf['Radiation Pattern']['ATTRIBUTES']['History'].attrs['Measurement Start'].strip()
|
|
27
|
+
self.start = datetime.datetime.strptime(datetimestr, "%a %b %d %H:%M:%S %Y")
|
|
28
|
+
|
|
29
|
+
datetimestr = self.hdf['Radiation Pattern']['ATTRIBUTES']['History'].attrs['Measurement Finished'].strip()
|
|
30
|
+
self.finish = datetime.datetime.strptime(datetimestr, "%a %b %d %H:%M:%S %Y")
|
|
31
|
+
|
|
32
|
+
self.duration = (self.finish - self.start).total_seconds()
|
|
33
|
+
|
|
34
|
+
self.axes = tuple(self.hdf['Radiation Pattern']['Radiation Pattern'].attrs['DIMENSION_LABELS'])
|
|
35
|
+
self.axesValues = tuple()
|
|
36
|
+
for item in self.axes:
|
|
37
|
+
self.axesValues += (self.hdf['Radiation Pattern'][item][:],)
|
|
38
|
+
|
|
39
|
+
if self.axes[0] == "Pol" and self.axes[1] == "x" and self.axes[2] == "y" and self.axes[3] == "Frequency":
|
|
40
|
+
self.type = MeasurementType.PLANAR_YSCAN
|
|
41
|
+
elif self.axes[0] == "Pol" and self.axes[1] == "y" and self.axes[2] == "x" and self.axes[3] == "Frequency":
|
|
42
|
+
self.type = MeasurementType.PLANAR_XSCAN
|
|
43
|
+
else:
|
|
44
|
+
self.type = MeasurementType.CUSTOM
|
|
45
|
+
|
|
46
|
+
self.data = self.hdf['Radiation Pattern']['Radiation Pattern'][:].tolist()
|
|
47
|
+
|
|
48
|
+
self.axesPositionsInitial = self.hdf['Radiation Pattern']['ATTRIBUTES']['Status after Init'].attrs['Positions']
|
|
49
|
+
self.axesPositionsEnd = self.hdf['Radiation Pattern']['ATTRIBUTES']['Status after Measurement'].attrs['Positions']
|
|
50
|
+
|
|
51
|
+
else:
|
|
52
|
+
raise ValueError("Filename must be valid .adf type")
|
|
53
|
+
else:
|
|
54
|
+
raise FileNotFoundError
|
|
55
|
+
|
|
56
|
+
def exportForNSI(self, path, **kwargs):
|
|
57
|
+
r""" Exports measurement data for NSI2000 import
|
|
58
|
+
|
|
59
|
+
Parameters
|
|
60
|
+
----------
|
|
61
|
+
path : str
|
|
62
|
+
folder which data will be stored
|
|
63
|
+
**kwargs: dict
|
|
64
|
+
prm file specific properties. Valid keyword arguments are:
|
|
65
|
+
|
|
66
|
+
probeDist: float: distance between probe aperture to rotation center [m] (antenna aperture instead of rotation for PNF)
|
|
67
|
+
mre : float: maximum radial extent of positioned antenna [m] (only for SNF and CNF)
|
|
68
|
+
autWidth : float: AUT width [m]
|
|
69
|
+
autHeight: float: AUT height [m]
|
|
70
|
+
|
|
71
|
+
Abbreviations
|
|
72
|
+
-------------
|
|
73
|
+
PNF: planar nearfield
|
|
74
|
+
CNF: cylindrical nearfield
|
|
75
|
+
SNF: spherical nearfield
|
|
76
|
+
AUT: antenna under test
|
|
77
|
+
"""
|
|
78
|
+
if not os.path.exists(path):
|
|
79
|
+
raise FileNotFoundError("Output folder does not exists.")
|
|
80
|
+
|
|
81
|
+
if not self.type in MeasurementType.PLANAR:
|
|
82
|
+
raise ValueError('Export to NSI for this type of measurement is nor supported.')
|
|
83
|
+
|
|
84
|
+
probeDist = 1.0 if "probeDist" not in kwargs.keys() else kwargs["probeDist"]
|
|
85
|
+
mre = 1.0 if "mre" not in kwargs.keys() else kwargs["mre"]
|
|
86
|
+
autWidth = 1.0 if "autWidth" not in kwargs.keys() else kwargs["autWidth"]
|
|
87
|
+
autHeight = 1.0 if "autHeight" not in kwargs.keys() else kwargs["autHeight"]
|
|
88
|
+
|
|
89
|
+
if type(probeDist) != float:
|
|
90
|
+
raise TypeError("%s must be float"%probeDist)
|
|
91
|
+
if type(mre) != float:
|
|
92
|
+
raise TypeError("%s must be float"%mre)
|
|
93
|
+
if type(autWidth) != float:
|
|
94
|
+
raise TypeError("%s must be float"%autWidth)
|
|
95
|
+
if type(autHeight) != float:
|
|
96
|
+
raise TypeError("%s must be float"%autHeight)
|
|
97
|
+
|
|
98
|
+
with open(os.path.join(path, "NFScan.prm"), '+w', encoding='utf-8') as file:
|
|
99
|
+
file.write("PNF\n")
|
|
100
|
+
file.write("%.3f, %.3f, %.3f, %.3f\n"%(probeDist, mre, autWidth, autHeight))
|
|
101
|
+
if self.type == MeasurementType.PLANAR_XSCAN:
|
|
102
|
+
file.write("%+.3f, %+.3f, %.3f\n"%(self.axesValues[2][0], self.axesValues[2][-1], (self.axesValues[2][1]-self.axesValues[2][0])))
|
|
103
|
+
file.write("%+.3f, %+.3f, %.3f\n"%(self.axesValues[1][0], self.axesValues[1][-1], (self.axesValues[1][1]-self.axesValues[1][0])))
|
|
104
|
+
else: # default MeasurementType.PLANAR_YSCAN
|
|
105
|
+
file.write("%+.3f, %+.3f, %.3f\n"%(self.axesValues[1][0], self.axesValues[1][-1], (self.axesValues[1][1]-self.axesValues[1][0])))
|
|
106
|
+
file.write("%+.3f, %+.3f, %.3f\n"%(self.axesValues[2][0], self.axesValues[2][-1], (self.axesValues[2][1]-self.axesValues[2][0])))
|
|
107
|
+
for i in range(len(self.axesValues[3])-1):
|
|
108
|
+
file.write("%.6f, "%(self.axesValues[3][i]/1E9))
|
|
109
|
+
file.write("%.6f\n"%(self.axesValues[3][-1]/1E9))
|
|
110
|
+
for i in range(len(self.axesValues[3])-1):
|
|
111
|
+
file.write("NF_%.0f.txt\n"%(self.axesValues[3][i]/1E3))
|
|
112
|
+
file.write("NF_%.0f.txt"%(self.axesValues[3][-1]/1E3))
|
|
113
|
+
|
|
114
|
+
for i in range(len(self.axesValues[3])):
|
|
115
|
+
with open(os.path.join(path, "NF_%.0f.txt"%(self.axesValues[3][i]/1E3)), '+w', encoding='utf-8') as file:
|
|
116
|
+
file.write("# pol\t\tstep\t\tscan\t\treal\t\timag\n"%(self.axesValues[3][i]/1E3))
|
|
117
|
+
for k in range(len(self.axesValues[0])):
|
|
118
|
+
if self.type == MeasurementType.PLANAR_XSCAN:
|
|
119
|
+
for m in range(len(self.axesValues[2])):
|
|
120
|
+
for l in range(len(self.axesValues[1])):
|
|
121
|
+
file.write("%.3f\t\t%+.3f\t\t%+.3f\t\t%+.16f\t\t%+.16f\n"%(self.axesValues[0][k], self.axesValues[2][m], self.axesValues[1][l], self.data[k][l][m][i][0], self.data[k][l][m][i][1]))
|
|
122
|
+
else: # default MeasurementType.PLANAR_YSCAN
|
|
123
|
+
for l in range(len(self.axesValues[1])):
|
|
124
|
+
for m in range(len(self.axesValues[2])):
|
|
125
|
+
file.write("%.3f\t\t%+.3f\t\t%+.3f\t\t%+.16f\t\t%+.16f\n"%(self.axesValues[0][k], self.axesValues[1][l], self.axesValues[2][m], self.data[k][l][m][i][0], self.data[k][l][m][i][1]))
|
|
126
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .Measurement import Measurement, MeasurementType
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: ams-adf-reader
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Antenna Measurement Software (AMS) File Format (ADF) Reader
|
|
5
|
+
Home-page: https://github.com/yigithsyn/ams-adf-reader
|
|
6
|
+
Author: Hüseyin YİĞİT
|
|
7
|
+
Author-email: yigit.hsyn@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Platform: Any
|
|
10
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Intended Audience :: Other Audience
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
|
+
Requires-Python: >= 3.4
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: h5py
|
|
24
|
+
|
|
25
|
+
# ams-adf-reader
|
|
26
|
+
|
|
27
|
+
Antenna Measurement Software (AMS) File Format (ADF) Reader
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
VERSION
|
|
5
|
+
pyproject.toml
|
|
6
|
+
setup.py
|
|
7
|
+
src/ams-adf-reader/Measurement.py
|
|
8
|
+
src/ams-adf-reader/__init__.py
|
|
9
|
+
src/ams_adf_reader.egg-info/PKG-INFO
|
|
10
|
+
src/ams_adf_reader.egg-info/SOURCES.txt
|
|
11
|
+
src/ams_adf_reader.egg-info/dependency_links.txt
|
|
12
|
+
src/ams_adf_reader.egg-info/requires.txt
|
|
13
|
+
src/ams_adf_reader.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
h5py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ams-adf-reader
|