rxnfit 0.2.0__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.
Files changed (166) hide show
  1. rxnfit-0.2.0/.gitignore +11 -0
  2. rxnfit-0.2.0/LICENSE +28 -0
  3. rxnfit-0.2.0/PKG-INFO +143 -0
  4. rxnfit-0.2.0/README.md +120 -0
  5. rxnfit-0.2.0/docs/Makefile +20 -0
  6. rxnfit-0.2.0/docs/build/doctrees/environment.pickle +0 -0
  7. rxnfit-0.2.0/docs/build/doctrees/index.doctree +0 -0
  8. rxnfit-0.2.0/docs/build/doctrees/modules.doctree +0 -0
  9. rxnfit-0.2.0/docs/build/doctrees/rxnfit.build_ode.doctree +0 -0
  10. rxnfit-0.2.0/docs/build/doctrees/rxnfit.doctree +0 -0
  11. rxnfit-0.2.0/docs/build/doctrees/rxnfit.expdata_fit_sci.doctree +0 -0
  12. rxnfit-0.2.0/docs/build/doctrees/rxnfit.expdata_reader.doctree +0 -0
  13. rxnfit-0.2.0/docs/build/doctrees/rxnfit.fit_metrics.doctree +0 -0
  14. rxnfit-0.2.0/docs/build/doctrees/rxnfit.p0_opt_fit.doctree +0 -0
  15. rxnfit-0.2.0/docs/build/doctrees/rxnfit.rate_const_ft_eval.doctree +0 -0
  16. rxnfit-0.2.0/docs/build/doctrees/rxnfit.rxn_reader.doctree +0 -0
  17. rxnfit-0.2.0/docs/build/doctrees/rxnfit.solv_ode.doctree +0 -0
  18. rxnfit-0.2.0/docs/build/html/.buildinfo +4 -0
  19. rxnfit-0.2.0/docs/build/html/.nojekyll +0 -0
  20. rxnfit-0.2.0/docs/build/html/_sources/index.rst.txt +43 -0
  21. rxnfit-0.2.0/docs/build/html/_sources/modules.rst.txt +7 -0
  22. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.build_ode.rst.txt +7 -0
  23. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.expdata_fit_sci.rst.txt +7 -0
  24. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.expdata_reader.rst.txt +7 -0
  25. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.fit_metrics.rst.txt +7 -0
  26. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.p0_opt_fit.rst.txt +7 -0
  27. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.rate_const_ft_eval.rst.txt +7 -0
  28. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.rst.txt +25 -0
  29. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.rxn_reader.rst.txt +7 -0
  30. rxnfit-0.2.0/docs/build/html/_sources/rxnfit.solv_ode.rst.txt +7 -0
  31. rxnfit-0.2.0/docs/build/html/_static/_sphinx_javascript_frameworks_compat.js +123 -0
  32. rxnfit-0.2.0/docs/build/html/_static/base-stemmer.js +476 -0
  33. rxnfit-0.2.0/docs/build/html/_static/basic.css +906 -0
  34. rxnfit-0.2.0/docs/build/html/_static/css/badge_only.css +1 -0
  35. rxnfit-0.2.0/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff +0 -0
  36. rxnfit-0.2.0/docs/build/html/_static/css/fonts/Roboto-Slab-Bold.woff2 +0 -0
  37. rxnfit-0.2.0/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff +0 -0
  38. rxnfit-0.2.0/docs/build/html/_static/css/fonts/Roboto-Slab-Regular.woff2 +0 -0
  39. rxnfit-0.2.0/docs/build/html/_static/css/fonts/fontawesome-webfont.eot +0 -0
  40. rxnfit-0.2.0/docs/build/html/_static/css/fonts/fontawesome-webfont.svg +2671 -0
  41. rxnfit-0.2.0/docs/build/html/_static/css/fonts/fontawesome-webfont.ttf +0 -0
  42. rxnfit-0.2.0/docs/build/html/_static/css/fonts/fontawesome-webfont.woff +0 -0
  43. rxnfit-0.2.0/docs/build/html/_static/css/fonts/fontawesome-webfont.woff2 +0 -0
  44. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-bold-italic.woff +0 -0
  45. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-bold-italic.woff2 +0 -0
  46. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-bold.woff +0 -0
  47. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-bold.woff2 +0 -0
  48. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-normal-italic.woff +0 -0
  49. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-normal-italic.woff2 +0 -0
  50. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-normal.woff +0 -0
  51. rxnfit-0.2.0/docs/build/html/_static/css/fonts/lato-normal.woff2 +0 -0
  52. rxnfit-0.2.0/docs/build/html/_static/css/theme.css +4 -0
  53. rxnfit-0.2.0/docs/build/html/_static/doctools.js +150 -0
  54. rxnfit-0.2.0/docs/build/html/_static/documentation_options.js +13 -0
  55. rxnfit-0.2.0/docs/build/html/_static/english-stemmer.js +1066 -0
  56. rxnfit-0.2.0/docs/build/html/_static/file.png +0 -0
  57. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bold.eot +0 -0
  58. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bold.ttf +0 -0
  59. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bold.woff +0 -0
  60. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bold.woff2 +0 -0
  61. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bolditalic.eot +0 -0
  62. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bolditalic.ttf +0 -0
  63. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff +0 -0
  64. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-bolditalic.woff2 +0 -0
  65. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-italic.eot +0 -0
  66. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-italic.ttf +0 -0
  67. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-italic.woff +0 -0
  68. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-italic.woff2 +0 -0
  69. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-regular.eot +0 -0
  70. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-regular.ttf +0 -0
  71. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-regular.woff +0 -0
  72. rxnfit-0.2.0/docs/build/html/_static/fonts/Lato/lato-regular.woff2 +0 -0
  73. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.eot +0 -0
  74. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.ttf +0 -0
  75. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff +0 -0
  76. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-bold.woff2 +0 -0
  77. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.eot +0 -0
  78. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.ttf +0 -0
  79. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff +0 -0
  80. rxnfit-0.2.0/docs/build/html/_static/fonts/RobotoSlab/roboto-slab-v7-regular.woff2 +0 -0
  81. rxnfit-0.2.0/docs/build/html/_static/jquery.js +2 -0
  82. rxnfit-0.2.0/docs/build/html/_static/js/badge_only.js +1 -0
  83. rxnfit-0.2.0/docs/build/html/_static/js/theme.js +1 -0
  84. rxnfit-0.2.0/docs/build/html/_static/js/versions.js +228 -0
  85. rxnfit-0.2.0/docs/build/html/_static/language_data.js +13 -0
  86. rxnfit-0.2.0/docs/build/html/_static/minus.png +0 -0
  87. rxnfit-0.2.0/docs/build/html/_static/plus.png +0 -0
  88. rxnfit-0.2.0/docs/build/html/_static/pygments.css +75 -0
  89. rxnfit-0.2.0/docs/build/html/_static/searchtools.js +693 -0
  90. rxnfit-0.2.0/docs/build/html/_static/sphinx_highlight.js +159 -0
  91. rxnfit-0.2.0/docs/build/html/genindex.html +457 -0
  92. rxnfit-0.2.0/docs/build/html/index.html +130 -0
  93. rxnfit-0.2.0/docs/build/html/modules.html +173 -0
  94. rxnfit-0.2.0/docs/build/html/objects.inv +0 -0
  95. rxnfit-0.2.0/docs/build/html/py-modindex.html +167 -0
  96. rxnfit-0.2.0/docs/build/html/rxnfit.build_ode.html +340 -0
  97. rxnfit-0.2.0/docs/build/html/rxnfit.expdata_fit_sci.html +463 -0
  98. rxnfit-0.2.0/docs/build/html/rxnfit.expdata_reader.html +300 -0
  99. rxnfit-0.2.0/docs/build/html/rxnfit.fit_metrics.html +178 -0
  100. rxnfit-0.2.0/docs/build/html/rxnfit.html +234 -0
  101. rxnfit-0.2.0/docs/build/html/rxnfit.p0_opt_fit.html +181 -0
  102. rxnfit-0.2.0/docs/build/html/rxnfit.rate_const_ft_eval.html +177 -0
  103. rxnfit-0.2.0/docs/build/html/rxnfit.rxn_reader.html +469 -0
  104. rxnfit-0.2.0/docs/build/html/rxnfit.solv_ode.html +489 -0
  105. rxnfit-0.2.0/docs/build/html/search.html +127 -0
  106. rxnfit-0.2.0/docs/build/html/searchindex.js +1 -0
  107. rxnfit-0.2.0/docs/make.bat +35 -0
  108. rxnfit-0.2.0/docs/source/conf.py +42 -0
  109. rxnfit-0.2.0/docs/source/index.rst +43 -0
  110. rxnfit-0.2.0/docs/source/modules.rst +7 -0
  111. rxnfit-0.2.0/docs/source/rxnfit.build_ode.rst +7 -0
  112. rxnfit-0.2.0/docs/source/rxnfit.expdata_fit_sci.rst +7 -0
  113. rxnfit-0.2.0/docs/source/rxnfit.expdata_reader.rst +7 -0
  114. rxnfit-0.2.0/docs/source/rxnfit.fit_metrics.rst +7 -0
  115. rxnfit-0.2.0/docs/source/rxnfit.p0_opt_fit.rst +7 -0
  116. rxnfit-0.2.0/docs/source/rxnfit.rate_const_ft_eval.rst +7 -0
  117. rxnfit-0.2.0/docs/source/rxnfit.rst +25 -0
  118. rxnfit-0.2.0/docs/source/rxnfit.rxn_reader.rst +7 -0
  119. rxnfit-0.2.0/docs/source/rxnfit.solv_ode.rst +7 -0
  120. rxnfit-0.2.0/docs/spec_docs/ForFutureWorks.md +20 -0
  121. rxnfit-0.2.0/docs/spec_docs/PriorWorks.md +16 -0
  122. rxnfit-0.2.0/docs/spec_docs/expdata_y0_column_order_discussion.md +76 -0
  123. rxnfit-0.2.0/docs/spec_docs/fit_metrics.md +212 -0
  124. rxnfit-0.2.0/docs/spec_docs/k_as_ft.md +135 -0
  125. rxnfit-0.2.0/docs/spec_docs/p0_opt_fit.md +155 -0
  126. rxnfit-0.2.0/examples/01_example_script_classRxnODEsolver_ref1.ipynb +286 -0
  127. rxnfit-0.2.0/examples/02_example_script_classRxnODEsolver_ref3_litk.ipynb +508 -0
  128. rxnfit-0.2.0/examples/03_example_script_classExpDataFitSci_ref2b.ipynb +364 -0
  129. rxnfit-0.2.0/examples/04_example_script_classExpDataFitSci_ref3.ipynb +361 -0
  130. rxnfit-0.2.0/examples/05_example_script_classExpDataFitSci_ref4.ipynb +364 -0
  131. rxnfit-0.2.0/examples/06_example_script_classExpDataFitSci_ref5.ipynb +299 -0
  132. rxnfit-0.2.0/examples/07_example_script_classP0ValOpt_ref5.ipynb +549 -0
  133. rxnfit-0.2.0/examples/08_example_script_classExpDataFitSci_ref6.ipynb +421 -0
  134. rxnfit-0.2.0/examples/09_example_script_classP0_ref2.ipynb +442 -0
  135. rxnfit-0.2.0/examples/example_script_classRxnToODE.ipynb +153 -0
  136. rxnfit-0.2.0/examples/example_script_rxn_reader.ipynb +236 -0
  137. rxnfit-0.2.0/examples/sample_data/ref2/sample_rxn_ref2a.csv +3 -0
  138. rxnfit-0.2.0/examples/sample_data/ref2/sample_rxn_ref2b.csv +3 -0
  139. rxnfit-0.2.0/examples/sample_data/ref2/sample_timecourse_ref2.csv +24 -0
  140. rxnfit-0.2.0/examples/sample_data/ref3/sample_rxn_ref3AN.csv +4 -0
  141. rxnfit-0.2.0/examples/sample_data/ref3/sample_rxn_ref3AN_litk.csv +4 -0
  142. rxnfit-0.2.0/examples/sample_data/ref3/sample_timecourse_ref3AN.csv +6 -0
  143. rxnfit-0.2.0/examples/sample_data/ref4/sample_rxn_ref4.csv +5 -0
  144. rxnfit-0.2.0/examples/sample_data/ref4/sample_timecourse_ref4.csv +11 -0
  145. rxnfit-0.2.0/examples/sample_data/ref5/ref5.xlsx +0 -0
  146. rxnfit-0.2.0/examples/sample_data/ref5/ref5_df1.csv +10 -0
  147. rxnfit-0.2.0/examples/sample_data/ref5/ref5_df2.csv +10 -0
  148. rxnfit-0.2.0/examples/sample_data/ref5/ref5_df3.csv +9 -0
  149. rxnfit-0.2.0/examples/sample_data/ref5/ref5_df4.csv +8 -0
  150. rxnfit-0.2.0/examples/sample_data/ref5/sample_rxn_ref5.csv +7 -0
  151. rxnfit-0.2.0/examples/sample_data/ref6/ref6.xlsx +0 -0
  152. rxnfit-0.2.0/examples/sample_data/ref6/sample_k_ref6.csv +2 -0
  153. rxnfit-0.2.0/examples/sample_data/ref6/sample_rxn_ref6.csv +3 -0
  154. rxnfit-0.2.0/examples/sample_data/ref6/sample_timecourse_ref6.csv +24 -0
  155. rxnfit-0.2.0/examples/sample_data/sample_rxn_ref1.csv +4 -0
  156. rxnfit-0.2.0/pyproject.toml +41 -0
  157. rxnfit-0.2.0/src/rxnfit/__init__.py +6 -0
  158. rxnfit-0.2.0/src/rxnfit/_version.py +1 -0
  159. rxnfit-0.2.0/src/rxnfit/build_ode.py +521 -0
  160. rxnfit-0.2.0/src/rxnfit/expdata_fit_sci.py +902 -0
  161. rxnfit-0.2.0/src/rxnfit/expdata_reader.py +215 -0
  162. rxnfit-0.2.0/src/rxnfit/fit_metrics.py +92 -0
  163. rxnfit-0.2.0/src/rxnfit/p0_opt_fit.py +289 -0
  164. rxnfit-0.2.0/src/rxnfit/rate_const_ft_eval.py +136 -0
  165. rxnfit-0.2.0/src/rxnfit/rxn_reader.py +467 -0
  166. rxnfit-0.2.0/src/rxnfit/solv_ode.py +580 -0
