CTS-spec
fusion-repo / CTS-spec
Package for calculating collective Thomson scattering (CTS) spectral density functions for plasma diagnostics
Overview
(No description provided)
Typical use cases
- Calculate CTS spectra of electron plasma waves and ion acoustic waves
- Diagnose plasmas by fitting experimental CTS spectra
README
CTS-spec
Collective Thomson scattering (CTS) spectral density function calculation package for plasma diagnostics.
Overview
This package provides tools for calculating and analyzing collective Thomson scattering spectra in plasmas, including both electron plasma waves (EPW) and ion acoustic waves (IAW). It is particularly useful for plasma diagnostics in high-energy density physics experiments.
Features
- Calculation of CTS spectra for multi-component plasmas
- Support for both EPW and IAW components
- FLYCHK integration for ionization state calculations
- Distribution function calculations
- Spectrum convolution with instrument function
- Fitting utilities for experimental data analysis
Project Structure
CTS-spec/
├── src/
│ └── cts_spec/
│ ├── __init__.py
│ ├── core.py # Core CTS calculation module
│ ├── distribution.py # Distribution function calculations
│ ├── fitting.py # Fitting utilities
│ ├── convolution.py # Spectrum convolution functions
│ └── flychk.py # FLYCHK functions
├── script/
│ ├── cts_plot_epw.py # EPW spectrum plotting script
│ └── cts_plot_iaw.py # IAW spectrum plotting script
├── test/ # Test suite
│ ├── test_spectrum.py # Spectrum comparison tests
│ ├── conftest.py # Pytest configuration
│ └── README.md # Test documentation
├── sample/
│ ├── epw/ # Sample EPW data
│ │ ├── EPW-test_axis.txt
│ │ └── EPW-test_2.9ns.txt
│ └── iaw/ # Sample IAW data
│ ├── IAW-test_axis.txt
│ └── IAW-test_2.9ns.txt
├── README.md
├── LICENSE
└── pyproject.toml # Project configuration
Directory Descriptions
src/cts_spec/: Core package source codecore.py: Main module containing CTS calculation functionsdistribution.py: Distribution function calculationsfitting.py: Fitting utilities for experimental dataconvolution.py: Spectrum convolution functions
script/: Example scripts for different analysis scenarioscts_plot_epw.py: Script for plotting EPW spectracts_plot_iaw.py: Script for plotting IAW spectra
test/: Test suite for spectrum calculationstest_spectrum.py: Tests for spectrum comparisonconftest.py: Pytest configurationREADME.md: Test documentation
sample/: Sample data files for testing and examplesepw/: Sample EPW data filesiaw/: Sample IAW data files
Prerequisites
- Required
- Python >= 3.11 (for tomllib support)
- NumPy >= 1.20 (for improved type hints and array operations)
- SciPy >= 1.7.0
- Matplotlib >= 3.4.0
- pytest (for testing)
Note: The code uses NumPy's type hints and array operations extensively. All numerical calculations are performed using floating-point numbers (64-bit precision).
Installation
From source
python3 -m pip install CTS_SPEC_ROOT_DIRECTORY
where CTS_SPEC_ROOT_DIRECTORY points to the directory including this README.md file.
Testing
The project includes a comprehensive test suite to ensure calculation consistency. See test/README.md for detailed testing information.
Quick Start
# Run all tests
pytest
# Run specific tests
pytest test/test_spectrum.py::TestSpectrumCalculations::test_epw_spectrum
Setting Up Reference Data
Before running tests, you need to set up the reference data:
# Create reference directories
mkdir -p sample/ref/epw sample/ref/iaw
# Copy current calculation results as reference data
cp sample/epw/EPW-calc_* sample/ref/epw/
cp sample/iaw/IAW-calc_* sample/ref/iaw/
Usage
Basic Example
import numpy as np
from cts_spec import cts_spec
# Define wavelength array
lmd_nm = np.linspace(526.0, 527.0, 1000) # nm
# Define plasma parameters
# Electron parameters: [temperature (eV), density (1e18 cm^-3), velocity (km/s)]
param_ele = np.array([[100, 1.0, 0.0]])
# Ion parameters: [temperature (eV), density (1e18 cm^-3), velocity (km/s),
# ionization state, ion mass]
param_ion = np.array([[1000, 1.0, 0.0, 10, 64]])
# Laser parameters: [wavelength (nm), scattering angle (deg), norm, offset]
par_laser = [526.5, 60, 1.0, 0.0]
# Calculate spectrum
spectrum = cts_spec(lmd_nm, param_ele, param_ion, par_laser)
Advanced Features
FLYCHK Integration
# Enable FLYCHK for ionization state calculation
spectrum = cts_spec(lmd_nm, param_ele, param_ion, par_laser, flychk=True)
Separate EPW and IAW Components
# Calculate only ion acoustic wave component
spectrum_iaw = cts_spec(lmd_nm, param_ele, param_ion, par_laser,
separate=True, iaw=True)
# Calculate only electron plasma wave component
spectrum_epw = cts_spec(lmd_nm, param_ele, param_ion, par_laser,
separate=True, iaw=False)
Distribution Functions
from cts_spec import dfe, dfi
# Calculate electron distribution function
v_ele = np.linspace(-1e8, 1e8, 1000) # cm/s
f_ele = dfe(v_ele, param_ele[0, 0], param_ele[0, 2], param_ele[0, 1])
# Calculate ion distribution function
v_ion = np.linspace(-1e7, 1e7, 1000) # cm/s
f_ion = dfi(v_ion, param_ion[0, 0], param_ion[0, 2], param_ion[0, 1], param_ion[0, 4])
Documentation
For detailed documentation of the API and usage examples, please refer to the docstrings in the source code.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the BSD 2-Clause License. See the LICENSE file for details.
Copyright
This code is written by Kentaro Sakai, modified by Yusuke Konishi, Tatsumi Aoyama, and Kazuyoshi Yoshimi.
Citation
If you use this software in your research, please cite:
@software{cts_spec,
author = {Kentaro Sakai, Yusuke Konishi, Tatsumi Aoyama, and Kazuyoshi Yoshimi},
title = {CTS-spec: Collective Thomson Scattering Spectral Density Function},
year = {2026},
url = {https://github.com/fusion-repo/CTS-spec}
}
Source: https://github.com/fusion-repo/CTS-spec README
Richness
Richness = how many of docs / examples / tests are in place, shown as 0–3 stars (1 star = 1 item; the checklist below is the breakdown). Software listed by hand (without repository data) is not assessed and is left out when filtering by a richness of 1 or more.
- Yes: README
- Yes: LICENSE
- No: docs
- Yes: examples
- Yes: tests
- Yes: CITATION
- No: release
Information
- Primary language
- Python
- Languages
- Python
- License
- BSD-2-Clause
- Provider
- github