Skip to main content

PyResiFlex is a simple set of tools in Python to obtain load (plasma) Resistance from analysis of pulse reFlexions.

Project description

PyResiFlex

Build Status Coverage Status Open in GitHub Codespaces

PyResiFlex is a simple set of tools in Python to obtain load (plasma) Resistance from analysis of pulse reFlexions.

Full user documentation (advanced install and examples) are available on the PyResiFlex Website.

Getting Started

Install

Assuming you have Python installed with the Anaconda distribution you can use pip:

pip install radis

Quick Start

Calculate a CO equilibrium spectrum from the HITRAN database:

# Import necessary libraries.
import matplotlib.pyplot as plt
import numpy as np

from pyresiflex.cable.cable import PerfectCable
from pyresiflex.generator.generator_real_impedance import ConstantGenerator
from pyresiflex.load.time_varying_resistance import PlasmaResistanceLinearFall
from pyresiflex.solver.purely_resistive_solution import PurelyResistiveSolution

# Create a purely resistive solution with a time-varying load resistance.
solution = PurelyResistiveSolution(
    cable=PerfectCable(L=5, Z_c=75, c=2e8),
    generator=ConstantGenerator(R_g=1, U_g=5e3),
    load=PlasmaResistanceLinearFall(
        Z_start=1e2, Z_end=10, t_start_fall=20e-9, t_end_fall=30e-9
    ),
)

# Solve the system at specific time points.
times = np.linspace(0, 40e-9, 1000)
# Here, the solution is computed at 6 meters.
solution.solve(x=5, t=times)

# Plot the voltage response over time.
fig, ax = plt.subplots()
ax.plot(times * 1e9, solution.voltage * 1e-3, color="k")
ax.set_xlabel(r"$\mathregular{t \, [ns]}$")
ax.set_ylabel(r"$\mathregular{V \, [kV]}$")
ax.set_title("Load voltage against time")
plt.show()

Result of the Python script

Example

GIF showing the reproduction of the Minesi2022 experiment

Example of the reproduction of the Minesi2022 experiment using PyResiFlex.

Workflow for developers/contributors

GitHub Codespaces has been set up, so you can click on this button to quickly code and run the examples: Open in GitHub Codespaces

You can also follow the instructions below, to set up the project on your machine:

  • First, clone the repository with git clone https://github.com/pag1pag/pyresiflex.git.
  • Since this package uses uv, install it by following instructions on their website.
  • Update this Python package manager with uv self update.
  • Run uv sync to create a virtual environment at .venv, with the latest version of Python and all the necessary dependencies.
  • To test if the package is working, run uv run pytest. All tests should pass.

Next, you just need to activate the virtual environment with:

  • (macOS and Linux) source .venv/bin/activate
  • (Windows) .venv\Scripts\activate

Do not forget to activate it each time you are using this project.

Before pushing to GitHub, run the following commands in a terminal (with the virtual environment activated):

  1. Update dependencies with just update-env.
  2. Run quality assurance checks (code linting) with just qa.
  3. Run type checks with just type-check.
  4. Run unit tests with just tests.
  5. Run unit tests with coverage and generate a badge with just tests-cov.
  6. Build the documentation with just build-docs.

You could also run just to run all the above commands in one go.

Manually building the package

If you want to install pyresiflex to another environment, you can build the package and install it with pip:

  • (pyresiflex) uv build will build a wheel /whl in the folder ./dist.
  • Activating another env, called other_env.
  • (other_env) pip install path/to/file.whl should install pyresiflex in other_env.

Who do I talk to?

References

A list of references used is available at the reference section.

Note

According to Oxford Learner's Dictionaries, reflexion is an old spelling of reflection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyresiflex-0.2.0a0.tar.gz (5.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyresiflex-0.2.0a0-py3-none-any.whl (5.6 MB view details)

Uploaded Python 3

File details

Details for the file pyresiflex-0.2.0a0.tar.gz.

File metadata

  • Download URL: pyresiflex-0.2.0a0.tar.gz
  • Upload date:
  • Size: 5.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyresiflex-0.2.0a0.tar.gz
Algorithm Hash digest
SHA256 b45aa9d9b545e8ef9948f97b14fcaa6d12da14a875148041a3d10e5ff1ec6b8a
MD5 839ea927ea51820602f7e8a1d75532a9
BLAKE2b-256 ca05005425cdad9f6a017d567f707978ed7838ef3b169d0f2ed57d3c92b22423

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyresiflex-0.2.0a0.tar.gz:

Publisher: publish.yml on pag1pag/pyresiflex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyresiflex-0.2.0a0-py3-none-any.whl.

File metadata

  • Download URL: pyresiflex-0.2.0a0-py3-none-any.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyresiflex-0.2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 a00fdc26d8e0c1e3e95c60dd907a5dab3116f9802a3c3a15a592c7b0e469cb9a
MD5 7f98158fc9b6ed9ab30a2e6d9b8e93eb
BLAKE2b-256 739c2e6d6f8dc33b963e9c5236d9cfeca2cc0499613d418818c3dc74496c2c71

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyresiflex-0.2.0a0-py3-none-any.whl:

Publisher: publish.yml on pag1pag/pyresiflex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page