omfit-ctrl-analysis 2020.12.2.22.59
omfit_ctrl_analysis
Requires Python: >=3.6

**CTRL_ANALYSIS** files used as part of the OMFIT project: https://omfit.io/

Provides:
=========
* auto_scale
* mean_trapz
* ControlAnalysis
* SystemIdentification
* ControlQuality
* sanitize_key
* remove_periodic_noise

Requires:
=========
* numpy>=1.12
* scipy>=1.0
* uncertainties>=3
* xarray>=0.10.8
* omfit_mds==2020.12.2.22.59
* omfit_data==2020.12.2.22.59
* omfit_base==2020.12.2.22.59
* omfit_rdb==2020.12.2.22.59
* omfit_commonclasses==2020.12.2.22.59

Authors:
=========
https://omfit.io/contributors.html

Documentation:
==============
auto_scale
----------

    Given some data, pick a scale that would probably work nicely for most smoothing functions.

    If the user doesn't like it, they can provide a scale explicitly.

    :param x: float array
        Independent variable.

    :param y: float array
        Dependent variable. We assume you want to smooth this and have it look nice.

    :return: float
        Scale for smoothing y(x) in same units as x.
    

mean_trapz
----------

    Average y using trapezoid rule and step spacing from x, if provided.

    Can be used to effectively weight y by dx and cope with uneven x spacing.

    :param y: float array
        Dependent variable to average

    :param x: float array [optional]
        Independent variable corresponding to y. If not provided, will assume even spacing.

    :param nan_policy: string
        'ignore' or 'propagate'

    :return: float
        Average value of y using trapezoid integration and accounting for potential uneven x spacing
    

ControlAnalysis
---------------

    Contains helper functions for analyzing control problems.
    

SystemIdentification
--------------------

    Manages fits to control responses to commands to identify system parameters
    

ControlQuality
--------------

    Calculates metrics for control quality
    

sanitize_key
------------

    Replaces illegal characters in a string so it can be used as a key in the OMFIT tree

    :param key: string

    :return: string
    

remove_periodic_noise
---------------------

    Tries to remove periodic noise from a signal by characterizing a baseline interval and extrapolating

    1. FFT signal during baseline interval, when there should be no real signal (all noise)
    2. Cut off low amplitude parts of the FFT and those outside of min/max freq
    3. Find frequencies where the baseline has high amplitude
    4. Suppress frequency components that appear prominently in the baseline

    :param x: 1D float array

    :param y: 1D float array

    :param baseline_interval: two element numeric iterable
        Should give start and end of time range / x range to be used for noise
        characterization. Both ends must be within the range of X.

    :param amp_threshold: float
        Fraction of peak FFT magnitude (not counting 0 frequency) to use as a threshold.
        FFT components with magnitudes below this will be discarded.

    :param min_freq: float [optional]
        Also remove low frequencies while cleaning low amplitude components out of the FFT

    :param max_freq: float [optional]
        Also remove high frequencies while cleaning low amplitude components out of the FFT

    :param debug: bool
        Returns intermediate quantities along with the primary result

    :return: 1D float array or dictionary
        If debug is False: 1D array
            y, but with best estimate for periodic noise removed
        If debug is True: dict