Releases: andresmegias/richvalues
RichValues 4.2
Minor update of RichValues, that mainly allows formatting rich values and adds optional improvements of the PDFs.
List of changes
- Rich values can now be formatted inside a string. For example. if
x
is a rich value, one can write'{:.2f}'.format(x)
orf'{x:.2f}'
. In this case, the main value will be displayed. One can also writefloat(x)
orint(x)
, which would return the main value converted to a float or an int, respectively. - There are two new optional parameters that allow for an alternative PDF representation of rich values with asymmetric uncertainties, based on split normal distributions and generative extreme value (GEV) distributions. It will only work for cases with amplitudes large enough and low or medium asymmetries, as explained in the user guide, and it will increase the computation time. The corresponding default parameters are
use split normal distributions to model rich values
anduse generative extreme value distributions to model rich values
. The motivation was to avoid bimodal distributions and obtain smoother shapes than with the default asymmetric bounded normal distributions. In any case, the original default PDFs are already fulfilling our requirements with respect to the median and the 1-σ confidence interval. This new feature was based on the following work by Antonio Possolo et al. (2019): https://iopscience.iop.org/article/10.1088/1681-7575/ab2a8d/. - Minor improvements and bug fixes.
RichValues 4.1
Minor update of RichValues 4, which adds a new way of displaying rich values, adds the function distr_with_rich_arrays
, and improves the conversion from dataframes to LaTeX format.
List of changes
- There is a new way of representing rich values, valid both for creating a rich value and for displaying it, for centered values. It consist on writing the central value and then the uncertainty (or uncertainties) between parenthesis. It is specially suited for values with very low uncertainties. For example:
1.000436(21)
,42103(8)
, which would be equivalent to1.000436 +/- 0.000021
and42103 +/- 8
, respectively. - There is a new function,
distr_with_rich_arrays
, which is equivalent todistr_with_rich_values
, but accepting rich arrays as an input, similarly asfunction_with_rich_arrays
. - In the method
latex()
for displaying rich dataframes in LaTeX format, there are two new arguments:export_frame
andexport_index
. - In the method
latex()
for displaying rich values/arrays/dataframes in LaTeX format , the argumentdollar
is now calledshow_dollars
. - The default parameter
sigmas to define upper/lower limits
is now calledsigmas to define upper/lower limits from read values
. - Minor improvements and bug fixes.
RichValues 4.0
Second major update for the library, which leads to version 4.0. Several new features have been added: rich values of integer nature, with complex numbers, and with custom probability density function (PDF). The new changes have been reflected in the new version of the user guide.
List of changes
- Rich values of integer nature are now supported, through the
is_int
argument of theRichValue
class and therich_value
andrich_array function
, and also the argumentare_ints
of theRichArray
class. - Rich values can be now created from a PDF, in the form of a function or a set of values. The information of the PDF is stored in the rich value and can be preserved when doing operations, specially with the
save_pdf
argument of the functionsevaluate_distr
andfunction_with_rich_values
. In this way, this library can be used to operate just with PDFs instead of specifying central values with uncertainties, upper/lower limits or finite ranges of values. - Complex rich values are now supported through the
ComplexRichValue
class, and can be created also with therich_value
function. - Two new attributes called
is_exact
andis_const
have been added to theRichValue
class (and equivalently toRichArray
,RichDataFrame
andRichSeries
classes). - Functions that have a cyclic domain, like inverse trigonometric functions, can now be properly evaluated using a new argument of
evaluate_distr
andfunction_with_rich_values
calledis_domain_cyclic
. - Integer division (
//
) and module (%
) are now supported operations for rich values. - Some new default parameters have been added, and now there is another way of updating those values with the function
set_default_params
and to restore them with the functionrestore_default_params
. - In the functions
curve_fit
andpoint_fit
, the argumentconsider_intervs
has been renamed toconsider_arg_intervs
, as now there is another argument calledconsider_param_intervs
. - Several minor improvements and bug fixes have been done.
RichValues 3.1
Minor update of RichValues 3, which mainly corrects several little bugs.
List of changes
- The limit for extra significant figure, from the default parameters, is now added as an instance variable to the
RichValue
class,extra_sf_lim
, so that it can be changed individually for any rich value. Similarly,RichValue
,RichDataFrame
andRichSeries
now have the attributeextra_sf_lims
. - The parsing of rich values from plain text has new capabilities. The minimum exponent for scientific notation is automatically inferred now. Also, the limit for extra significant figure can now be automatically inferred in case it is lower than the default value; this can be disabled to reduce the reading time a little bit with the argument
use_default_extra_sf_lim
from the functionsrich_value
,rich_array
andrich_dataframe
. - Minor improvements and bug fixes.
RichValues 3.0
Second major update for the library, which leads to version 3.0. Several improvements have been done, specially regarding the RichDataFrame
class and the treatment of correlation between variables of rich values. The user guide has been updated with the new features and modifications.
List of changes
- Correlation between variables are now taken into account when performing operations with rich values. To do so,
RichValue
objects now store information on its dependence with independent variables. Every time aRichValue
object is created, an arbitrary name is assigned to it, stored in the instance variablesvars
andexpression
. Then, if an operation is applied to it and a new rich value is created, the mathematical expression of this new rich value with respect to the previous ones is stored in the instance variableexpression
. Additionally, the instance variablevars
will store the names of the independent variables involved inexpression
. In order to implement this, a new way of specifying functions to be applied to rich values has been added, and it is now the recommended way. It consists on supplying a text string describing the source code of the function, instead of directly passing the Python function; see the user guide (section 4.1.3) for more details. - Most of the methods of the
RichValue
andRichArray
classes that returned a property of a rich value have been converted into class attributes. This means that now they are called without using parenthesis. For example, to access to the main values of theRichArray
objectv
now you would just writev.mains
instead ofv.mains()
. - The
RichDataFrame
class has been vastly improved. First of all, nowRichDataFrame
objects always preserve its class when any Pandas'DataFrame
class method is applied (before this version, aDataFrame
object was returned instead). Besides, all the attributes from theRichArray
class have been implemented, which can be used to better inspect the dataframe. In order to do so, a new class calledRichSeries
have been added, which is just an implementation of Pandas'Series
class with all the attributes from theRichArray
class. - Applying comparison operators (
<
,<
,==
,!=
,<=
,>=
) between rich values is now supported. The comparisons are based on theinterval
method of theRichValue
class. Related with this, a few functions to compare rich values/arrays have been added:greater
,less
,equiv
,greater_equiv
,less_equiv
. - The absolute value operator (
abs
) can now be applied to rich values. - The functions
curve_fit
andpoint_fit
now also estimate the real dispersion between the input data and the fitted model. Moreover, now they also return the final mean loss after the fit, as a rich value. Lastly, some of the names of the outputs of these functions have been renamed. - Several minor improvements and bug fixes within different parts of the code.
RichValues 2.0
First major update for the library, which leads to version 2.0. The user guide has been updated with the new features and modifications.
List of changes
- The mathematical function that defines the probability density function (PDF) of any rich value has been changed. Now there is only one base function, the bounded gaussian, which has an exact formula. Hence, no numeric relation is needed for computing the PDF. Additionally, an interpolation based on the cosine function has been implemented to make a smooth transition between the two halfs of the PDF, when having asymmetrical uncertainties and/or asymmetrical amplitudes.
- Most of the argument names, instance variables and methods regarding the creation of rich values have now aliases, which correspond to their full names.
- The code of the
round_sf_unc
function has been rewritten, simplifying the function considerably. - The method
norm_unc
(normalized uncertainty) has been added to theRichValue
class (and the same goes fornorm_uncs
for theRichArray
class. - Some minor improvements and bug fixes.
RichValues 1.2
Release of the second minor update of the library. The user guide has been updated with the new features and modifications.
List of changes
- Some of the arguments of the functions and classes used to create rich values have been removed. In the case of
num_sf
andmin_exp
, they can be modified changing the same-name attributes of theRichValue
object. In the case ofallow_log_scale
, it has been removed for the sake of simplicity. - The main value of the
RichValue
class has been renamed fromcenter
tomain
. For theRichArray
class, the methodcenters
has been renamed tomains
. However, a new method calledcenter
has been added to theRichValue
class (andcenters
forRichArray
), that returns the centers of only the rich values that have a main value with uncertainty (centered values). Also, the methodsis_centr
andare_centr
have been added, they indicate if the corresponding rich value is a centered value. - The
RichArray
class has been improved. Now, a different domain for every entry is possible, and all of its properties should be accessed through methods. To set some of these properties with a unique value, a new method calledset_params
can be used. - The criterion for applying approximate uncertainty propagation has been improved. Related with this, some methods have been added to the
RichValue
andRichArray
classes, mainlysignal_noise
andprop_factor
. - Some minor renaming has been applied through the classes and functions of the library.
- Added some minor improvements and bug fixes.
RichValues 1.1
Release of the first minor update of the library. The user guide has been updated with the new features and modifications.
List of changes
- Added a function called
errorbar
for easily plotting rich values, which is basically an implementation of Matplotlib'serrorbar
function. - Added functions for fitting rich values to a model, obtaining model parameters as rich values, called
point_fit
andcurve_fit
; they are based on SciPy'sminimize
function, from theoptimize
submodule. - Improved function
function_with_rich_values
, which now supports non element-wise operations, with a variable number of outputs. - Added some methods for the
RichValue
andRichArray
classes, mainlyinterval
andis_interval
forRichValue
and equivalent ones forRichArray
. - Some attributes for the
RichArray
class were transformed into methods to improve consistency when editing the elements ofRichArray
objects; these modified attributes are mainlycenters
,uncs
,are_lolims
,are_uplims
andare_ranges
, which are now methods. - Improved function
evaluate_distr
, which is now called insidefunction_with_rich_values
. - Added shortened names / aliases for the following functions:
rich_value
:rval
.rich_array
:rarray
.rich_dataframe
:rich_df
.function_with_rich_values
:function
.function_with_rich_arrays
:array_function
.
- Added some minor improvements and bug fixes.
RichValues 1.0
Initial release of the library.
You can check the user guide of this version to see its features and capabilities.