Electromagnetic S-matrix computation for periodic arrays of cylinders — NumPy/CuPy GPU-accelerated version
Project description
CyScat Python Translation
This is a Python translation of the MATLAB CyScat electromagnetic scattering code, maintaining numerical precision with the original implementation.
Setup
-
Create a virtual environment:
python3 -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
Running the Test
cd CyScat
python sample_test.py
This will:
- Generate random cylinder positions using Latin Hypercube sampling
- Compute the S-matrix (scattering matrix) for the structure
- Display the results and a visualization of the slab geometry
Key Files
sample_test.py- Main test script demonstrating the workflowinterface.py- Main interface for S-matrix computationScattering_Code/- Core electromagnetic scattering algorithmssmatrix.py- S-matrix generationtransall.py- Translation matrix calculationssmatrix_parameters.py- Spectral parameter setupvall.py- Plane wave to cylinder harmonics conversionky.py- Wave vector component calculations
Translation Notes
All numerical precision issues from MATLAB to Python have been resolved:
- Complex number handling for evanescent modes
- Spectral sum overflow protection
- Array indexing differences (0-based vs 1-based)
- Matrix multiplication semantics
- Scalar extraction from numpy arrays
The code now produces results matching MATLAB within numerical precision.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cyscat_gpu-0.1.0.tar.gz.
File metadata
- Download URL: cyscat_gpu-0.1.0.tar.gz
- Upload date:
- Size: 30.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d27c6df54c0894aaf8cc75705a732140c42532caedab7be9153b4857e8bcdd4
|
|
| MD5 |
6e7590df8985e9db3b792308273c3be2
|
|
| BLAKE2b-256 |
3930d842971d795e9334d7dc9277ef82d498e036e63e28777743fc8180700471
|
File details
Details for the file cyscat_gpu-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cyscat_gpu-0.1.0-py3-none-any.whl
- Upload date:
- Size: 41.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e00e0b695543be68f2eb30b8f8199a28267a6664b0e71046e96140b81aeb10b
|
|
| MD5 |
bde432c6c567cb8b00382b050d99c18e
|
|
| BLAKE2b-256 |
a2ea0297da5331dae8ad6b063e63a8785da6baab3fb4d42790c627f01b3bf606
|