pyEQL 0.12.2__py2.py3-none-any.whl → 0.14.0__py2.py3-none-any.whl

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.
pyEQL/salt_ion_match.py CHANGED
@@ -7,7 +7,7 @@ salts. This mapping is necessary because some parameters (such as activity
7
7
  coefficient data) can only be determined for salts (e.g. NaCl) and not individual
8
8
  species (e.g. Na+)
9
9
 
10
- :copyright: 2013-2023 by Ryan S. Kingsbury
10
+ :copyright: 2013-2024 by Ryan S. Kingsbury
11
11
  :license: LGPL, see LICENSE for more details.
12
12
 
13
13
  """
@@ -25,22 +25,17 @@ class Salt(MSONable):
25
25
  Create a Salt object based on its component ions.
26
26
 
27
27
  Parameters:
28
- ----------
29
- cation, anion : str
30
- Chemical formula of the cation and anion, respectively
28
+ cation, anion: (str) Chemical formula of the cation and anion, respectively.
31
29
 
32
- Returns
33
- -------
34
- Salt : An object representing the properties of the salt
30
+ Returns:
31
+ Salt : An object representing the properties of the salt
35
32
 
36
33
  Examples:
37
- --------
38
- >>> Salt('Na+','Cl-').formula
39
- 'NaCl'
40
-
41
- >>> Salt('Mg++','Cl-').formula
42
- 'MgCl2'
34
+ >>> Salt('Na+','Cl-').formula
35
+ 'NaCl'
43
36
 
37
+ >>> Salt('Mg++','Cl-').formula
38
+ 'MgCl2'
44
39
  """
45
40
  # create pymatgen Ion objects
46
41
  pmg_cat = Ion.from_formula(cation)
@@ -95,24 +90,21 @@ class Salt(MSONable):
95
90
  # Mg+2 is converted to monovalent complexes like MgOH+. Hence, the activity coefficients deviate a bit from
96
91
  # the published values.
97
92
  def get_effective_molality(self, ionic_strength):
98
- """Calculate the effective molality according to [mistry]_.
93
+ r"""Calculate the effective molality according to [mistry]_.
99
94
 
100
- .. math:: 2 I \\over (\\nu_+ z_+^2 + \\nu_- z_- ^2)
95
+ .. math:: 2 I \over (\nu_+ z_+^2 + \nu_- z_- ^2)
101
96
 
102
- Parameters
103
- ----------
104
- ionic_strength: Quantity
105
- The ionic strength of the parent solution, mol/kg
97
+ Args:
98
+ ionic_strength: Quantity
99
+ The ionic strength of the parent solution, mol/kg
106
100
 
107
- Returns
108
- -------
109
- Quantity: the effective molality of the salt in the parent solution
101
+ Returns:
102
+ Quantity: the effective molality of the salt in the parent solution
110
103
 
111
- References
112
- ----------
113
- .. [mistry] Mistry, K. H.; Hunter, H. a.; Lienhard V, J. H. Effect of composition and nonideal solution behavior
114
- on desalination calculations for mixed electrolyte solutions with comparison to seawater. Desalination
115
- 2013, 318, 34-47.
104
+ References:
105
+ .. [mistry] Mistry, K. H.; Hunter, H. a.; Lienhard V, J. H. Effect of composition and nonideal solution behavior
106
+ on desalination calculations for mixed electrolyte solutions with comparison to seawater. Desalination
107
+ 2013, 318, 34-47.
116
108
  """
117
109
  m_effective = 2 * ionic_strength / (self.nu_cation * self.z_cation**2 + self.nu_anion * self.z_anion**2)
118
110
 
pyEQL/solute.py CHANGED
@@ -7,7 +7,7 @@ ONLY those properties that DO NOT depend on solution composition.
7
7
  Solute properties such as activity coefficient or concentration
8
8
  that do depend on compsition are accessed via Solution class methods.
9
9
 
10
- :copyright: 2013-2023 by Ryan S. Kingsbury
10
+ :copyright: 2013-2024 by Ryan S. Kingsbury
11
11
  :license: LGPL, see LICENSE for more details.
12
12
 
13
13
  """
@@ -32,19 +32,23 @@ class Datum:
32
32
 
33
33
  @property
34
34
  def magnitude(self):
35
+ """Return the numerical value of a Datum."""
35
36
  return float(self.value.split(" ")[0])
36
37
 
37
38
  @property
38
39
  def unit(self):
40
+ """Return the unit of a Datum."""
39
41
  return self.value.split(" ")[-1]
40
42
 
41
43
  @property
42
44
  def uncertainty(self):
45
+ """Return the uncertainty of a Datum."""
43
46
  if len(self.value.split(" ")) > 3:
44
47
  return float(self.value.split(" ")[2])
45
48
  return np.nan
46
49
 
47
50
  def as_dict(self):
51
+ """Return a dictionary representation of the Datum."""
48
52
  return dict(asdict(self).items())
49
53
 
50
54
 
@@ -55,9 +59,8 @@ class Solute:
55
59
  transport numbers, concentration, activity, etc.
56
60
 
57
61
  Args:
58
- formula : str
59
- Chemical formula for the solute.
60
- Charged species must contain a + or - and (for polyvalent solutes) a number representing the net charge (e.g. 'SO4-2').
62
+ formula: Chemical formula for the solute. Charged species must contain a + or - and (for polyvalent solutes)
63
+ a number representing the net charge (e.g. 'SO4-2').
61
64
  """
62
65
 
63
66
  formula: str
@@ -137,6 +140,7 @@ class Solute:
137
140
  )
138
141
 
139
142
  def as_dict(self):
143
+ """Return a dictionary representation of the Solute."""
140
144
  return dict(asdict(self).items())
141
145
 
142
146
  # set output of the print() statement