import numpy as np

def compute_time(Nside_query):
	a = np.genfromtxt("./performance_healpix_mask.txt", dtype=[("type","S3"),("Nside", "i"),("cpu","f")])

	la = np.log10(a['Nside'])
	lb = np.log10(a['cpu'])

	da = (la - np.average(la))
	db = (lb - np.average(lb))

	Slope = (da*db).sum()/(da**2).sum()
	Ofs = np.average(lb) - Slope*np.average(la)

	TimeGot = 10**(np.log10(Nside_query)*Slope+Ofs)

	print "Nside=%d -> Time= %lg hours" % (Nside_query, TimeGot/3600.)


compute_time(512)
compute_time(1024)
