CITIfile
Read CITI format file by python.
Introduction
CITIfile is a tiny library that allows you to read
CITI format file by using Python.
Installation
pip install -U CITIfile
Tutorial
CITIfile is easy to use:
from CITIfile import read_citifile
data = read_citifile("data.citi")
Then, it will parse the data file and
return a xarray.Dataset object. Like the following:
<xarray.Dataset>
Dimensions: (C_d2: 3, L_load: 6, freq: 6)
Coordinates:
* L_load (L_load) float64 20.0 21.0 22.0 23.0 24.0 25.0
* C_d2 (C_d2) float64 1.0 1.5 2.0
* freq (freq) float64 3e+07 3.1e+07 3.2e+07 3.3e+07 3.4e+07 3.5e+07
Data variables:
S[1,1] (L_load, C_d2, freq) complex128 (0.0517763713-0.00941470346j) ... (0.0593002475-0.0233189028j)
S[1,2] (L_load, C_d2, freq) complex128 (0.771829001+0.00291050315j) ... (0.774683786+0.0184790199j)
S[2,1] (L_load, C_d2, freq) complex128 (0.771829001+0.00291050315j) ... (0.774683786+0.0184790199j)
S[2,2] (L_load, C_d2, freq) complex128 (0.0517763713-0.00941470346j) ... (0.0593002475-0.0233189028j)
CITIfile parses and converts CITI format to xarray.Dataset object,
because CITI format file stores data in multidimensional array format
and xarray are designed to handle this kind of data.
See xarray documents to
learn that how to manipulate xarray.Dataset object.
Displaying Coordinates and Data Vairables
print('Coordinates:')
for cname in data.coords:
cdata = data.coords[cname].data
print(f'- {cname}: {len(cname)} ({cdata}, {cdata.dtype})')
print('Data:')
for vname in data.data_vars:
vdata = data.data_vars[vname]
print(f'- {vname}: {vdata.dtype}')
This displays the names and types of the corrdinates and data variables, as well as the available corrdinate values (which are numpy.ndarray).
Extracting Usable 2D Data
In this example, we extract S[1,1] vs. freq, at some given coordinates for C_load and C_d2:
# select the data variable at the given corrdinates
data_slice = data.data_vars["S[1,1]"].sel(L_load=20, C_d2=1)
# now there is only one coordinate (freq) left as independent variable
x = data_slice.coords["freq"].data
# dependent variable (Y-axis)
y = data_slice.data
for px, py in zip(x, y):
print(f"freq={px} -> S[1,1]={py}")
Both x and y are numpy.ndarray.
Websites
Main website: https://github.com/TitorX/CITIfile
CITIfile Definitions: http://literature.cdn.keysight.com/litweb/pdf/ads15/cktsim/ck2016.html
xarray document: http://xarray.pydata.org/en/stable/
Reports
Report bugs or ask questions at https://github.com/TitorX/CITIfile/issues.
Contact
Written by Shoukun Sun.
Email: titor.sun@gmail.com
Release files for CITIfile 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| citifile-0.1.6.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| CITIfile-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / citifile-0.1.6.tar.gz
| Download URL | citifile-0.1.6.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e374a86a24dd4eaf81ee7707ee0c3bab08f910e45a896a4208d773776a0ec5c1
|
|
BLAKE2b-256 checksum How to use checksums |
75b7b369723e805e12b0ed921ada0d94589d13281f6e3052c279a6ceae788bde
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / CITIfile-0.1.6-py3-none-any.whl
| Download URL | CITIfile-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d06afee5fe05031182c13d06b5cdcf4635bb0f2eee4475a2a8f675c2d8fb11f1
|
|
BLAKE2b-256 checksum How to use checksums |
d3a03fe9f7cf501275cc8ee8cd7295c6c25c8b9629e6058314a3c406bd37f451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|