adds mypy to test command and adds fixes for flake issues
Some checks failed
gitea-physics/pysuperconductor/pipeline/head There was a failure building this commit

This commit is contained in:
Deepak Mallubhotla 2020-11-24 12:45:04 -06:00
parent 83a58a5a54
commit cb5a681117
Signed by: deepak
GPG Key ID: 64BF53A3369104E7
2 changed files with 16 additions and 5 deletions

1
do.sh
View File

@ -12,6 +12,7 @@ build() {
test() {
echo "I am ${FUNCNAME[0]}ing"
poetry run flake8
poetry run mypy pysuperconductor
poetry run pytest
}

View File

@ -1,20 +1,30 @@
import numpy # type: ignore
import scipy.integrate as integrate # type: ignore
import scipy.optimize # type: ignore
import numpy # type: ignore
import scipy.integrate as integrate # type: ignore
import scipy.optimize # type: ignore
def energy(freq: float, delta: float) -> float:
return numpy.sqrt(freq ** 2 + delta ** 2)
def gap_integrand_function(xi: float, temp: float, delta: float, mu_star: float) -> float:
def gap_integrand_function(
xi: float,
temp: float,
delta: float,
mu_star: float
) -> float:
big_e = energy(xi, delta)
if temp == 0:
return (1 / (2 * big_e)) * (2 * numpy.heaviside(big_e - mu_star, .5) - 1)
return numpy.tanh((big_e - mu_star) / (2 * temp)) / (2 * big_e)
def gap_integral(temp: float, delta: float, mu_star: float, debye_frequency: float) -> float:
def gap_integral(
temp: float,
delta: float,
mu_star: float,
debye_frequency: float
) -> float:
def integrand(xi: float) -> float:
# the 2 here is to account for the symmetry in the integration range
# to cut the integral to zero to omega_debyeh