Expected duration: less than 1 week I need a python script which finds the transfer function between the discrete frequency distributions of two variables alpha and beta. The variables alpha and beta describe angles (between 0 and 360 deg, i.e. -3 deg => 357 deg) which have a quite similar frequency distribution. The frequency distribution is defined as counts per bin, where the bin width should be adjustable between 10 and 30 degree and each bin centered around the given angle (e.g. for 10 deg bin width: bin 0=[-5, 5[, bin 1=[-5, 15[, ...). The variables alpha and beta are float, but a rounding to integer would be acceptable.
The transfer function delta() to be found should be formulated as delta(alpha), such that: freq_dist(delta(alpha)) is nearly equal to: freq_dist(beta). It may not be possible to find equality, but the difference between the distributions should be minimized. The transfer function shifts the value by adding a small delta, it should be a steady and smooth function as near to zero as possible and typically will not exceed the range [-30, 30] (this maximum range may be given as parameter). The function may be approximated by an analytical function (like higher order polynom), but this is not necessary, a discrete formulation like delta[class], with class describing discrete classes of the alpha variable with a width between 1 and 30 degrees, would be acceptable. In case of numerical determination of a discrete transfer function, a measure to ensure steadiness/smoothness of the function shall bet taken, like defining a maximum difference of the delta function between neighbouring classes, like maximum 3 deg when 10 deg classes are used.
A python script which provides a simple data structure for handling the data (numpy array) along with four test cases (pairs of distributions) will be provided. The task is to provide an algorithm as python script which is generally applicable and provides a reasonable solution for the test cases. A short term response and solution will be much appreciated.
Required skills: Data evaluation with Python; numpy; libraries for curve fitting, optimisation, possibly machine learning