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 installation and examples) is available on the PyResiFlex Website.

Getting Started

Install

Assuming you have Python installed, 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 the 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 can also run just to run all the above commands in one go.

Manually building the package

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

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

Who do I talk to?

  • Pierre-Antoine Goutier, Spark Cleantech & EM2C Lab, 2024–present

References

A list of references used is available in 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.1.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.1-py3-none-any.whl (5.6 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyresiflex-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3c54687469fbde067b44b7cd777f8c96edec5e2c252c12c7d75fb8c1ede0dbb4
MD5 844063a248a87d3539d7f57d9c3db7d5
BLAKE2b-256 147d2ffd057a96c54de62d796c054844bef04ab883411be76a353305d9939daf

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: pyresiflex-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 613ed349d668d1dc462a72ca1c21bef129ce3831fa41923c8b18529b73d6e499
MD5 7fa5de574307e095c73b08fde020ef2d
BLAKE2b-256 f3d73329a77e35996fb9ddf3806682d0a32ec97d3e9dc5083202f03b52db8208

See more details on using hashes here.

Provenance

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