currentscape.data_processing¶
Functions processing data.
Functions
|
Autoscale ticks and ylim and put the result in config. |
|
Set chunksize to a divisor of the data size if not the case. |
|
Warns that chunksize has been re-set. |
|
Get order of magnitude of a (absolute value of a) number. |
|
Removes all arrays made only of zeros. |
|
Remove zeros, reorder data and also return data's original indexes. |
|
Returns indexes of sorted currents %age from smaller to larger absolute summed values. |
|
Round down to a given number (default: 1) of significant digit. |
|
Compute the sums of parts of an array, then divide values by chunk size. |
- currentscape.data_processing.autoscale_ticks_and_ylim(c, pos, neg, config_key='current')[source]¶
Autoscale ticks and ylim and put the result in config.
No need to return config, since dict are mutable in python.
- Parameters:
c (dict) – config
pos (ndarray or float) – positive values or max of positive values
neg (ndarray or float) – absolute values of negative values or absolute value of minimum of negative values
config_key (str) – key for getting data from config. Should be ‘current’ or ‘ions’
- currentscape.data_processing.check_chunksize(cs, len_curr)[source]¶
Set chunksize to a divisor of the data size if not the case.
- Parameters:
cs (int) – chunksize of data to check
len_curr (int) – data size (length of one current list)
- currentscape.data_processing.chunksize_warning(cs, len_curr, new_cs)[source]¶
Warns that chunksize has been re-set.
- Parameters:
cs (int) – chunksize of data
len_curr (int) – data size (length of one current list)
new_cs (int) – new chunksize to be used
- currentscape.data_processing.order_of_mag(n)[source]¶
Get order of magnitude of a (absolute value of a) number.
e.g. for 1234 -> 1000, or 0.0456 -> 0.01
- Parameters:
n (float or int) – number
- currentscape.data_processing.remove_zero_arrays(arr, idx=None)[source]¶
Removes all arrays made only of zeros.
Returns new array and indexes to previous array indexes.
- Parameters:
arr (ndarray of ndarrays) – array
idx (ndarray) – indices of the array
- currentscape.data_processing.reorder(arr)[source]¶
Remove zeros, reorder data and also return data’s original indexes.
- Parameters:
arr (ndarray of ndarrays) – array
- currentscape.data_processing.reordered_idx(arr)[source]¶
Returns indexes of sorted currents %age from smaller to larger absolute summed values.
- Parameters:
arr (ndarray of ndarrays) – array
- currentscape.data_processing.round_down_sig_digit(n, mag_order=None)[source]¶
Round down to a given number (default: 1) of significant digit.
e.g. 0.0456 -> 0.04, 723 -> 700
- Parameters:
n (float or int) – number to be rounded down
mag_order (float or int) – 10 to the power of the desired order of magnitude (e.g. 1000 to round the thousands) if None: n is rounded to 1 sig digit
- currentscape.data_processing.sum_chunks(x, chunk_size)[source]¶
Compute the sums of parts of an array, then divide values by chunk size.
Taken from https://stackoverflow.com/questions/18582544/sum-parts-of-numpy-array.
- Parameters:
x (ndarray) – data to sum into chunks
chunk_size (int) – chunk size of the data to be output