Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
9f55a93
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Dec 29, 2024
7146413
🧹 Fix pytest issues (PT001)
s-weigand Dec 29, 2024
3184d61
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jan 6, 2025
95c6ce3
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jan 13, 2025
484d691
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jan 20, 2025
7a814af
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jan 27, 2025
ab419f1
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Feb 3, 2025
bea4257
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Feb 10, 2025
2ba0f15
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Feb 17, 2025
1b1a010
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Feb 24, 2025
a617d43
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Mar 3, 2025
c0845f0
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Mar 10, 2025
ee01315
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Mar 17, 2025
f0695c1
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Mar 24, 2025
6c852f5
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Mar 31, 2025
f411b8a
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Apr 7, 2025
7e42355
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Apr 14, 2025
9f01804
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Apr 21, 2025
d341924
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Apr 28, 2025
c0888eb
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand May 5, 2025
794dd19
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand May 12, 2025
355c2aa
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand May 19, 2025
08b036b
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jun 2, 2025
1dd0643
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jun 9, 2025
c12c339
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jun 23, 2025
a8d6b5b
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jun 30, 2025
7f237a7
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jul 7, 2025
e1aa745
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jul 14, 2025
9572d58
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jul 21, 2025
e9ad97f
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Jul 28, 2025
547d183
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Aug 4, 2025
1d6fcf7
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Aug 11, 2025
ab09897
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Aug 18, 2025
3d55cf0
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Aug 25, 2025
44296a4
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Sep 1, 2025
7769db6
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Sep 8, 2025
21395cd
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Sep 15, 2025
0d03077
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Sep 22, 2025
836b90b
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Sep 29, 2025
726825a
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Oct 6, 2025
9c8f8cf
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Oct 13, 2025
5640db1
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Oct 20, 2025
d9656b8
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Oct 27, 2025
d9b1357
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Nov 3, 2025
f18f451
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Nov 10, 2025
2d49c06
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Nov 17, 2025
38249aa
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Nov 24, 2025
70887c4
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Dec 1, 2025
e608da2
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Dec 8, 2025
e5f9d50
⬆️ UPGRADE: Autoupdate pre-commit config
s-weigand Dec 15, 2025
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
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.11.1"
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.14.9
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.0
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.1
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.9"
hooks:
- id: actionlint
16 changes: 8 additions & 8 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
61 changes: 22 additions & 39 deletions pyparamgui/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
class KineticParameters(BaseModel):
"""Kinetic parameters for the simulation.

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

decay_rates: list[float]
Expand All @@ -24,12 +22,9 @@ class KineticParameters(BaseModel):
class SpectralParameters(BaseModel):
"""Spectral parameters for the simulation.

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.
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]
Expand All @@ -41,10 +36,8 @@ class SpectralParameters(BaseModel):
class TimeCoordinates(BaseModel):
"""Time coordinates for the simulation.

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

timepoints_max: int
Expand All @@ -54,11 +47,8 @@ class TimeCoordinates(BaseModel):
class SpectralCoordinates(BaseModel):
"""Spectral coordinates for the simulation.

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

wavelength_min: int
Expand Down Expand Up @@ -98,14 +88,11 @@ def generate_simulation_coordinates(
class Settings(BaseModel):
"""Other settings for the simulation.

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.
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
Expand All @@ -117,10 +104,8 @@ class Settings(BaseModel):
class IRF(BaseModel):
"""Instrument Response Function (IRF) settings for the simulation.

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

center: float
Expand All @@ -130,15 +115,13 @@ class IRF(BaseModel):
class SimulationConfig(BaseModel):
"""Configuration for the simulation, combining various parameters and settings.

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.
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
Expand Down
43 changes: 18 additions & 25 deletions pyparamgui/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,31 +23,24 @@
class Widget(anywidget.AnyWidget):
"""A widget class for handling simulation parameters, coordinates and settings.

Attributes
----------
_esm (pathlib.Path): Path to the JavaScript file for the widget.
_css (pathlib.Path): Path to the CSS file for the widget.
decay_rates_input (traitlets.List): List of decay rates as floats.
amplitude_input (traitlets.List): List of amplitudes as floats.
location_input (traitlets.List): List of locations as floats.
width_input (traitlets.List): List of widths as floats.
skewness_input (traitlets.List): List of skewness values as floats.
timepoints_max_input (traitlets.Int): Maximum number of timepoints.
timepoints_stepsize_input (traitlets.Float): Step size for timepoints.
wavelength_min_input (traitlets.Float): Minimum wavelength value.
wavelength_max_input (traitlets.Float): Maximum wavelength value.
wavelength_stepsize_input (traitlets.Float): Step size for wavelength.
stdev_noise_input (traitlets.Float): Standard deviation of noise.
seed_input (traitlets.Int): Seed for random number generation.
add_gaussian_irf_input (traitlets.Bool): Flag to add Gaussian IRF.
irf_location_input (traitlets.Float): Location of the IRF center.
irf_width_input (traitlets.Float): Width of the IRF.
use_sequential_scheme_input (traitlets.Bool): Flag to use sequential scheme.
model_file_name_input (traitlets.Unicode): Name of the model file.
parameter_file_name_input (traitlets.Unicode): Name of the parameter file.
data_file_name_input (traitlets.Unicode): Name of the data file.
simulate (traitlets.Unicode): Trigger for simulation.
visualize_data (traitlets.Bool): Flag to visualize data.
Attributes ---------- _esm (pathlib.Path): Path to the JavaScript file for the widget. _css
(pathlib.Path): Path to the CSS file for the widget. decay_rates_input (traitlets.List):
List of decay rates as floats. amplitude_input (traitlets.List): List of amplitudes as
floats. location_input (traitlets.List): List of locations as floats. width_input
(traitlets.List): List of widths as floats. skewness_input (traitlets.List): List of
skewness values as floats. timepoints_max_input (traitlets.Int): Maximum number of
timepoints. timepoints_stepsize_input (traitlets.Float): Step size for timepoints.
wavelength_min_input (traitlets.Float): Minimum wavelength value. wavelength_max_input
(traitlets.Float): Maximum wavelength value. wavelength_stepsize_input (traitlets.Float):
Step size for wavelength. stdev_noise_input (traitlets.Float): Standard deviation of noise.
seed_input (traitlets.Int): Seed for random number generation. add_gaussian_irf_input
(traitlets.Bool): Flag to add Gaussian IRF. irf_location_input (traitlets.Float): Location
of the IRF center. irf_width_input (traitlets.Float): Width of the IRF.
use_sequential_scheme_input (traitlets.Bool): Flag to use sequential scheme.
model_file_name_input (traitlets.Unicode): Name of the model file. parameter_file_name_input
(traitlets.Unicode): Name of the parameter file. data_file_name_input (traitlets.Unicode): Name
of the data file. simulate (traitlets.Unicode): Trigger for simulation. visualize_data
(traitlets.Bool): Flag to visualize data.
"""

_esm: pathlib.Path = pathlib.Path(__file__).parent / "static" / "form.js"
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
dynamic = [
"version",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_simulate.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def _create_mock_widget():
return widget


@pytest.fixture()
@pytest.fixture
def mock_widget():
"""Return a mock Widget for testing."""
return _create_mock_widget()


@pytest.fixture()
@pytest.fixture
def temp_dir():
"""Create a temporary directory for testing."""
with tempfile.TemporaryDirectory() as tmpdirname:
Expand Down