Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ["3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- name: Check out repo
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ repos:
# FORMATTER #
###################
- repo: https://github.com/tox-dev/pyproject-fmt
rev: "2.1.4"
rev: "v2.20.0"
hooks:
- id: pyproject-fmt

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v6.0.0
hooks:
- id: check-ast
- id: check-builtin-literals
Expand All @@ -20,7 +20,7 @@ repos:
args: [--fix=lf]

- repo: https://github.com/PyCQA/docformatter
rev: 06907d0
rev: v1.7.7
hooks:
- id: docformatter
additional_dependencies: [tomli]
Expand All @@ -43,7 +43,7 @@ repos:
###################
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.1
rev: v0.15.7
hooks:
- id: ruff
name: "ruff sort imports"
Expand All @@ -58,7 +58,7 @@ repos:
name: "ruff lint"

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
rev: v1.19.1
hooks:
- id: mypy
exclude: "docs"
Expand All @@ -68,7 +68,7 @@ repos:
# LINTER DOCS #
###################
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
rev: 7.3.0
hooks:
- id: flake8
alias: flake8-docs
Expand All @@ -91,7 +91,7 @@ repos:
pass_filenames: false

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.2
hooks:
- id: codespell
types: [file]
Expand All @@ -100,6 +100,6 @@ repos:
exclude: ^examples/

- repo: https://github.com/rhysd/actionlint
rev: "v1.7.1"
rev: "v1.7.11"
hooks:
- id: actionlint
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,38 @@

A pyglotaran based jupyter notebook widget for teaching parameter estimation examples. It can simulate data, visualize it and create related model.yml, parameters.csv and dataset.nc files. It is supposed to help students learn about the basics of the pyglotaran ecosystem.

## Usage

### Option 1: Run directly from GitHub with uv

Install and run PyParamGUI directly from the repository without cloning:

```bash
uv run --with "pyparamgui @ git+https://github.com/glotaran/pyparamgui" --with jupyter jupyter lab
```
Comment thread
s-weigand marked this conversation as resolved.

### Option 2: Run from a local clone

Clone the repository and run with the local source:

```bash
uv run --with . --with jupyter jupyter lab
```

### Option 3: Add to an existing uv project

Add PyParamGUI as a dependency to your project:

```bash
uv add "pyparamgui @ git+https://github.com/glotaran/pyparamgui"
```

Then run Jupyter Lab in your project environment:

```bash
uv run jupyter lab
```

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand All @@ -26,7 +58,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anmolbhatia05"><img src="https://avatars.githubusercontent.com/u/34206963?v=4?s=100" width="100px;" alt="Anmol Bhatia"/><br /><sub><b>Anmol Bhatia</b></sub></a><br /><a href="https://github.com/glotaran/PyParamGUI/commits?author=anmolbhatia05" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/anmolbhatia05"><img src="https://avatars.githubusercontent.com/u/34206963?v=4?s=100" width="100px;" alt="Anmol Bhatia"/><br /><sub><b>Anmol Bhatia</b></sub></a><br /><a href="https://github.com/glotaran/pyparamgui/commits?author=anmolbhatia05" title="Code">💻</a></td>
</tr>
</tbody>
</table>
Expand Down
1 change: 0 additions & 1 deletion pyparamgui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
__all__ = ["Widget"]
"""
Package Usage:
%env ANYWIDGET_HMR=1
from pyparamgui import Widget

widget = Widget()
Expand Down
18 changes: 9 additions & 9 deletions pyparamgui/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def _generate_decay_model(
dict[str, Any]
The generated model dictionary.
"""
compartments = [f"species_{i+1}" for i in range(nr_compartments)]
rates = [f"rates.species_{i+1}" for i in range(nr_compartments)]
compartments = [f"species_{i + 1}" for i in range(nr_compartments)]
rates = [f"rates.species_{i + 1}" for i in range(nr_compartments)]

model: dict[str, Any] = {
"megacomplex": {
Expand All @@ -56,18 +56,18 @@ def _generate_decay_model(
"megacomplex_spectral": {
"type": "spectral",
"shape": {
compartment: f"shape_species_{i+1}"
compartment: f"shape_species_{i + 1}"
for i, compartment in enumerate(compartments)
},
}
}
model["shape"] = {
f"shape_species_{i+1}": {
f"shape_species_{i + 1}": {
"type": "skewed-gaussian",
"amplitude": f"shapes.species_{i+1}.amplitude",
"location": f"shapes.species_{i+1}.location",
"width": f"shapes.species_{i+1}.width",
"skewness": f"shapes.species_{i+1}.skewness",
"amplitude": f"shapes.species_{i + 1}.amplitude",
"location": f"shapes.species_{i + 1}.location",
"width": f"shapes.species_{i + 1}.width",
"skewness": f"shapes.species_{i + 1}.skewness",
}
for i in range(nr_compartments)
}
Expand Down Expand Up @@ -275,4 +275,4 @@ def generate_model_yml(*, generator_name: str, generator_arguments: GeneratorArg
)
raise ValueError(msg)
model = generators[generator_name](**generator_arguments)
return cast(str, write_dict(model))
return cast("str", write_dict(model))
68 changes: 43 additions & 25 deletions pyparamgui/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class KineticParameters(BaseModel):

Attributes
----------
decay_rates (list[float]): List of decay rates.
decay_rates : list[float]
List of decay rates.
"""

decay_rates: list[float]
Expand All @@ -26,10 +27,14 @@ class SpectralParameters(BaseModel):

Attributes
----------
amplitude (list[float]): List of amplitudes.
location (list[float]): List of locations.
width (list[float]): List of widths.
skewness (list[float]): List of skewness values.
amplitude : list[float]
List of amplitudes.
location : list[float]
List of locations.
width : list[float]
List of widths.
skewness : list[float]
List of skewness values.
"""

amplitude: list[float]
Expand All @@ -43,8 +48,10 @@ class TimeCoordinates(BaseModel):

Attributes
----------
timepoints_max (int): Maximum number of time points.
timepoints_stepsize (float): Step size between time points.
timepoints_max : int
Maximum number of time points.
timepoints_stepsize : float
Step size between time points.
"""

timepoints_max: int
Expand All @@ -56,9 +63,12 @@ class SpectralCoordinates(BaseModel):

Attributes
----------
wavelength_min (int): Minimum wavelength.
wavelength_max (int): Maximum wavelength.
wavelength_stepsize (float): Step size between wavelengths.
wavelength_min : int
Minimum wavelength.
wavelength_max : int
Maximum wavelength.
wavelength_stepsize : float
Step size between wavelengths.
"""

wavelength_min: int
Expand Down Expand Up @@ -100,12 +110,14 @@ class Settings(BaseModel):

Attributes
----------
stdev_noise (float): Standard deviation of the noise to be added to the simulation data.
seed (int): Seed for the random number generator to ensure reproducibility.
add_gaussian_irf (bool): Whether to add a Gaussian IRF to the simulation.
Default is False.
use_sequential_scheme (bool): Whether to use a sequential scheme in the simulation.
Default is False.
stdev_noise : float
Standard deviation of the noise to be added to the simulation data.
seed : int
Seed for the random number generator to ensure reproducibility.
add_gaussian_irf : bool
Whether to add a Gaussian IRF to the simulation. Default is False.
use_sequential_scheme : bool
Whether to use a sequential scheme in the simulation. Default is False.
"""

stdev_noise: float
Expand All @@ -119,8 +131,10 @@ class IRF(BaseModel):

Attributes
----------
center (float): The center position of the IRF.
width (float): The width of the IRF.
center : float
The center position of the IRF.
width : float
The width of the IRF.
"""

center: float
Expand All @@ -132,13 +146,17 @@ class SimulationConfig(BaseModel):

Attributes
----------
kinetic_parameters (KineticParameters): Kinetic parameters for the simulation.
spectral_parameters (SpectralParameters): Spectral parameters for the simulation.
coordinates (Dict[str, np.ndarray]): Dictionary containing the time and spectral axes as
numpy arrays.
settings (Settings): Other settings for the simulation, including noise standard deviation,
random seed, and flags for adding Gaussian IRF and using a sequential scheme.
irf (IRF): Instrument Response Function (IRF) settings, e.g. center position and width.
kinetic_parameters : KineticParameters
Kinetic parameters for the simulation.
spectral_parameters : SpectralParameters
Spectral parameters for the simulation.
coordinates : dict[str, np.ndarray]
Dictionary containing the time and spectral axes as numpy arrays.
settings : Settings
Other settings for the simulation, including noise standard deviation,
random seed, and flags for adding Gaussian IRF and using a sequential scheme.
irf : IRF
Instrument Response Function (IRF) settings, e.g. center position and width.
"""

kinetic_parameters: KineticParameters
Expand Down
Loading
Loading