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.
- {bindtools-0.3.1 → bindtools-0.3.2}/PKG-INFO +1 -1
- {bindtools-0.3.1 → bindtools-0.3.2}/pyproject.toml +1 -1
- {bindtools-0.3.1 → bindtools-0.3.2}/pyproject.toml.orig +1 -1
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/binding_model.py +31 -8
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/transforms.py +4 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/types.py +2 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/README.md +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/binding.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/exceptions.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/io/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/io/export.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/helpers.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/likelihood.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/mcmc/sampler.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/objective.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/models/simulation.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/observables/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/fit_plots.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/plotting/mcmc_plots.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/__init__.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/analytical.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/numerical.py +0 -0
- {bindtools-0.3.1 → bindtools-0.3.2}/src/bindtools/speciation/scipy_solver.py +0 -0
|
@@ -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[
|
|
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
|
-
|
|
146
|
-
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|