Hi! I have to fit a blackbody spectrum to some data points. The y axis is in mJy and the x axis is in log_10(freq). My code looks like this: from __future__ import division import matplotlib.pyplot as plt import numpy as np from scipy.optimize import curve_fit h = 6.63*10**(-34) c = 3.0*10**8 k = 1.38*10**(-23) pi = 3.14159265 scale_y = 1.5*10**13 def func(x,T): f=scale_y*8*pi*h/(c**3)*(np.power(10,x))**3/(np.exp(h*np.power(10,x)/(k*T))-1) return f popt,pcov=curve_fit(func,frec, Flux) print (popt) freq and Flux are the lists with the x and y data and I need to find T. Just by eye T should be around 10000K. But when I run the program I get this error RuntimeWarning: overflow encountered in exp f=scale_y*8*pi*h/(c**3)*(np.power(10,x))**3/(np.exp(h*np.power(10,x)/(k*T))-1) and I am not sure why, because for T=10000k the value of exp should be just fine. Any idea? Thank you!