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 pyresiflex

Quick Start

Compute the voltage at the load, for a 5-m cable and a time-varying resistance:

# 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 5 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()

Image showing the 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.0.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.0-py3-none-any.whl (5.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyresiflex-0.2.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a0e60c096100d4abcb0219b61fd8ea81f121220b15905698cb9cd1bbd4d5807b
MD5 af5009f1769ed6de2a3371d70bee66d2
BLAKE2b-256 0dfa9776244399bf026334e06d99cb04dfad23b816220482b6cc4f829086ab9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyresiflex-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: pyresiflex-0.2.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f56ab16a5ad34fca4c92d6376d96d099812695b9a036b54a6739e05fe7d7816
MD5 5700492967488e9d3909d542f9b7ee7e
BLAKE2b-256 528680063cbfa916a8ddbc29198db248d426444f1f606769275a35b4bedb3470

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyresiflex-0.2.0-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