Skip to main content

A package for computing derived data with errors

Project description

regularization_derivative

This package is supposed to be used to find derived data with errors. It allows you to find derivatives of data using the regularization method and errors of derivatives using the Monte Carlo method.

Installation

This package is to be used with Python 3.x.x

To install tha package write

pip install regularization_derivative

Usage

To use the package in your project, import it in by writing

from regularization_derivative import regularization_derivative

Parameters of the function

regularization(height, t_height, err_height, alpha, ord, print_parameters=True, mk=False, num_mk=100)

Based on a set of coordinates of points and errors, it obtains the coordinates of points of derivatives by the regularization method, as well as the errors of these points by the Monte Carlo method.

Parameters:

  • height : array_like

Array of y-coordinates of points by which the derivative will be calculated

  • t_height : array_like

Array of x-coordinates of points by which the derivative will be calculated

  • err_height : array_like

Array of error y-coordinates of points by which the derivative will be calculated

  • alpha : float

Regularization parameter

  • ord : int (1, 2 or 3)

Order of differentiation operator

  • print_parametrs : boolean

Displays the parameters needed to select the regularization parameter alpha

  • mk : boolean

Calculates the errors of the obtained points-derivatives by the Monte Carlo method

  • num_mk : int

Number of iterations in the Monte Carlo method

Recommendations for use

Selection of the regularization parameter alpha

The main problem of using this method is the selection of the alpha parameter. To choose it correctly, you need to look at the value indicated in the program as quotient

$$ quotient = \frac{| A \vec{u} - \stackrel{\wedge}{y} |^2}{| \delta y | | ^2} $$

In theory, the optimal value of the above expression is equal to one. But in practice it is often difficult to obtain such an ideal case, and sometimes it is not only impossible, but also unnecessary. In this case, you should be guided by the principle:

Note : The closer quotient is to zero, the better the resulting curve will fit the data. The closer quotient is to one, the smoother the resulting curve will be.

Warning : alpha for any particular task can be very different from about 1e1 to 1e20, so when choosing, first determine the power.

Choice of the order of the differentiation operator ord

As part of our task, we wanted to obtain a smooth acceleration function from the distance versus time data. The curve is smooth if the function has a continuous derivative, then in our case the order of the differentiation operator ord is 3, since the acceleration is the second derivative of the coordinate, and it must be smooth. Accordingly, to speed up the order of the differentiation operator ord = 2.

Using the Monte Carlo method

The regularization method is not provided with tools for estimating the errors of derivatives, so the Monte Carlo method was used for these purposes. To use it a large number of times, a set of points is created for the distance within the error limits, and then the speed is calculated by the regularization method.

To use it, you need to set the function parameters mk = True and set the number of iterations num_mk

Warning : Due to the peculiarities of the method of searching for smooth functions, the errors on the "tails" are much larger than in the middle. If you have a lot of points, then you can remove such points at the ends from consideration, since their errors will be somewhat overestimated.

Examples of using

Examples of using the code on mathematical functions and on solar events can be viewed on github.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regularization_derivative-0.0.2-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file regularization_derivative-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for regularization_derivative-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 af4075063e224483d8da91bed033a67f3bf49ce6fbb3408305b1a2f9e85432d4
MD5 9236a2598eea9813b505b4978f947419
BLAKE2b-256 d6145595f10595aaa7434daa7c36577723a4bb2479abee1d2d8d7521e692b7bf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page