postinfer.report.pdg#

exp_of_first_sigfig(value: float) int[source]#

Get the exponent of the first significant figure of a number.

Parameters:
valuefloat

The input number.

Returns:
int

The exponent of the first significant figure.

round_err_pdg(err: float) tuple[float, int][source]#

Round the error based on PDG convention [1].

Parameters:
errfloat

The error value.

Returns:
float, int

The err to display, and the exponent of last precise digit.

References

round_pdg(value: float, err: float, err2: float | None = None, exp10: int | None = None, no_sci_nota_exp10_range: tuple[int, int] = (-1, 2), force_asymmetric: bool = False) str[source]#

Round the value and error based on PDG convention [1].

The PDG convention states that:

If the three highest order digits of the error lie between 100
and 354, we round to two significant digits. If they lie between
355 and 949, we round to one significant digit. Finally, if they
lie between 950 and 999, we round up to 1000 and keep two
significant digits.

In cases where there are asymmetric errors, if these errors differ
by less than 10 percent of the average of the two errors, the average
of the two errors is instead used as a symmetric error in the
displayed result and the rounding is determined by this average.
Otherwise, the narrower of the two asymmetric errors is used to
determine the rounding on both.
Parameters:
valuefloat

The value to be rounded.

errfloat

The error value.

err2float, optional

If provided, the err is considered as the lower error, and err2 as the upper error.

exp10int, optional

The exponent to display. If not provided, it will be determined based on the value and error.

no_sci_nota_exp10_rangetuple of int, optional

If the exponent of the last digit of errors is in this range, then the result will not be formatted in scientific notation. If exp10 is provided, it will be ignored. The default is (-1, 2).

force_asymmetricbool, optional

If True, the asymmetric errors will be formatted as asymmetric, regardless of the difference between the two errors. The default is False.

Returns:
str

The rounded value and error formatted in LaTeX.

References