Classes | |
class | ToolboxNumError |
Functions | |
def | row_beg2end |
def | col_beg2end |
def | vec_beg2end |
def | is_sortable |
def | nearest |
def | encadre |
def | interpolation1D |
Interpolate at a given x0 a 1d curve given by its x,y. More... | |
def | interpolate |
def | gridpos |
def | polint |
def | cell2grid |
def | grid2cell |
def | gaussian |
Gaussian function. More... | |
def | fit_gaussian |
Fit data with a gaussian. More... | |
def | fit_gaussian_latitude |
Fit latitudes with a gaussian. More... | |
def | fit_gaussian_longitude |
Fit longitudes with a gaussian. More... | |
def | relative_error |
Get the relative error between two np.array. More... | |
def | almost_equal |
Check if two objects are equals up to the tolint-th decimal. More... | |
def | almost_equal_float |
Check if 2 floats are equals up to the tolint-th decimal. More... | |
def | almost_equal_tuple |
Check if 2 tuples of floats are equals up to the tolint-th decimal. More... | |
def | get_yyyy_mm |
Between 2 dates, return the list of different YYYY/MM there is. More... | |
def | draw_normal_plane |
Return the unit normal vector from a given vector. More... | |
def | get_angle |
From a ![]() ![]() | |
def | normalise_angle_mpi_pi |
Put a degree angle in [-180,180]. More... | |
def | mean_longitude |
Compute the mean of 2 longitudes. More... | |
def | print_array2D |
Print a 2D array. More... | |
def | print_array1D |
Print a 1D array. More... | |
def | mean_datetime |
Compute mean datetime of a list of datetimes. More... | |
def | compare_dict |
Compare 2 dictionaries. More... | |
def common.module_toolbox_num.almost_equal | ( | x, | |
y, | |||
tolint | |||
) |
Check if two objects are equals up to the tolint-th decimal.
[in] | x,y | objects to be compared. Can be Float, Tuple of floats. |
[in] | tolint | integer. The number of decimal taken into account. |
def common.module_toolbox_num.almost_equal_float | ( | x, | |
y, | |||
tolint | |||
) |
Check if 2 floats are equals up to the tolint-th decimal.
[in] | x,y | floats to be compared. |
[in] | tolint | integer. The number of decimal taken into account. |
def common.module_toolbox_num.almost_equal_tuple | ( | x, | |
y, | |||
tolint | |||
) |
Check if 2 tuples of floats are equals up to the tolint-th decimal.
[in] | x,y | tuples to be compared. |
[in] | tolint | integer. The number of decimal taken into account. |
def common.module_toolbox_num.cell2grid | ( | cells | ) |
From a cell centered coordinate axis (c_i)_{i in [0,N-1]}, compute the grid points coordinates (g_i)_{i in [0,N]}: g_{i+1} = \frac{c_{i} + c_{i+1}}{2} for all i in [0,N-2] g_{0} = 2*c_{0} - g_{1} g_{N} = 2*c_{N-1} - g_{N-1}
def common.module_toolbox_num.col_beg2end | ( | j0, | |
input_mat | |||
) |
For a matrix, put the columns from 0 to j0-1 (include) at the end and translate every other columns.
def common.module_toolbox_num.compare_dict | ( | d1, | |
d2 | |||
) |
Compare 2 dictionaries.
def common.module_toolbox_num.draw_normal_plane | ( | dx, | |
dy | |||
) |
Return the unit normal vector from a given vector.
def common.module_toolbox_num.encadre | ( | items, | |
pivot | |||
) |
In a list of object with order relation, find nearest items from pivot. For a given list (a_i)_{i=1..N} and a given pivot x, return: [a_{i0}, a{j0}] such that a_{i0} is the nearest item from x a{j0} the element just after x if a_{i0} < x or just before x if a_{i0} > x
def common.module_toolbox_num.fit_gaussian | ( | xbins, | |
ydata | |||
) |
Fit data with a gaussian.
Does not fit the data directly, but the number of point present in some given bins.
[in] | xbins,: | bins of x axis. Lenght M |
[in] | ydata,: | data. Length N (at least 100) |
[out] | a,: | amplitude of the fitted distribution |
[out] | mean,: | mean of the fitted distribution |
[out] | sigma,: | standard deviation of the fitted distribution |
[out] | perr,: | np.array(3). Sqrt(variance) for each parameter |
def common.module_toolbox_num.fit_gaussian_latitude | ( | latitudes, | |
bin_width = 1. |
|||
) |
Fit latitudes with a gaussian.
[in] | latitudes,: | np.array |
[out] | a,mean,sigma,perr |
def common.module_toolbox_num.fit_gaussian_longitude | ( | longitudes, | |
bin_width = 1. |
|||
) |
Fit longitudes with a gaussian.
[in] | longitudes,: | np.array |
[out] | a,mean,sigma,perr |
def common.module_toolbox_num.gaussian | ( | x, | |
a, | |||
mean, | |||
sigma | |||
) |
Gaussian function.
[in] | x,: | np.array for x values |
[in] | a,: | amplitude |
[in] | mean,: | mean |
[in] | sigma,: | standard deviation |
[out] | gaussian | as np.array |
def common.module_toolbox_num.get_angle | ( | vx, | |
vy | |||
) |
From a vector, retrieve the oriented angle
in degree.
def common.module_toolbox_num.get_yyyy_mm | ( | date1, | |
date2 | |||
) |
Between 2 dates, return the list of different YYYY/MM there is.
def common.module_toolbox_num.grid2cell | ( | grids | ) |
From a grid centered coordinate axis (g_i)_{i in [0,N]}, compute the cell points coordinates (c_i)_{i in [0,N-1]}: c_{i} = \frac{g_{i} + g_{i+1}}{2} for all i in [0,N-1]
def common.module_toolbox_num.gridpos | ( | x, | |
x0 | |||
) |
def common.module_toolbox_num.interpolate | ( | x, | |
y, | |||
f, | |||
nptx, | |||
npty, | |||
x0, | |||
y0 | |||
) |
def common.module_toolbox_num.interpolation1D | ( | x, | |
y, | |||
x0, | |||
kind = 'linear' |
|||
) |
Interpolate at a given x0 a 1d curve given by its x,y.
[in] | x,y | List of x and y values of the curve. |
[in] | x0 | Float or List of float where the interpolation is done. |
[out] | f(x0) | Float or List of float of interpolated y. |
def common.module_toolbox_num.is_sortable | ( | obj | ) |
Check if an object has an order relation in Python 2.X or 3.X
def common.module_toolbox_num.mean_datetime | ( | dates | ) |
Compute mean datetime of a list of datetimes.
The input list can contains some None value.
def common.module_toolbox_num.mean_longitude | ( | x, | |
y | |||
) |
Compute the mean of 2 longitudes.
If longitide 1 is near from 0 and longitude 2 is near from 360, (x+y)/2 is not correct.
def common.module_toolbox_num.nearest | ( | items, | |
pivot | |||
) |
In a list of object with order relation, find the nearest item from pivot.
def common.module_toolbox_num.normalise_angle_mpi_pi | ( | angle | ) |
Put a degree angle in [-180,180].
def common.module_toolbox_num.polint | ( | xa, | |
ya, | |||
x | |||
) |
def common.module_toolbox_num.print_array1D | ( | array1D | ) |
Print a 1D array.
def common.module_toolbox_num.print_array2D | ( | array2D | ) |
Print a 2D array.
def common.module_toolbox_num.relative_error | ( | x1, | |
x2 | |||
) |
Get the relative error between two np.array.
def common.module_toolbox_num.row_beg2end | ( | i0, | |
input_mat | |||
) |
For a matrix, put the row from 0 to i0-1 (include) at the end and translate every other rows.
def common.module_toolbox_num.vec_beg2end | ( | i0, | |
input_vec | |||
) |
For a vector, put the first i0 at the end and translate every other.