sp-fitting-models 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sp_fitting_models-1.3.3/.github/workflows/python-publish.yml +56 -0
- sp_fitting_models-1.3.3/.gitignore +14 -0
- sp_fitting_models-1.3.3/.python-version +1 -0
- sp_fitting_models-1.3.3/.vscode/settings.json +6 -0
- sp_fitting_models-1.3.3/Cargo.lock +180 -0
- sp_fitting_models-1.3.3/Cargo.toml +15 -0
- sp_fitting_models-1.3.3/PKG-INFO +252 -0
- sp_fitting_models-1.3.3/README.en.md +231 -0
- sp_fitting_models-1.3.3/README.md +238 -0
- sp_fitting_models-1.3.3/build_interactive_mixed.bat +3 -0
- sp_fitting_models-1.3.3/examples/__init__.py +3 -0
- sp_fitting_models-1.3.3/examples/basic_usage.py +162 -0
- sp_fitting_models-1.3.3/examples/interactive_mixed.py +148 -0
- sp_fitting_models-1.3.3/interactive_mixed.spec +38 -0
- sp_fitting_models-1.3.3/pyproject.toml +29 -0
- sp_fitting_models-1.3.3/scripts/build_interactive_mixed.ps1 +19 -0
- sp_fitting_models-1.3.3/src/lib.rs +249 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/__init__.py +23 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/_core.pyi +50 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/data.py +37 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/fitting/__init__.py +10 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/fitting/objective.py +94 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/__init__.py +38 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/cooperative.py +100 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/isodesmic.py +174 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/mixed.py +126 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/models_old/__init__.py +37 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/models_old/cooperative.py +229 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/models_old/isodesmic.py +178 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/models_old/mixed.py +144 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/models_old/utils.py +66 -0
- sp_fitting_models-1.3.3/src/sp_fitting_models/models/utils.py +7 -0
- sp_fitting_models-1.3.3/tests/__init__.py +3 -0
- sp_fitting_models-1.3.3/tests/conftest.py +3 -0
- sp_fitting_models-1.3.3/tests/test_cooperative.py +173 -0
- sp_fitting_models-1.3.3/tests/test_fitting.py +185 -0
- sp_fitting_models-1.3.3/tests/test_isodesmic.py +164 -0
- sp_fitting_models-1.3.3/tests/test_mixed.py +253 -0
- sp_fitting_models-1.3.3/tests/test_objective.py +117 -0
- sp_fitting_models-1.3.3/tests/test_rust_vs_python.py +207 -0
- sp_fitting_models-1.3.3/tests/test_utils.py +159 -0
- sp_fitting_models-1.3.3/uv.lock +589 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Build and publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [created]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
build:
|
|
9
|
+
runs-on: ${{ matrix.os }}
|
|
10
|
+
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
14
|
+
|
|
15
|
+
permissions:
|
|
16
|
+
contents: read
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: PyO3/maturin-action@v1
|
|
22
|
+
with:
|
|
23
|
+
command: build
|
|
24
|
+
args: --release --out dist
|
|
25
|
+
manylinux: ${{ matrix.os == 'ubuntu-latest' && 'auto' || 'off' }}
|
|
26
|
+
|
|
27
|
+
- uses: PyO3/maturin-action@v1
|
|
28
|
+
if: matrix.os == 'ubuntu-latest'
|
|
29
|
+
with:
|
|
30
|
+
command: sdist
|
|
31
|
+
args: --out dist
|
|
32
|
+
|
|
33
|
+
- uses: actions/upload-artifact@v4
|
|
34
|
+
with:
|
|
35
|
+
name: wheels-${{ matrix.os }}
|
|
36
|
+
path: dist/*
|
|
37
|
+
|
|
38
|
+
publish:
|
|
39
|
+
runs-on: ubuntu-latest
|
|
40
|
+
needs: build
|
|
41
|
+
|
|
42
|
+
permissions:
|
|
43
|
+
id-token: write
|
|
44
|
+
|
|
45
|
+
environment:
|
|
46
|
+
name: pypi
|
|
47
|
+
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@v4
|
|
50
|
+
with:
|
|
51
|
+
path: dist
|
|
52
|
+
merge-multiple: true
|
|
53
|
+
|
|
54
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
55
|
+
with:
|
|
56
|
+
packages-dir: dist
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "autocfg"
|
|
7
|
+
version = "1.5.0"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
|
|
10
|
+
|
|
11
|
+
[[package]]
|
|
12
|
+
name = "cfg-if"
|
|
13
|
+
version = "1.0.4"
|
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
15
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
16
|
+
|
|
17
|
+
[[package]]
|
|
18
|
+
name = "heck"
|
|
19
|
+
version = "0.5.0"
|
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
21
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|
22
|
+
|
|
23
|
+
[[package]]
|
|
24
|
+
name = "indoc"
|
|
25
|
+
version = "2.0.7"
|
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
27
|
+
checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
|
|
28
|
+
dependencies = [
|
|
29
|
+
"rustversion",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "libc"
|
|
34
|
+
version = "0.2.182"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "memoffset"
|
|
40
|
+
version = "0.9.1"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
|
43
|
+
dependencies = [
|
|
44
|
+
"autocfg",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[[package]]
|
|
48
|
+
name = "once_cell"
|
|
49
|
+
version = "1.21.3"
|
|
50
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
51
|
+
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "portable-atomic"
|
|
55
|
+
version = "1.13.1"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "proc-macro2"
|
|
61
|
+
version = "1.0.106"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"unicode-ident",
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
[[package]]
|
|
69
|
+
name = "pyo3"
|
|
70
|
+
version = "0.22.6"
|
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
72
|
+
checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
|
|
73
|
+
dependencies = [
|
|
74
|
+
"cfg-if",
|
|
75
|
+
"indoc",
|
|
76
|
+
"libc",
|
|
77
|
+
"memoffset",
|
|
78
|
+
"once_cell",
|
|
79
|
+
"portable-atomic",
|
|
80
|
+
"pyo3-build-config",
|
|
81
|
+
"pyo3-ffi",
|
|
82
|
+
"pyo3-macros",
|
|
83
|
+
"unindent",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[[package]]
|
|
87
|
+
name = "pyo3-build-config"
|
|
88
|
+
version = "0.22.6"
|
|
89
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
90
|
+
checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
|
|
91
|
+
dependencies = [
|
|
92
|
+
"once_cell",
|
|
93
|
+
"target-lexicon",
|
|
94
|
+
]
|
|
95
|
+
|
|
96
|
+
[[package]]
|
|
97
|
+
name = "pyo3-ffi"
|
|
98
|
+
version = "0.22.6"
|
|
99
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
100
|
+
checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
|
|
101
|
+
dependencies = [
|
|
102
|
+
"libc",
|
|
103
|
+
"pyo3-build-config",
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
[[package]]
|
|
107
|
+
name = "pyo3-macros"
|
|
108
|
+
version = "0.22.6"
|
|
109
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
110
|
+
checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
|
|
111
|
+
dependencies = [
|
|
112
|
+
"proc-macro2",
|
|
113
|
+
"pyo3-macros-backend",
|
|
114
|
+
"quote",
|
|
115
|
+
"syn",
|
|
116
|
+
]
|
|
117
|
+
|
|
118
|
+
[[package]]
|
|
119
|
+
name = "pyo3-macros-backend"
|
|
120
|
+
version = "0.22.6"
|
|
121
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
122
|
+
checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
|
|
123
|
+
dependencies = [
|
|
124
|
+
"heck",
|
|
125
|
+
"proc-macro2",
|
|
126
|
+
"pyo3-build-config",
|
|
127
|
+
"quote",
|
|
128
|
+
"syn",
|
|
129
|
+
]
|
|
130
|
+
|
|
131
|
+
[[package]]
|
|
132
|
+
name = "quote"
|
|
133
|
+
version = "1.0.45"
|
|
134
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
135
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
136
|
+
dependencies = [
|
|
137
|
+
"proc-macro2",
|
|
138
|
+
]
|
|
139
|
+
|
|
140
|
+
[[package]]
|
|
141
|
+
name = "rustversion"
|
|
142
|
+
version = "1.0.22"
|
|
143
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
144
|
+
checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "sp_fitting_models"
|
|
148
|
+
version = "1.3.3"
|
|
149
|
+
dependencies = [
|
|
150
|
+
"pyo3",
|
|
151
|
+
]
|
|
152
|
+
|
|
153
|
+
[[package]]
|
|
154
|
+
name = "syn"
|
|
155
|
+
version = "2.0.117"
|
|
156
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
157
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
158
|
+
dependencies = [
|
|
159
|
+
"proc-macro2",
|
|
160
|
+
"quote",
|
|
161
|
+
"unicode-ident",
|
|
162
|
+
]
|
|
163
|
+
|
|
164
|
+
[[package]]
|
|
165
|
+
name = "target-lexicon"
|
|
166
|
+
version = "0.12.16"
|
|
167
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
168
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
|
169
|
+
|
|
170
|
+
[[package]]
|
|
171
|
+
name = "unicode-ident"
|
|
172
|
+
version = "1.0.24"
|
|
173
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
174
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
175
|
+
|
|
176
|
+
[[package]]
|
|
177
|
+
name = "unindent"
|
|
178
|
+
version = "0.2.4"
|
|
179
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
180
|
+
checksum = "7264e107f553ccae879d21fbea1d6724ac785e8c3bfc762137959b5802826ef3"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "sp_fitting_models"
|
|
3
|
+
version = "1.3.3"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
|
|
7
|
+
[lib]
|
|
8
|
+
name = "_core"
|
|
9
|
+
# "cdylib" is necessary to produce a shared library for Python to import from.
|
|
10
|
+
crate-type = ["cdylib"]
|
|
11
|
+
|
|
12
|
+
[dependencies]
|
|
13
|
+
# "extension-module" tells pyo3 we want to build an extension module (skips linking against libpython.so)
|
|
14
|
+
# "abi3-py39" tells pyo3 (and maturin) to build using the stable ABI with minimum Python version 3.9
|
|
15
|
+
pyo3 = { version = "0.22.4", features = ["extension-module", "abi3-py39"] }
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sp-fitting-models
|
|
3
|
+
Version: 1.3.3
|
|
4
|
+
Requires-Dist: lmfit>=1.3.4
|
|
5
|
+
Requires-Dist: matplotlib>=3.10.8
|
|
6
|
+
Requires-Dist: numba>=0.64.0
|
|
7
|
+
Requires-Dist: numpy>=2.4.2
|
|
8
|
+
Requires-Dist: pyright>=1.1.408
|
|
9
|
+
Requires-Dist: pytest>=9.0.2
|
|
10
|
+
Summary: For fitting spectroscopic data to cooperative and isodesmic models of supramolecular polymerization.
|
|
11
|
+
Author-email: Yuhei Yamada <tamanisikaminai@gmail.com>
|
|
12
|
+
Requires-Python: >=3.13
|
|
13
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
|
+
|
|
15
|
+
# sp-fitting-models
|
|
16
|
+
|
|
17
|
+
[English README](README.en.md)
|
|
18
|
+
|
|
19
|
+
超分子ポリマーのフィッティングモデルライブラリ
|
|
20
|
+
|
|
21
|
+
A Python library for fitting supramolecular polymerization data with various thermodynamic models.
|
|
22
|
+
|
|
23
|
+
## 概要 / Overview
|
|
24
|
+
|
|
25
|
+
このライブラリは、超分子ポリマー形成データを解析するための数理モデルを提供します。特に温度依存的な会合挙動を定量的に解析し、熱力学パラメータ(エンタルピー、エントロピー)を推定することができます。
|
|
26
|
+
|
|
27
|
+
This library provides mathematical models for analyzing supramolecular polymerization data. It enables quantitative analysis of temperature-dependent aggregation behavior and estimation of thermodynamic parameters (enthalpy, entropy).
|
|
28
|
+
|
|
29
|
+
## 特徴 / Features
|
|
30
|
+
|
|
31
|
+
- **複数のモデルに対応**
|
|
32
|
+
- **Isodesmicモデル**: すべての会合定数が等しい単純な会合モデル
|
|
33
|
+
- **Cooperativeモデル**: 核形成と伸長で異なる定数を持つ協同的会合モデル
|
|
34
|
+
- **Mixedモデル**: IsodesmicとCooperativeの2経路が競合するモデル
|
|
35
|
+
|
|
36
|
+
- **温度依存性の解析**
|
|
37
|
+
- van't Hoff式に基づく温度依存的な会合定数の計算
|
|
38
|
+
- ΔH(エンタルピー変化)とΔS(エントロピー変化)の推定
|
|
39
|
+
|
|
40
|
+
- **フィッティング機能**
|
|
41
|
+
- lmfitライブラリを使用した実験データへのフィッティング
|
|
42
|
+
- 複数濃度データの同時フィッティング(グローバルフィット)に対応
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## インストール / Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv add https://github.com/IndigoCarmine/sp_fitting_models.git
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 使用方法 / Usage
|
|
52
|
+
|
|
53
|
+
### 基本的な使用例
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import numpy as np
|
|
57
|
+
import matplotlib.pyplot as plt
|
|
58
|
+
from sp_fitting_models.models import temp_cooperative_model
|
|
59
|
+
|
|
60
|
+
# Temperature range
|
|
61
|
+
temps = np.linspace(280, 400, 200) # 280-400 K
|
|
62
|
+
|
|
63
|
+
# Thermodynamic parameters
|
|
64
|
+
deltaH = -96000 # Enthalpy change (J/mol)
|
|
65
|
+
deltaS = -180 # Entropy change (J/(mol·K))
|
|
66
|
+
deltaHnuc = 100000 # Nucleation penalty (J/mol)
|
|
67
|
+
c_tot = 5e-6 # Total concentration (M)
|
|
68
|
+
|
|
69
|
+
# Calculate aggregation
|
|
70
|
+
agg = temp_cooperative_model(
|
|
71
|
+
Temp=temps,
|
|
72
|
+
deltaH=deltaH,
|
|
73
|
+
deltaS=deltaS,
|
|
74
|
+
deltaHnuc=deltaHnuc,
|
|
75
|
+
c_tot=c_tot,
|
|
76
|
+
scaler=1.0
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Plot
|
|
80
|
+
plt.plot(temps - 273.15, agg)
|
|
81
|
+
plt.xlabel('Temperature (°C)')
|
|
82
|
+
plt.ylabel('Aggregation')
|
|
83
|
+
plt.show()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### データフィッティング
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
import lmfit as lm
|
|
90
|
+
from sp_fitting_models.data import TempVsAggData
|
|
91
|
+
from sp_fitting_models.fitting import objective_temp_cooperative
|
|
92
|
+
|
|
93
|
+
# Prepare your experimental data
|
|
94
|
+
data_list = [
|
|
95
|
+
TempVsAggData(temp=temps1, agg=agg1, concentration=c1),
|
|
96
|
+
TempVsAggData(temp=temps2, agg=agg2, concentration=c2),
|
|
97
|
+
]
|
|
98
|
+
|
|
99
|
+
# Set up parameters
|
|
100
|
+
params = lm.Parameters()
|
|
101
|
+
params.add('deltaH', value=-100000, min=-200000, max=0)
|
|
102
|
+
params.add('deltaS', value=-180, min=-400, max=0)
|
|
103
|
+
params.add('deltaHnuc', value=50000, min=0, max=200000)
|
|
104
|
+
params.add('scaler', value=1.0, min=0.5, max=1.5)
|
|
105
|
+
|
|
106
|
+
# Fit
|
|
107
|
+
minner = lm.Minimizer(objective_temp_cooperative, params, fcn_args=(data_list,))
|
|
108
|
+
result = minner.minimize()
|
|
109
|
+
|
|
110
|
+
print(lm.fit_report(result))
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### インタラクティブな可視化
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Run the interactive mixed model example
|
|
117
|
+
python examples/interactive_mixed.py
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
スライダーを使用してパラメータを変更し、リアルタイムで会合曲線の変化を観察できます。
|
|
121
|
+
|
|
122
|
+
### Windowsアプリとしてビルド (uv + PyInstaller)
|
|
123
|
+
|
|
124
|
+
`examples/interactive_mixed.py` をコンソールなしの Windows GUI アプリとしてビルドできます。
|
|
125
|
+
|
|
126
|
+
```powershell
|
|
127
|
+
./scripts/build_interactive_mixed.ps1
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
または `cmd.exe` から:
|
|
131
|
+
|
|
132
|
+
```bat
|
|
133
|
+
build_interactive_mixed.bat
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
生成物:
|
|
137
|
+
|
|
138
|
+
- `dist/interactive_mixed/interactive_mixed.exe`
|
|
139
|
+
|
|
140
|
+
このスクリプトは次を自動で行います。
|
|
141
|
+
|
|
142
|
+
1. `uv sync` で依存関係とローカルパッケージを同期
|
|
143
|
+
2. `uv run --with pyinstaller ...` で GUI アプリをビルド
|
|
144
|
+
|
|
145
|
+
## プロジェクト構造 / Project Structure
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
sp_fitting_models/
|
|
149
|
+
├── src/
|
|
150
|
+
│ └── sp_fitting_models/
|
|
151
|
+
│ ├── __init__.py
|
|
152
|
+
│ ├── data.py # Data structures
|
|
153
|
+
│ ├── models/ # Model implementations
|
|
154
|
+
│ │ ├── __init__.py
|
|
155
|
+
│ │ ├── isodesmic.py # Isodesmic models
|
|
156
|
+
│ │ ├── cooperative.py # Cooperative models
|
|
157
|
+
│ │ ├── mixed.py # Mixed models
|
|
158
|
+
│ │ └── utils.py # Utility functions
|
|
159
|
+
│ └── fitting/ # Fitting utilities
|
|
160
|
+
│ ├── __init__.py
|
|
161
|
+
│ └── objective.py # Objective functions for lmfit
|
|
162
|
+
├── tests/ # Test files
|
|
163
|
+
│ ├── test_isodesmic.py
|
|
164
|
+
│ ├── test_cooperative.py
|
|
165
|
+
│ ├── test_mixed.py
|
|
166
|
+
│ └── test_fitting.py
|
|
167
|
+
├── examples/ # Example scripts
|
|
168
|
+
│ ├── basic_usage.py
|
|
169
|
+
│ └── interactive_mixed.py
|
|
170
|
+
├── pyproject.toml
|
|
171
|
+
└── README.md
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## モデルの説明 / Model Description
|
|
175
|
+
|
|
176
|
+
### Isodesmicモデル
|
|
177
|
+
|
|
178
|
+
すべての会合ステップが同じ平衡定数Kを持つモデルです。シグモイド型の会合曲線を示します。
|
|
179
|
+
|
|
180
|
+
$$K = \exp\left(-\frac{\Delta H}{RT} + \frac{\Delta S}{R}\right)$$
|
|
181
|
+
|
|
182
|
+
次のような平衡状態です。
|
|
183
|
+
供給されるモノマーは省略してあります。:
|
|
184
|
+
$$M \stackrel{K}{\rightleftarrows}
|
|
185
|
+
M_2\stackrel{K}{\rightleftarrows}
|
|
186
|
+
M_3 \stackrel{K}{\rightleftarrows} ...$$
|
|
187
|
+
|
|
188
|
+
### Cooperativeモデル
|
|
189
|
+
|
|
190
|
+
核形成と伸長で異なる平衡定数を持つモデルです。非シグモイド型の会合曲線を示します。核形成ペナルティσにより協同性が表現されます。
|
|
191
|
+
|
|
192
|
+
$$\sigma = \exp\left(-\frac{\Delta H_{nuc}}{RT}\right)$$
|
|
193
|
+
|
|
194
|
+
$$ K = \exp\left(-\frac{\Delta H}{RT} + \frac{\Delta S}{R}\right)$$
|
|
195
|
+
|
|
196
|
+
$$ K_{nuc} = \sigma K $$
|
|
197
|
+
次のような平衡状態です。
|
|
198
|
+
$$M \stackrel{K_{nuc}}{\rightleftarrows}
|
|
199
|
+
M_2\stackrel{K}{\rightleftarrows}
|
|
200
|
+
M_3 \stackrel{K}{\rightleftarrows} ...$$
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### Mixedモデル
|
|
204
|
+
|
|
205
|
+
IsodesmicとCooperativeの2つの経路が同じモノマープールを共有して競合するモデルです。実験系で複数の会合機構が同時に起こる場合に適用できます。
|
|
206
|
+
|
|
207
|
+
次のような平衡状態を考えています。
|
|
208
|
+
$$M \stackrel{K_{nuc}}{\rightleftarrows}
|
|
209
|
+
M_2\stackrel{K}{\rightleftarrows}
|
|
210
|
+
M_3 \stackrel{K}{\rightleftarrows} ...$$
|
|
211
|
+
$$ \searrow \nwarrow^{K_{iso}}
|
|
212
|
+
M_2\stackrel{K_{iso}}{\rightleftarrows}
|
|
213
|
+
M_3 \stackrel{K_{iso}}{\rightleftarrows} ...$$
|
|
214
|
+
(MDではこれ以上きれいに書けませんでした...)
|
|
215
|
+
## テスト / Testing
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Run all tests
|
|
219
|
+
python -m pytest tests/
|
|
220
|
+
|
|
221
|
+
# Run specific test
|
|
222
|
+
python tests/test_cooperative.py
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
## サンプル / Examples
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
# Basic usage examples
|
|
229
|
+
python examples/basic_usage.py
|
|
230
|
+
|
|
231
|
+
# Interactive mixed model visualization
|
|
232
|
+
python examples/interactive_mixed.py
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## 依存関係 / Dependencies
|
|
236
|
+
|
|
237
|
+
- Python >= 3.13
|
|
238
|
+
- numpy >= 2.4.2
|
|
239
|
+
- numba >= 0.64.0
|
|
240
|
+
- lmfit >= 1.3.4
|
|
241
|
+
- matplotlib >= 3.10.8
|
|
242
|
+
|
|
243
|
+
## 引用 /Citation
|
|
244
|
+
|
|
245
|
+
書いていただけるなら嬉しいですが、必ずしも論文で言及する必要はありません。
|
|
246
|
+
ご自由にお使いください。
|
|
247
|
+
|
|
248
|
+
I would be grateful if you could cite this library in your publications, but it is not mandatory. Please feel free to use it as you see fit.
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
## 作成者 / Author
|
|
252
|
+
山田悠平 (Yuhei Yamada, Orcid: [0009-0003-9780-4135](https://orcid.org/0009-0003-9780-4135), google scholar: [Yuhei Yamada](https://scholar.google.co.jp/citations?user=mRKL6CYAAAAJ))
|