return int(round(n[0]))

def sample_power_difftest(d, s, power=0.8, sig=0.05):
    z = norm.isf([sig / 2])
zp = -1 * norm.isf([power])
n = s * (zp + z) ** 2 / d ** 2
return int(round(n[0]))
if __name__ == '__main__':
    n = sample_power_probtest(0.1, 0.11, power=0.8, sig=0.05)
print(n)
n = sample_power_difftest(0.1, 0.5, power=0.8, sig=0.05)
print(n)
Is there a python (scipy) function to determine parameters needed to obtain a target power?