bindtools 0.3.1__tar.gz → 0.3.2__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 (27) hide show
  1. {bindtools-0.3.1 → bindtools-0.3.2}/PKG-INFO +1 -1
  2. {bindtools-0.3.1 → bindtools-0.3.2}/pyproject.toml +1 -1
  3. {bindtools-0.3.1 → bindtools-0.3.2}/pyproject.toml.orig +1 -1
  4. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/binding_model.py +31 -8
  5. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/transforms.py +4 -0
  6. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/types.py +2 -0
  7. {bindtools-0.3.1 → bindtools-0.3.2}/README.md +0 -0
  8. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/__init__.py +0 -0
  9. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/binding.py +0 -0
  10. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/exceptions.py +0 -0
  11. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/io/__init__.py +0 -0
  12. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/io/export.py +0 -0
  13. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/__init__.py +0 -0
  14. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/helpers.py +0 -0
  15. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/likelihood.py +0 -0
  16. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/sampler.py +0 -0
  17. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/__init__.py +0 -0
  18. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/objective.py +0 -0
  19. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/simulation.py +0 -0
  20. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/__init__.py +0 -0
  21. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/__init__.py +0 -0
  22. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/fit_plots.py +0 -0
  23. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/mcmc_plots.py +0 -0
  24. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/__init__.py +0 -0
  25. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/analytical.py +0 -0
  26. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/numerical.py +0 -0
  27. {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/scipy_solver.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bindtools
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Keywords: chemistry,analytical chemistry,binding constants,supramolecular
5
5
  Author: Martin Peeks
6
6
  Author-email: Martin Peeks <martinp23@googlemail.com>, m.peeks@unsw.edu.au
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "bindtools"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  readme = "README.md"
9
9
  classifiers = [
10
10
  "Development Status :: 3 - Alpha",
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "bindtools"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  readme = "README.md"
9
9
  classifiers = [
10
10
  # How mature is this project? Common values are
@@ -10,11 +10,12 @@ from bindtools.models.objective import fitfun
10
10
  class bindingModel:
11
11
  def __init__(
12
12
  self,
13
- eqMat,
14
- compNames,
15
- speciesList,
16
- specToInteg=None,
17
- specToDd=None,
13
+ eqMat: np.ndarray,
14
+ compNames: List[str],
15
+ speciesList: List[str],
16
+ specToInteg: Optional[np.ndarray|List]=None,
17
+ specToDd: Optional[List|np.ndarray]=None,
18
+ specToLinear: Optional[List|np.ndarray]=None,
18
19
  colToComp=None,
19
20
  obsList=None,
20
21
  rawData=None,
@@ -48,7 +49,7 @@ class bindingModel:
48
49
 
49
50
  self.concUnits = None # mM #TODO
50
51
  self.specToDd = specToDd
51
- self.specToLinear: Optional[np.ndarray] = None # (n_species, n_obs) object array for UV-vis / fluorescence
52
+ self.specToLinear: Optional[List] = specToLinear # (n_species, n_obs) object array for UV-vis / fluorescence
52
53
  self.analytical_fast_exchange: bool = False
53
54
  self.analytical_topology: Optional[str] = None
54
55
  self.analytical_complex_indices: list[int] = []
@@ -142,8 +143,30 @@ class bindingModel:
142
143
 
143
144
  # Register UV-vis / fluorescence parameters from specToLinear (object array).
144
145
  if self.specToLinear is not None:
145
- for _, x in np.ndenumerate(self.specToLinear):
146
- if isinstance(x, lmfit.Parameter):
146
+ # Coerce list or 1D array to 2D object array safely
147
+ if not isinstance(self.specToLinear, np.ndarray) or self.specToLinear.dtype != object:
148
+ raw_list = list(self.specToLinear)
149
+ if len(raw_list) > 0 and isinstance(raw_list[0], (list, tuple, np.ndarray)):
150
+ # Already 2D-like
151
+ rows, cols = len(raw_list), len(raw_list[0])
152
+ arr = np.empty((rows, cols), dtype=object)
153
+ for r in range(rows):
154
+ for c in range(cols):
155
+ arr[r, c] = raw_list[r][c]
156
+ else:
157
+ # 1D-like -> reshape to (n_species, 1)
158
+ arr = np.empty((len(raw_list), 1), dtype=object)
159
+ for r, val in enumerate(raw_list):
160
+ arr[r, 0] = val
161
+ self.specToLinear = arr
162
+ elif self.specToLinear.ndim == 1:
163
+ self.specToLinear = self.specToLinear[:, None]
164
+ # Register parameters (supporting both lmfit.Parameter and (min, init, max[, name]) tuples)
165
+ for ii, x in np.ndenumerate(self.specToLinear):
166
+ if isinstance(x, tuple):
167
+ param_name = x[3] if len(x) > 3 else f"lin_{ii[0]}_{ii[1]}"
168
+ self._addParam(param_name, x[1], min=x[0], max=x[2])
169
+ elif isinstance(x, lmfit.Parameter):
147
170
  self._addExistingParam(x)
148
171
 
149
172
  # add chemical shift fitting params
@@ -46,6 +46,10 @@ def concToLinearObs(
46
46
 
47
47
  Returns an ndarray of shape (n_pts, n_obs).
48
48
  """
49
+
50
+ if hasattr(specToLinear, "ndim") and specToLinear.ndim == 1:
51
+ specToLinear = specToLinear[:, None]
52
+
49
53
  mlen, nlen = np.shape(specToLinear) # (n_species, n_obs)
50
54
  specToLinearTrial = np.copy(specToLinear)
51
55
 
@@ -43,6 +43,8 @@ class ObsType:
43
43
  self.param = lmfit.Parameter("lnsigmaFluorescence", value=-4, vary=True, min=-8, max=0)
44
44
 
45
45
  else:
46
+ print("Unknown observable type. Using default units and parameter name.")
47
+
46
48
  self.units = units
47
49
  self.param = lmfit.Parameter("lnsigma" + name)
48
50
 
File without changes