Skip to main content

inscar

INcoherent SCAtter Radar spectrum

PyPI PyPI Downloads Status Python Version License Read the documentation at https://ncdump-rich.readthedocs.io/ Tests Codecov pre-commit pre-commit Black

./img/normal_is_spectra.png

Info

Calculates an incoherent scatter radar spectrum based on the theory presented in Hagfors (1961) and Mace (2003).

Installing

You can install inscar via pip from PyPI:

$ pip install inscar

Usage

Please see the Modules Reference for details.

Physical environment

The plasma parameters that are supported natively by the program are

  • Radar frequency [Hz]

    • This will also set the radar wave number (= -4pi(radar frequency)/(speed of light))

  • Magnetic field strength [T]

  • Aspect angle [1]

  • Electron temperature [K]

  • Ion temperature [K]

  • Electron collision frequency [Hz]

  • Ion collision frequency [Hz]

  • Electron mass in atomic mass units [u]

  • Ion mass in atomic mass units [u]

  • Electron number density [m^(-3)]

  • Ion number density [m^(-3)]

  • Kappa value for the kappa velocity distribution function [1]

Custom simulation set-ups can be made by inheriting from the different classes. Say you want a Particle class that also carries information about the temperature of a collection of super thermal electrons as well as some height information. You then inherit from Particle and decorate it with the @attr.s object:

@attr.s
class RealDataParticle(isr.Particle):
    """Create a particle object with extra attributes."""

    superthermal_temperature: float = attr.ib(
        default=90000,
        validator=is_positive,
        on_setattr=attr.setters.validate,
    )
    z: int = attr.ib(default=300)

For more examples, see the assets directory.

Calculation method

The program support different methods of calculating the spectrum, based on how you assume the particles to be distributed. This includes a Maxwellian distribution (IntMaxwell class) and a kappa distribution (IntKappa class), in addition to any arbitrary isotropic distribution (IntLong class) which can take any Vdf as particle velocity distribution (default is VdfMaxwell). An example showing how a new Vdf class can be made is given in assets (VdfRealData).

Gordeyev integration accuracy

The numerical controls belong to each Particle, so electrons and ions can use different settings:

electron = isr.Particle(
    gordeyev_size=800001,
    gordeyev_upper_lim=1.5e-4,
    gordeyev_exp=3,
    gordeyev_method="simpson",
)

gordeyev_size is the number of time samples, gordeyev_upper_lim is the time cutoff in seconds, and gordeyev_exp sets the power-law sampling grid. gordeyev_method selects "trapezoid" (the existing default) or "simpson" (quadratic integration on the nonuniform grid). Simpson requires an odd number of at least three samples. These are quadrature controls; Parameters.frequency_size controls output-frequency sampling instead.

The values above illustrate configuration, not a universal accuracy guarantee. Increase the sample count at fixed cutoff, then check a longer cutoff independently. Resolve the oscillations for the largest requested frequency, and do these checks for both species. A narrow plasma resonance can amplify small errors in the dielectric response. Chapter 4 of the thesis linked below discusses nonuniform sampling, Simpson integration, and resolution tests.

The Debye length uses scipy.constants.epsilon_0 consistently with the other SI constants. Earlier versions used 1e-9/(36*pi), an approximation about 0.138% below this value; increasing quadrature resolution cannot remove that difference, which can be amplified near a plasma resonance.

Aside

This program was developed during my master thesis. For a more detailed explanation of the mathematical derivations and an analysis of the numerical precision of the program, please refer to the thesis found at munin.uit.no.

Contributing

To contribute to the project, clone and install the full development version (uses uv for dependencies). Optionally, you may also install the pre-commit hooks to automatically format the code and run the tests before committing.

$ git clone https://github.com/engeir/inscar.git
$ cd inscar
$ uv sync
$ pre-commit install

Before committing new changes to a branch you may run command

$ nox

to run the full test suite. You will need UV and nox installed for this.

Metadata

Release files for inscar 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inscar 3.4.0
File Size Uploaded Provenance Actions
inscar-3.4.0.tar.gz 14.4 kB Without provenance Details for inscar-3.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for inscar 3.4.0
File Interpreter ABI Platform Actions
inscar-3.4.0-py3-none-any.whl Python 3 none any Details for inscar-3.4.0-py3-none-any.whl

Total release size: 30.1 kB

Release files / inscar-3.4.0.tar.gz

Download URL inscar-3.4.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0bb85cdcbfc3a213ee54f5b1e0e2a8f174d4b78f887e65f04d6a54a97f9498c2
BLAKE2b-256 checksum
How to use checksums
7ffa455aba24985541a0f80f71a0eccf387cc16ba7ab2b718fb3e7f9d6d60988
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / inscar-3.4.0-py3-none-any.whl

Download URL inscar-3.4.0-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89f47e2521c369a868a9a9c366d3339e1f3f6f83472a9e3cea1354a83496ba8b
BLAKE2b-256 checksum
How to use checksums
8c2a1ffcfa66e895c2f742baeb7cc195038950a444c1016851b6c91b6574c08c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for inscar 3.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page