@@ -0,0 +1,11 @@
1
+ src/rxnfit/__pycache__/
2
+ .ipynb_checkpoints/
3
+ .DS_Store
4
+ src/.DS_Store
5
+ src/rxnfit/.DS_Store
6
+ venv*
7
+ build/
8
+ *.egg-info/
9
+ dist/
10
+ docs/build/*
11
+ !docs/build/
rxnfit-0.2.0/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2023, PEJpOhn
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
rxnfit-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: rxnfit
3
+ Version: 0.2.0
4
+ Summary: set up theoretical reaction kinetics equations
5
+ Project-URL: Homepage, https://github.com/PEJpOhno/rxnfit
6
+ Project-URL: Issues, https://github.com/PEJpOhno/rxnfit/issues
7
+ Author-email: Mitsuru Ohno <pejpohn@gmail.com>
8
+ License-Expression: BSD-3-Clause
9
+ License-File: LICENSE
10
+ Classifier: License :: OSI Approved :: BSD License
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.12
14
+ Requires-Dist: matplotlib>=3.9.0
15
+ Requires-Dist: numpy>=2.0.2; python_version < '3.13'
16
+ Requires-Dist: numpy>=2.1.0; python_version >= '3.13'
17
+ Requires-Dist: optuna>=4.7.0
18
+ Requires-Dist: pandas>=2.2.2; python_version < '3.13'
19
+ Requires-Dist: pandas>=2.2.3; python_version >= '3.13'
20
+ Requires-Dist: scipy>=1.14.1
21
+ Requires-Dist: sympy>=1.12
22
+ Description-Content-Type: text/markdown
23
+
24
+
25
+ ## Overviews
26
+ "rxnfit" is a Python module that builds ordinary differential equations (ODEs) for reaction kinetics from elementary reaction formulas and rate constants given in CSV format, and computes concentration time courses numerically.
27
+
28
+ - When all rate constants are known, the time evolution of each species’ concentration is obtained by **numerical integration** of the ODEs (e.g. with `scipy.integrate.solve_ivp`).
29
+ - When some rate constants are unknown, they can be **estimated by fitting** the ODE solution to experimental concentration time-course data (e.g. with `scipy.optimize.minimize`).
30
+ - A rate constant may be given as an **expression** in other rate constants (e.g. k₂ = 2·k₁), or as a **function of time** *t* via an override CSV.
31
+
32
+ **Documentation :** https://pejpohno.github.io/rxnfit/
33
+ **Tutorial :** in preparation
34
+ **How to cite :** Ohno, M. rxnfit. GitHub. https://github.com/PEJpOhno/rxnfit (2026).
35
+
36
+ ## Current version and requirements
37
+ - current version = 0.2.0
38
+ - pyhon >=3.12
39
+
40
+ [dependencies]
41
+ - NumPy
42
+ - pandas
43
+ - SciPy
44
+ - SymPy
45
+ - Matplotlib
46
+ - Optuna
47
+
48
+ ## Copyright and license
49
+ Copyright (c) 2025 Mitsuru Ohno
50
+ Released under the BSD-3 license, license that can be found in the LICENSE file.
51
+
52
+ ## Installation
53
+ Create and activate a Python virtual environment, then
54
+
55
+ ```sh
56
+ pip install rxnfit
57
+ ```
58
+
59
+ If you want to give it a quick try, just copy or move the example directory from the cloned repo to wherever it's convenient. Then, activate your virtual environment, start Jupyter Notebook, and open one of the sample scripts inside "examples" directry to test it out.
60
+
61
+ ## Usage
62
+ ### Prepare csv file
63
+ 1. Describe reaction formula in csv format. THe first row shoud be header. The first column and the second column should be reaction ID (named RID) and the rate constant (named k). Other column names can be omitted.
64
+ 2. The reactants are putted in alternately with the coeficient and the chemical species. Each reaction should be described in one row.
65
+ 3. To separate the reactants and the products, two ">" are setted with two columns. As with reaction SMARTS, you may write reaction conditions between the two ">"; in the current version of rxnfit these are unused.
66
+ 4. The products are putted in alternately with the coeficient and the chemical species.
67
+ Note the reaction formula should be inputted by the left filling. To describe chemical species, it is better to avoid to use arithmetic symbols such as "+", "-" and "*" (e.g. use "**a**"(nion) in place of "-"). The coefficient '1' can be substituted for blank.
68
+ 5. Each elementary reaction’s rate constant must be specified in the format ‘k + RID’. If left empty, the system will automatically assign ‘k + RID’.
69
+
70
+ The rate constant k_m can also be defined as a function of another elementary reaction rate constant k_n, or as a function of time t.
71
+ The example of a csv format is as follows. Attached "examples/sample_data/sample_rxn_ref1.csv" and "examples/sample_data/refX/sample_rxn_refX.csv" are also available for demonstration.
72
+
73
+ example of a csv format
74
+
75
+ RID, k,,,,,,,,,,
76
+ 1,0.054,,AcOEt,,OHa1,>,>,,AcOa1,,EtOH
77
+ 2,1.4,,AcOiPr,,OHa1,>,>,,AcOa1,,iPrOH
78
+ 3,0.031,,EGOAc2,2,OHa1,>,>,2,AcOa1,,EG
79
+
80
+ ## Modules and classes
81
+
82
+ The following items are those prominently used in the example notebooks.
83
+
84
+ ### rxn_reader
85
+ Reads reaction CSV and builds symbolic ODE system.
86
+
87
+ | item | name | description |
88
+ |------|------|-------------|
89
+ | class | RxnToODE | Builds differential-type rate equations (strings) from reaction CSV, then ODE system expressions (SymPy). Attributes: rate_consts_dict, sympy_symbol_dict, sys_odes_dict, function_names. |
90
+ | function | get_reactions | Parse reaction CSV into list of reaction data (RID, k, reactants, products, conditions). |
91
+ | function | get_unique_species | Extract unique species names from reaction list. |
92
+ | function | rate_constants | Extract rate constant key and value (float or expression string) per reaction. |
93
+
94
+ ### build_ode
95
+ Builds numerical ODE RHS from symbolic system; supports rate-constant overrides and time-dependent k(t).
96
+
97
+ | item | name | description |
98
+ |------|------|-------------|
99
+ | class | RxnODEbuild | Extends RxnToODE. Builds callable ODE RHS for scipy.integrate.solve_ivp. Optional rate_const_overrides (dict or CSV path) and rate_const_overrides_encoding. Methods: create_ode_system(), create_ode_system_with_rate_consts(), get_ode_system(), get_ode_info(). |
100
+ | function | create_system_rhs | Build (t, y) RHS for solve_ivp from ODE functions dict. Optional rate_const_values (dict or callable(t)) and symbolic_rate_const_keys for variable or time-dependent rate constants. |
101
+
102
+ ### expdata_reader
103
+ Loads and aligns experimental time-course data.
104
+
105
+ | item | name | description |
106
+ |------|------|-------------|
107
+ | function | expdata_read | Read list of DataFrames into list of (t_list, C_exp_list) per dataset. |
108
+ | function | get_y0_from_expdata | Initial concentrations per dataset in function_names order. |
109
+
110
+ ### expdata_fit_sci
111
+ Fits symbolic rate constants to experimental data (scipy.optimize.minimize).
112
+
113
+ | item | name | description |
114
+ |------|------|-------------|
115
+ | class | ExpDataFitSci | Multi-dataset fitting. run_fit(p0, ...) returns (result, param_info, fit_metrics). result has .fun (RSS), .tss, .r2; fit_metrics is dict with keys 'rss', 'tss', 'r2'. get_solver_config_args(dataset_index), get_fitted_rate_const_dict(result). plot_fitted_solution(expdata_df, ...) plots per-dataset y0 curves after run_fit. to_dataframe_list() returns list of DataFrames (one per dataset). When model has k(t), get_solver_config_args() adds rate_const_values (callable) and symbolic_rate_const_keys after run_fit(). |
116
+
117
+ ### solv_ode
118
+ Numerical integration and plotting of ODE solutions.
119
+
120
+ | item | name | description |
121
+ |------|------|-------------|
122
+ | class | SolverConfig | Dataclass: y0, t_span, t_eval, method, rtol. Optional: rate_const_values (dict or callable(t)), symbolic_rate_const_keys (both or neither). |
123
+ | class | RxnODEsolver | Integrates ODE with builder and config. solve_system(), to_dataframe_list() returning list of DataFrames, eval_fit_metrics(expdata_df, ...) returning dict with 'rss', 'tss', 'r2', solution_plot(). When config has rate_const_values and symbolic_rate_const_keys, uses rate-constants ODE path. |
124
+
125
+ ### p0_opt_fit
126
+ Optimizes initial parameter values (p0) for rate constants using Optuna, then fits with ExpDataFitSci.
127
+
128
+ | item | name | description |
129
+ |------|------|-------------|
130
+ | class | P0OptFit | Optimizes p0 via Optuna (e.g. suggest_float with log=True) and runs ExpDataFitSci.run_fit with the best p0. optimize(n_trials, show_progress_bar, ...) returns (dict of variable → (initial, fitted), fit_metrics). fit_metrics is a dict with keys 'rss', 'tss', 'r2'. optuna_log() returns per-trial log. |
131
+
132
+ ## References
133
+
134
+ - **Python**: Python Software Foundation. (2024). *Python* (Version 3.13) [Computer software]. https://www.python.org/
135
+ - **NumPy**: Harris, C. R., Millman, K. J., van der Walt, S. J., et al. (2020). Array programming with NumPy. *Nature*, 585(7825), 357–362. https://doi.org/10.1038/s41586-020-2649-2
136
+ - **pandas**: McKinney, W. (2010). Data Structures for Statistical Computing in Python. *Proceedings of the 9th Python in Science Conference*, 56–61. https://doi.org/10.25080/Majora-92bf1922-00a
137
+ - **SciPy**: Virtanen, P., Gommers, R., Oliphant, T. E., et al. (2020). SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. *Nature Methods*, 17(3), 261–272. https://doi.org/10.1038/s41592-019-0686-2
138
+ - **SymPy**: Meurer, A., Smith, C. P., Paprocki, M., et al. (2017). SymPy: symbolic computing in Python. *PeerJ Computer Science*, 3, e103. https://doi.org/10.7717/peerj-cs.103
139
+ - **Matplotlib**: Hunter, J. D. (2007). Matplotlib: A 2D graphics environment. *Computing in Science & Engineering*, 9(3), 90–95. https://doi.org/10.1109/MCSE.2007.55
140
+ - **Optuna**: Akiba, T., Sano, S., Yanase, T., Ohta, T., & Koyama, M. (2019). Optuna: A next-generation hyperparameter optimization framework. *Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD '19)*, 2623–2631. https://doi.org/10.1145/3292500.3330701
141
+
142
+ ## Acknowledgements
143
+ This module and its accompanying documentation were developed with the support of Cursor’s AI-assisted tools.
rxnfit-0.2.0/README.md ADDED
@@ -0,0 +1,120 @@
1
+
2
+ ## Overviews
3
+ "rxnfit" is a Python module that builds ordinary differential equations (ODEs) for reaction kinetics from elementary reaction formulas and rate constants given in CSV format, and computes concentration time courses numerically.
4
+
5
+ - When all rate constants are known, the time evolution of each species’ concentration is obtained by **numerical integration** of the ODEs (e.g. with `scipy.integrate.solve_ivp`).
6
+ - When some rate constants are unknown, they can be **estimated by fitting** the ODE solution to experimental concentration time-course data (e.g. with `scipy.optimize.minimize`).
7
+ - A rate constant may be given as an **expression** in other rate constants (e.g. k₂ = 2·k₁), or as a **function of time** *t* via an override CSV.
8
+
9
+ **Documentation :** https://pejpohno.github.io/rxnfit/
10
+ **Tutorial :** in preparation
11
+ **How to cite :** Ohno, M. rxnfit. GitHub. https://github.com/PEJpOhno/rxnfit (2026).
12
+
13
+ ## Current version and requirements
14
+ - current version = 0.2.0
15
+ - pyhon >=3.12
16
+
17
+ [dependencies]
18
+ - NumPy
19
+ - pandas
20
+ - SciPy
21
+ - SymPy
22
+ - Matplotlib
23
+ - Optuna
24
+
25
+ ## Copyright and license
26
+ Copyright (c) 2025 Mitsuru Ohno
27
+ Released under the BSD-3 license, license that can be found in the LICENSE file.
28
+
29
+ ## Installation
30
+ Create and activate a Python virtual environment, then
31
+
32
+ ```sh
33
+ pip install rxnfit
34
+ ```
35
+
36
+ If you want to give it a quick try, just copy or move the example directory from the cloned repo to wherever it's convenient. Then, activate your virtual environment, start Jupyter Notebook, and open one of the sample scripts inside "examples" directry to test it out.
37
+
38
+ ## Usage
39
+ ### Prepare csv file
40
+ 1. Describe reaction formula in csv format. THe first row shoud be header. The first column and the second column should be reaction ID (named RID) and the rate constant (named k). Other column names can be omitted.
41
+ 2. The reactants are putted in alternately with the coeficient and the chemical species. Each reaction should be described in one row.
42
+ 3. To separate the reactants and the products, two ">" are setted with two columns. As with reaction SMARTS, you may write reaction conditions between the two ">"; in the current version of rxnfit these are unused.
43
+ 4. The products are putted in alternately with the coeficient and the chemical species.
44
+ Note the reaction formula should be inputted by the left filling. To describe chemical species, it is better to avoid to use arithmetic symbols such as "+", "-" and "*" (e.g. use "**a**"(nion) in place of "-"). The coefficient '1' can be substituted for blank.
45
+ 5. Each elementary reaction’s rate constant must be specified in the format ‘k + RID’. If left empty, the system will automatically assign ‘k + RID’.
46
+
47
+ The rate constant k_m can also be defined as a function of another elementary reaction rate constant k_n, or as a function of time t.
48
+ The example of a csv format is as follows. Attached "examples/sample_data/sample_rxn_ref1.csv" and "examples/sample_data/refX/sample_rxn_refX.csv" are also available for demonstration.
49
+
50
+ example of a csv format
51
+
52
+ RID, k,,,,,,,,,,
53
+ 1,0.054,,AcOEt,,OHa1,>,>,,AcOa1,,EtOH
54
+ 2,1.4,,AcOiPr,,OHa1,>,>,,AcOa1,,iPrOH
55
+ 3,0.031,,EGOAc2,2,OHa1,>,>,2,AcOa1,,EG
56
+
57
+ ## Modules and classes
58
+
59
+ The following items are those prominently used in the example notebooks.
60
+
61
+ ### rxn_reader
62
+ Reads reaction CSV and builds symbolic ODE system.
63
+
64
+ | item | name | description |
65
+ |------|------|-------------|
66
+ | class | RxnToODE | Builds differential-type rate equations (strings) from reaction CSV, then ODE system expressions (SymPy). Attributes: rate_consts_dict, sympy_symbol_dict, sys_odes_dict, function_names. |
67
+ | function | get_reactions | Parse reaction CSV into list of reaction data (RID, k, reactants, products, conditions). |
68
+ | function | get_unique_species | Extract unique species names from reaction list. |
69
+ | function | rate_constants | Extract rate constant key and value (float or expression string) per reaction. |
70
+
71
+ ### build_ode
72
+ Builds numerical ODE RHS from symbolic system; supports rate-constant overrides and time-dependent k(t).
73
+
74
+ | item | name | description |
75
+ |------|------|-------------|
76
+ | class | RxnODEbuild | Extends RxnToODE. Builds callable ODE RHS for scipy.integrate.solve_ivp. Optional rate_const_overrides (dict or CSV path) and rate_const_overrides_encoding. Methods: create_ode_system(), create_ode_system_with_rate_consts(), get_ode_system(), get_ode_info(). |
77
+ | function | create_system_rhs | Build (t, y) RHS for solve_ivp from ODE functions dict. Optional rate_const_values (dict or callable(t)) and symbolic_rate_const_keys for variable or time-dependent rate constants. |
78
+
79
+ ### expdata_reader
80
+ Loads and aligns experimental time-course data.
81
+
82
+ | item | name | description |
83
+ |------|------|-------------|
84
+ | function | expdata_read | Read list of DataFrames into list of (t_list, C_exp_list) per dataset. |
85
+ | function | get_y0_from_expdata | Initial concentrations per dataset in function_names order. |
86
+
87
+ ### expdata_fit_sci
88
+ Fits symbolic rate constants to experimental data (scipy.optimize.minimize).
89
+
90
+ | item | name | description |
91
+ |------|------|-------------|
92
+ | class | ExpDataFitSci | Multi-dataset fitting. run_fit(p0, ...) returns (result, param_info, fit_metrics). result has .fun (RSS), .tss, .r2; fit_metrics is dict with keys 'rss', 'tss', 'r2'. get_solver_config_args(dataset_index), get_fitted_rate_const_dict(result). plot_fitted_solution(expdata_df, ...) plots per-dataset y0 curves after run_fit. to_dataframe_list() returns list of DataFrames (one per dataset). When model has k(t), get_solver_config_args() adds rate_const_values (callable) and symbolic_rate_const_keys after run_fit(). |
93
+
94
+ ### solv_ode
95
+ Numerical integration and plotting of ODE solutions.
96
+
97
+ | item | name | description |
98
+ |------|------|-------------|
99
+ | class | SolverConfig | Dataclass: y0, t_span, t_eval, method, rtol. Optional: rate_const_values (dict or callable(t)), symbolic_rate_const_keys (both or neither). |
100
+ | class | RxnODEsolver | Integrates ODE with builder and config. solve_system(), to_dataframe_list() returning list of DataFrames, eval_fit_metrics(expdata_df, ...) returning dict with 'rss', 'tss', 'r2', solution_plot(). When config has rate_const_values and symbolic_rate_const_keys, uses rate-constants ODE path. |
101
+
102
+ ### p0_opt_fit
103
+ Optimizes initial parameter values (p0) for rate constants using Optuna, then fits with ExpDataFitSci.
104
+
105
+ | item | name | description |
106
+ |------|------|-------------|
107
+ | class | P0OptFit | Optimizes p0 via Optuna (e.g. suggest_float with log=True) and runs ExpDataFitSci.run_fit with the best p0. optimize(n_trials, show_progress_bar, ...) returns (dict of variable → (initial, fitted), fit_metrics). fit_metrics is a dict with keys 'rss', 'tss', 'r2'. optuna_log() returns per-trial log. |
108
+
109
+ ## References
110
+
111
+ - **Python**: Python Software Foundation. (2024). *Python* (Version 3.13) [Computer software]. https://www.python.org/
112
+ - **NumPy**: Harris, C. R., Millman, K. J., van der Walt, S. J., et al. (2020). Array programming with NumPy. *Nature*, 585(7825), 357–362. https://doi.org/10.1038/s41586-020-2649-2
113
+ - **pandas**: McKinney, W. (2010). Data Structures for Statistical Computing in Python. *Proceedings of the 9th Python in Science Conference*, 56–61. https://doi.org/10.25080/Majora-92bf1922-00a
114
+ - **SciPy**: Virtanen, P., Gommers, R., Oliphant, T. E., et al. (2020). SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. *Nature Methods*, 17(3), 261–272. https://doi.org/10.1038/s41592-019-0686-2
115
+ - **SymPy**: Meurer, A., Smith, C. P., Paprocki, M., et al. (2017). SymPy: symbolic computing in Python. *PeerJ Computer Science*, 3, e103. https://doi.org/10.7717/peerj-cs.103
116
+ - **Matplotlib**: Hunter, J. D. (2007). Matplotlib: A 2D graphics environment. *Computing in Science & Engineering*, 9(3), 90–95. https://doi.org/10.1109/MCSE.2007.55
117
+ - **Optuna**: Akiba, T., Sano, S., Yanase, T., Ohta, T., & Koyama, M. (2019). Optuna: A next-generation hyperparameter optimization framework. *Proceedings of the 25th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (KDD '19)*, 2623–2631. https://doi.org/10.1145/3292500.3330701
118
+
119
+ ## Acknowledgements
120
+ This module and its accompanying documentation were developed with the support of Cursor’s AI-assisted tools.
@@ -0,0 +1,20 @@
1
+ # Minimal makefile for Sphinx documentation
2
+ #
3
+
4
+ # You can set these variables from the command line, and also
5
+ # from the environment for the first two.
6
+ SPHINXOPTS ?=
7
+ SPHINXBUILD ?= sphinx-build
8
+ SOURCEDIR = source
9
+ BUILDDIR = build
10
+
11
+ # Put it first so that "make" without argument is like "make help".
12
+ help:
13
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14
+
15
+ .PHONY: help Makefile
16
+
17
+ # Catch-all target: route all unknown targets to Sphinx using the new
18
+ # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19
+ %: Makefile
20
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@@ -0,0 +1,4 @@
1
+ # Sphinx build info version 1
2
+ # This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
3
+ config: 0355388f80fdeb1052349417a7b5bd78
4
+ tags: 645f666f9bcd5a90fca523b33c5a78b7
File without changes
@@ -0,0 +1,43 @@
1
+ .. rxnfit documentation master file, created by
2
+ sphinx-quickstart on Tue Mar 10 20:22:10 2026.
3
+ You can adapt this file completely to your liking, but it should at least
4
+ contain the root `toctree` directive.
5
+
6
+ rxnfit documentation
7
+ ====================
8
+
9
+ Current version: |version|, release: |release|
10
+
11
+ Overviews
12
+ --------------------------------
13
+ "rxnfit" is a Python module that builds ordinary differential equations (ODEs) for reaction kinetics from elementary reaction formulas and rate constants given in CSV format, and computes concentration time courses numerically.
14
+
15
+ - When all rate constants are known, the time evolution of each species’ concentration is obtained by **numerical integration** of the ODEs (e.g. with `scipy.integrate.solve_ivp`).
16
+ - When some rate constants are unknown, they can be **estimated by fitting** the ODE solution to experimental concentration time-course data (e.g. with `scipy.optimize.minimize`).
17
+ - A rate constant may be given as an **expression** in other rate constants (e.g. k₂ = 2·k₁), or as a **function of time** *t* via an override CSV.
18
+
19
+ **Project Link :** https://github.com/PEJpOhno/rxnfit\
20
+
21
+ **Tutorial :** in preparation
22
+
23
+ **How to cite :** Ohno, M. rxnfit. GitHub. https://github.com/PEJpOhno/rxnfit (2026).
24
+
25
+ This module and its accompanying documentation were developed with the support of Cursor’s AI-assisted tools.
26
+
27
+ .. toctree::
28
+ :maxdepth: 2
29
+ :caption: Contents:
30
+ :hidden:
31
+
32
+ rxnfit.rxn_reader
33
+ rxnfit.build_ode
34
+ rxnfit.rate_const_ft_eval
35
+ rxnfit.solv_ode
36
+ rxnfit.expdata_reader
37
+ rxnfit.expdata_fit_sci
38
+ rxnfit.p0_opt_fit
39
+ rxnfit.fit_metrics
40
+
41
+
42
+
43
+
@@ -0,0 +1,7 @@
1
+ src
2
+ ===
3
+
4
+ .. toctree::
5
+ :maxdepth: 4
6
+
7
+ rxnfit
@@ -0,0 +1,7 @@
1
+ rxnfit.build\_ode module
2
+ ========================
3
+
4
+ .. automodule:: rxnfit.build_ode
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.expdata\_fit\_sci module
2
+ ===============================
3
+
4
+ .. automodule:: rxnfit.expdata_fit_sci
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.expdata\_reader module
2
+ =============================
3
+
4
+ .. automodule:: rxnfit.expdata_reader
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.fit\_metrics module
2
+ ==========================
3
+
4
+ .. automodule:: rxnfit.fit_metrics
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.p0\_opt\_fit module
2
+ ==========================
3
+
4
+ .. automodule:: rxnfit.p0_opt_fit
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.rate\_const\_ft\_eval module
2
+ ===================================
3
+
4
+ .. automodule:: rxnfit.rate_const_ft_eval
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,25 @@
1
+ rxnfit package
2
+ ==============
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 4
9
+
10
+ rxnfit.build_ode
11
+ rxnfit.expdata_fit_sci
12
+ rxnfit.expdata_reader
13
+ rxnfit.fit_metrics
14
+ rxnfit.p0_opt_fit
15
+ rxnfit.rate_const_ft_eval
16
+ rxnfit.rxn_reader
17
+ rxnfit.solv_ode
18
+
19
+ Module contents
20
+ ---------------
21
+
22
+ .. automodule:: rxnfit
23
+ :members:
24
+ :show-inheritance:
25
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.rxn\_reader module
2
+ =========================
3
+
4
+ .. automodule:: rxnfit.rxn_reader
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ rxnfit.solv\_ode module
2
+ =======================
3
+
4
+ .. automodule:: rxnfit.solv_ode
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,123 @@
1
+ /* Compatability shim for jQuery and underscores.js.
2
+ *
3
+ * Copyright Sphinx contributors
4
+ * Released under the two clause BSD licence
5
+ */
6
+
7
+ /**
8
+ * small helper function to urldecode strings
9
+ *
10
+ * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL
11
+ */
12
+ jQuery.urldecode = function(x) {
13
+ if (!x) {
14
+ return x
15
+ }
16
+ return decodeURIComponent(x.replace(/\+/g, ' '));
17
+ };
18
+
19
+ /**
20
+ * small helper function to urlencode strings
21
+ */
22
+ jQuery.urlencode = encodeURIComponent;
23
+
24
+ /**
25
+ * This function returns the parsed url parameters of the
26
+ * current request. Multiple values per key are supported,
27
+ * it will always return arrays of strings for the value parts.
28
+ */
29
+ jQuery.getQueryParameters = function(s) {
30
+ if (typeof s === 'undefined')
31
+ s = document.location.search;
32
+ var parts = s.substr(s.indexOf('?') + 1).split('&');
33
+ var result = {};
34
+ for (var i = 0; i < parts.length; i++) {
35
+ var tmp = parts[i].split('=', 2);
36
+ var key = jQuery.urldecode(tmp[0]);
37
+ var value = jQuery.urldecode(tmp[1]);
38
+ if (key in result)
39
+ result[key].push(value);
40
+ else
41
+ result[key] = [value];
42
+ }
43
+ return result;
44
+ };
45
+
46
+ /**
47
+ * highlight a given string on a jquery object by wrapping it in
48
+ * span elements with the given class name.
49
+ */
50
+ jQuery.fn.highlightText = function(text, className) {
51
+ function highlight(node, addItems) {
52
+ if (node.nodeType === 3) {
53
+ var val = node.nodeValue;
54
+ var pos = val.toLowerCase().indexOf(text);
55
+ if (pos >= 0 &&
56
+ !jQuery(node.parentNode).hasClass(className) &&
57
+ !jQuery(node.parentNode).hasClass("nohighlight")) {
58
+ var span;
59
+ var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
60
+ if (isInSVG) {
61
+ span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
62
+ } else {
63
+ span = document.createElement("span");
64
+ span.className = className;
65
+ }
66
+ span.appendChild(document.createTextNode(val.substr(pos, text.length)));
67
+ node.parentNode.insertBefore(span, node.parentNode.insertBefore(
68
+ document.createTextNode(val.substr(pos + text.length)),
69
+ node.nextSibling));
70
+ node.nodeValue = val.substr(0, pos);
71
+ if (isInSVG) {
72
+ var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
73
+ var bbox = node.parentElement.getBBox();
74
+ rect.x.baseVal.value = bbox.x;
75
+ rect.y.baseVal.value = bbox.y;
76
+ rect.width.baseVal.value = bbox.width;
77
+ rect.height.baseVal.value = bbox.height;
78
+ rect.setAttribute('class', className);
79
+ addItems.push({
80
+ "parent": node.parentNode,
81
+ "target": rect});
82
+ }
83
+ }
84
+ }
85
+ else if (!jQuery(node).is("button, select, textarea")) {
86
+ jQuery.each(node.childNodes, function() {
87
+ highlight(this, addItems);
88
+ });
89
+ }
90
+ }
91
+ var addItems = [];
92
+ var result = this.each(function() {
93
+ highlight(this, addItems);
94
+ });
95
+ for (var i = 0; i < addItems.length; ++i) {
96
+ jQuery(addItems[i].parent).before(addItems[i].target);
97
+ }
98
+ return result;
99
+ };
100
+
101
+ /*
102
+ * backward compatibility for jQuery.browser
103
+ * This will be supported until firefox bug is fixed.
104
+ */
105
+ if (!jQuery.browser) {
106
+ jQuery.uaMatch = function(ua) {
107
+ ua = ua.toLowerCase();
108
+
109
+ var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
110
+ /(webkit)[ \/]([\w.]+)/.exec(ua) ||
111
+ /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
112
+ /(msie) ([\w.]+)/.exec(ua) ||
113
+ ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
114
+ [];
115
+
116
+ return {
117
+ browser: match[ 1 ] || "",
118
+ version: match[ 2 ] || "0"
119
+ };
120
+ };
121
+ jQuery.browser = {};
122
+ jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
123
+ }