I want a function that given a measurement and the error estimate, will round the error to a specified number of significant figures, and round the measurement value to the corresponding digit. Here is an example of inputs and expected outputs:
>>> g = 6.6740813489701e-11
>>> g_err = 0.0003133212341e-11
>>> round_sig_figs(g, g_err, sig_figs=2)
(6.67408e-11, 3.1e-15)
Typically errors are reported with 2 significant figures. I want a function that will return a value's error estimate with this level of precision and also truncate the value to the correct decimal place.