bindtools 0.1.2__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bindtools
3
- Version: 0.1.2
3
+ Version: 0.1.3
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
@@ -14,7 +14,7 @@ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
14
14
  Requires-Dist: arviz==0.21.0
15
15
  Requires-Dist: corner==2.2.3
16
16
  Requires-Dist: emcee==3.1.6
17
- Requires-Dist: h5py==3.13.0
17
+ Requires-Dist: h5py>=3.14.0
18
18
  Requires-Dist: lmfit==1.3.3
19
19
  Requires-Dist: matplotlib==3.10.7
20
20
  Requires-Dist: numba>=0.65.1
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "bindtools"
7
- version = "0.1.2"
7
+ version = "0.1.3"
8
8
  readme = "README.md"
9
9
  classifiers = [
10
10
  # How mature is this project? Common values are
@@ -30,7 +30,7 @@ dependencies = [
30
30
  "arviz==0.21.0",
31
31
  "corner==2.2.3",
32
32
  "emcee==3.1.6",
33
- "h5py==3.13.0",
33
+ "h5py>=3.14.0",
34
34
  "lmfit==1.3.3",
35
35
  "matplotlib==3.10.7",
36
36
  "numba>=0.65.1",
@@ -97,9 +97,9 @@ def getConcsScipy(eqMat, initComponentConc, logK, alg="L-BFGS-B"):
97
97
  eqMat = eqMat.astype("float64")
98
98
  K = 10.0**logK
99
99
  guessCompConc = np.zeros(len(initComponentConc)) + np.mean(initComponentConc)
100
- guessLogCompConc = np.log(guessCompConc)
100
+ guessLogCompConc = np.log10(guessCompConc)
101
101
 
102
- bds = [(None, np.log(np.max(initComponentConc))) for _ in range(len(guessLogCompConc))]
102
+ bds = [(None, np.log10(np.max(initComponentConc))) for _ in range(len(guessLogCompConc))]
103
103
  # jac=True says that specObj returns float,arr(n) where arr(n) is the Jacobian
104
104
  res = sp.optimize.minimize(
105
105
  specObj,
@@ -112,7 +112,7 @@ def getConcsScipy(eqMat, initComponentConc, logK, alg="L-BFGS-B"):
112
112
  options={"gtol": 1e-20},
113
113
  )
114
114
 
115
- compTotCalc, specConc = specCalc(np.exp(res.x), len(K), eqMat, K)
115
+ compTotCalc, specConc = specCalc(10**(res.x), len(K), eqMat, K)
116
116
  return specConc
117
117
 
118
118
 
@@ -150,7 +150,7 @@ def _specJac(ncomp, eqMat, speciesConc): # this function calculates the Jacobia
150
150
 
151
151
 
152
152
  def specObj(logConc, initComponentConc, eqMat, K):
153
- conc = np.exp(logConc)
153
+ conc = 10**(logConc)
154
154
  nspecies = len(K)
155
155
  compTotCalc, specConc = specCalc(conc, nspecies, eqMat, K)
156
156
 
@@ -567,15 +567,29 @@ def fitfun(params, fcn_opts): # ,eqMat,specConcs,startShifts=None,sigma=1,ret='
567
567
 
568
568
  bindingParams = np.array([*parvals][: fcn_opts["nK"]], dtype=np.float64)
569
569
  error = False
570
- specCalc = []
571
- for row in fcn_opts["compConcs"]:
572
- try:
573
- yEq = getConcs(fcn_opts["eqMat"], row, bindingParams)
574
- except EquilibriumError as e:
575
- yEq = e.val
576
- error = True
577
- specCalc.append(yEq) # yEq[4:])
578
- specCalc = np.array(specCalc)
570
+
571
+ analytical_topology = fcn_opts.get("analytical_topology")
572
+ if analytical_topology in ("1:1", "1:2", "2:1"):
573
+ comp_concs = np.array(fcn_opts["compConcs"], dtype=float)
574
+ complex_indices = [int(x) for x in fcn_opts.get("analytical_complex_indices", [])]
575
+ specCalc, error = calc_analytical_speciation(
576
+ comp_concs=comp_concs,
577
+ eq_mat=np.array(fcn_opts["eqMat"], dtype=float),
578
+ binding_params=bindingParams,
579
+ topology=str(analytical_topology),
580
+ n_comp=int(comp_concs.shape[1]),
581
+ complex_indices=complex_indices,
582
+ )
583
+ else:
584
+ specCalc = []
585
+ for row in fcn_opts["compConcs"]:
586
+ try:
587
+ yEq = getConcs(fcn_opts["eqMat"], row, bindingParams)
588
+ except EquilibriumError as e:
589
+ yEq = e.val
590
+ error = True
591
+ specCalc.append(yEq) # yEq[4:])
592
+ specCalc = np.array(specCalc)
579
593
  # except EquilibriumError as e:
580
594
  # if fcn_opts['ret'] == 'residual':
581
595
  # return 1000
File without changes