Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dsharp_opac/dsharp_opac.py
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,8 @@ def nk(self, lam):
k : float
: imaginary part of mixed optical property
"""
from mpmath import findroot
from scipy.optimize import newton

l_arr = np.array(lam, ndmin=1)
eps_mean = np.empty(np.shape(l_arr)).astype('complex')

Expand All @@ -1439,7 +1440,7 @@ def nk(self, lam):
#
def fct(x):
return sum(self.abundances * ((eps - x) / (eps + 2 * x)))
eps_mean[i] = complex(findroot(fct, complex(0.5, 0.5)))
eps_mean[i] = newton(fct, x0=(0.5 + 0.5j))
elif self.rule.lower() == 'maxwell-garnett':
#
# kataoka et al. 2014, eq. 3
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ dependencies = [
"scipy>=1.13.0",
"matplotlib>=3.8.0",
"astropy>=7.0.0",

# only need mpmath.findroot, which I suspect scipy.optimize.fsolve can replace
"mpmath>=1.3.0",
]

[project.urls]
Expand Down