From 9fc755fe43e2c494b2af3c49a8436042c7454791 Mon Sep 17 00:00:00 2001 From: "u.zanovello" Date: Wed, 9 Feb 2022 20:07:17 +0100 Subject: [PATCH] Repackaging --- pyproject.toml | 6 +++++ setup.cfg | 27 ++++++++++++++++++++ setup.py | 6 ----- {cosimpy => src/cosimpy}/EM_Field.py | 6 ++--- {cosimpy => src/cosimpy}/RF_Coil.py | 38 +++++++++++++++++++++++++++- {cosimpy => src/cosimpy}/S_Matrix.py | 0 {cosimpy => src/cosimpy}/__init__.py | 0 7 files changed, 73 insertions(+), 10 deletions(-) create mode 100644 pyproject.toml create mode 100644 setup.cfg delete mode 100644 setup.py rename {cosimpy => src/cosimpy}/EM_Field.py (99%) rename {cosimpy => src/cosimpy}/RF_Coil.py (93%) rename {cosimpy => src/cosimpy}/S_Matrix.py (100%) rename {cosimpy => src/cosimpy}/__init__.py (100%) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..374b58c --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + "setuptools>=42", + "wheel" +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..70d6065 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,27 @@ +[metadata] +name = cosimpy +version = 3.0.0.2 +author = Umberto Zanovello +author_email = umbertozanovello@hotmail.com +description = Python electromagnetic co-simulation library +long_description = file: README.md +long_description_content_type = text/markdown +url = https://umbertozanovello.github.io/CoSimPy/ +classifiers = + Programming Language :: Python :: 3 + License :: OSI Approved :: MIT License + Operating System :: OS Independent + +[options] +package_dir = + = src +packages = find: +python_requires = >=3.5 +install_requires = + numpy >=1.15.2 + matplotlib >=3.0.0 + h5py >=2.8.0 + scipy >=1.1.0 + +[options.packages.find] +where = src diff --git a/setup.py b/setup.py deleted file mode 100644 index f7ef600..0000000 --- a/setup.py +++ /dev/null @@ -1,6 +0,0 @@ -import setuptools - -with open(".//docs//Documentation.md", "r", encoding="utf-8") as fh: - long_description = fh.read() - -setuptools.setup(name="cosimpy", version="1.2.0", licence="MIT", url='https://github.com/umbertozanovello/CoSimPy', packages=setuptools.find_packages(), author="Umberto Zanovello", description="Python electromagnetic co-simulation library", long_description=long_description, long_description_content_type="text/markdown", classifiers=["Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent",], python_requires='>=3.5',) diff --git a/cosimpy/EM_Field.py b/src/cosimpy/EM_Field.py similarity index 99% rename from cosimpy/EM_Field.py rename to src/cosimpy/EM_Field.py index 075b34e..c13bf19 100644 --- a/cosimpy/EM_Field.py +++ b/src/cosimpy/EM_Field.py @@ -508,7 +508,7 @@ def importFields_cst(cls, directory, freqs, nPorts, nPoints=None, Pinc_ref=1, b_ print("Importing %s MHz fields\n"%f) for port in range(nPorts): - print("\tImporting port%d fields\n\n"%(port+1)) + print("\r\tImporting port%d fields"%(port+1), end='', flush=True) if col_ascii_order == 0: re_cols = (3,4,5) im_cols = (6,7,8) @@ -531,7 +531,7 @@ def importFields_cst(cls, directory, freqs, nPorts, nPoints=None, Pinc_ref=1, b_ print("Importing %s MHz fields\n"%f) for port in range(nPorts): - print("\tImporting port%d fields\n\n"%(port+1)) + print("\r\tImporting port%d fields"%(port+1), end='', flush=True) if imp_efield: filename = "/efield_%s_port%d.h5"%(f,port+1) @@ -593,7 +593,7 @@ def importFields_s4l(cls, directory, freqs, nPorts, Pinc_ref=1, b_multCoeff=1, p for port in range(nPorts): - print("\tImporting port%d fields\n\n"%(port+1)) + print("\rImporting port%d fields"%(port+1), end='', flush=True) if imp_efield: diff --git a/cosimpy/RF_Coil.py b/src/cosimpy/RF_Coil.py similarity index 93% rename from cosimpy/RF_Coil.py rename to src/cosimpy/RF_Coil.py index 21a4d38..5417484 100644 --- a/cosimpy/RF_Coil.py +++ b/src/cosimpy/RF_Coil.py @@ -242,7 +242,10 @@ def flattenCompArray(compArray): if filename.split(".")[-1] != "cspy": filename += ".cspy" - description = " ".join(description.split("\n")) + if description: + description = " ".join(description.split("\n")) + else: + description = "N/D" # Extraction of S_Matrix nested instances (Up to now only level 0 (final S matrix) and 1 (original S matrix) will be present) s_matrix = self.s_matrix @@ -254,6 +257,10 @@ def flattenCompArray(compArray): n_ports_list.append(s_matrix.nPorts) with open(filename, 'wb') as f: + + #Saving status + print("\nSaving: header...", end='', flush=True) + #File version and header lines f.write(struct.pack('