interactive-curve-fit


Nameinteractive-curve-fit JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/passive-radio/interactive-curve-fit
Summaryinteractive_curve_fit: A Python project enables you to do curve fitting on spectrum data interactively on GUI. You can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.
upload_time2022-12-14 00:27:26
maintainerYudai Okubo
docs_urlNone
authorYudai Okubo
requires_python
licenseMIT
keywords curve fit spectrum
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # <b>interactive_curve_fit</b>
A Python project enables you to do curve fitting on spectrum data interactively on GUI.
You can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.

## <b>How to use?</b>

Try [tutorial.py](tutorial.py) with your spectrum data!

## <b>Spectrum data format must be like the table below</b>

| x | y |
|---|---|
|0  | 1  |
|1  | 13 |
|2  | 30 |
|3  | 43 |
|4  | 31 |
|5  | 11 |
|...|...|

## <b>Steps to curve-fit</b>

1. Teach your initial guess of the positions of each peaks roughly to Fitter.

    ```python
    from interactive_curve_fit import read_data, Guessor, Fitter
    
    data = read_data(data, headers=2, sep=',')
    guessor = Guessor(data, background=10, method='drag')
    guess = guessor.guess()
    ```

    ### Initial Guess method
    - mouse-dragging (wrap up peak area by mouse-dragging)
    - click (click the top and the both edges of each peaks)

    ### Screenshot
    ![Guessing peak pos interactively](img/mouse-dragging-step0.png)
    ![Guessing another peak pos](img/mouse-dragging-step2.png)
    ![Fitting results (by Fitter class)](img/peak_found.png)
    ![Peak information on terminal](img/peak_terminal.png)

1. Give your spectrum data and your guess to Fitter.
    
    ```python
    fitter = Fitter(data, guess)
    fitter.run(method='gaussian')
    ```
    ### Supported fitting functions
    - gaussian function
    - polynomial function

    ### Output information includes
    - position (x, y) of each peaks
    - baseline height of the spectrum
    - bandwidth of each peaks with its CI (confidential interval)

1. Save the fitting results
    ```python
    fitter.save_data('out/fitting_result.csv')
    ```

1. Other features
    
    bmp_to_csv converts bmp file to csv file.
    ```python
    from interactive_curve_fit import bmg_to_csv
    bmp_to_csv('data/line_spectrum.bmp')
    data = read_data('data/line_spectrum.csv')
    ```
    
    Fitter can visualize fitting results
    ```
    fitter.plot_fit()
    ```

    Fitter can also display fitting results on terminal
    ```
    fitter.display_results_terminal(ci=2)
    ```

## <b>Supported supectrum file format</b>

- ascii file(.asc .csv .txt etc..)
- bmp image(.bmp .jpg .png .jpeg etc..)

    excel sheet files, table of html are planed to be suported in the near future.

## <b>Features that are planned to be supported!</b>

- baseline correlation
- other fitting functions (e.g. binomical distribution function)
- automated guessor method using wavelet transform and CNN


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/passive-radio/interactive-curve-fit",
    "name": "interactive-curve-fit",
    "maintainer": "Yudai Okubo",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "yudaiokubo@gmail.com",
    "keywords": "curve fit spectrum",
    "author": "Yudai Okubo",
    "author_email": "yudaiokubo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d6/26/7fc933035b994ce00bd7529d17466390ca8a69f345e93fa914e1702cda85/interactive_curve_fit-0.0.1.tar.gz",
    "platform": null,
    "description": "# <b>interactive_curve_fit</b>\nA Python project enables you to do curve fitting on spectrum data interactively on GUI.\nYou can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.\n\n## <b>How to use?</b>\n\nTry [tutorial.py](tutorial.py) with your spectrum data!\n\n## <b>Spectrum data format must be like the table below</b>\n\n| x | y |\n|---|---|\n|0  | 1  |\n|1  | 13 |\n|2  | 30 |\n|3  | 43 |\n|4  | 31 |\n|5  | 11 |\n|...|...|\n\n## <b>Steps to curve-fit</b>\n\n1. Teach your initial guess of the positions of each peaks roughly to Fitter.\n\n    ```python\n    from interactive_curve_fit import read_data, Guessor, Fitter\n    \n    data = read_data(data, headers=2, sep=',')\n    guessor = Guessor(data, background=10, method='drag')\n    guess = guessor.guess()\n    ```\n\n    ### Initial Guess method\n    - mouse-dragging (wrap up peak area by mouse-dragging)\n    - click (click the top and the both edges of each peaks)\n\n    ### Screenshot\n    ![Guessing peak pos interactively](img/mouse-dragging-step0.png)\n    ![Guessing another peak pos](img/mouse-dragging-step2.png)\n    ![Fitting results (by Fitter class)](img/peak_found.png)\n    ![Peak information on terminal](img/peak_terminal.png)\n\n1. Give your spectrum data and your guess to Fitter.\n    \n    ```python\n    fitter = Fitter(data, guess)\n    fitter.run(method='gaussian')\n    ```\n    ### Supported fitting functions\n    - gaussian function\n    - polynomial function\n\n    ### Output information includes\n    - position (x, y) of each peaks\n    - baseline height of the spectrum\n    - bandwidth of each peaks with its CI (confidential interval)\n\n1. Save the fitting results\n    ```python\n    fitter.save_data('out/fitting_result.csv')\n    ```\n\n1. Other features\n    \n    bmp_to_csv converts bmp file to csv file.\n    ```python\n    from interactive_curve_fit import bmg_to_csv\n    bmp_to_csv('data/line_spectrum.bmp')\n    data = read_data('data/line_spectrum.csv')\n    ```\n    \n    Fitter can visualize fitting results\n    ```\n    fitter.plot_fit()\n    ```\n\n    Fitter can also display fitting results on terminal\n    ```\n    fitter.display_results_terminal(ci=2)\n    ```\n\n## <b>Supported supectrum file format</b>\n\n- ascii file(.asc .csv .txt etc..)\n- bmp image(.bmp .jpg .png .jpeg etc..)\n\n    excel sheet files, table of html are planed to be suported in the near future.\n\n## <b>Features that are planned to be supported!</b>\n\n- baseline correlation\n- other fitting functions (e.g. binomical distribution function)\n- automated guessor method using wavelet transform and CNN\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "interactive_curve_fit: A Python project enables you to do curve fitting on spectrum data interactively on GUI. You can visualize your spectrum and fit the optional number of peaks on GUI using Scipy.optimize.curve_fit method.",
    "version": "0.0.1",
    "split_keywords": [
        "curve",
        "fit",
        "spectrum"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "672ae8ad62c6b9dbf02c1a401a3c612b",
                "sha256": "15daa3c2eb87bdd15afb05935ad5784a54907a3ecf62aeda726a3113b2c9bf19"
            },
            "downloads": -1,
            "filename": "interactive_curve_fit-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "672ae8ad62c6b9dbf02c1a401a3c612b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15467,
            "upload_time": "2022-12-14T00:27:23",
            "upload_time_iso_8601": "2022-12-14T00:27:23.745158Z",
            "url": "https://files.pythonhosted.org/packages/88/17/34ccb061c34f1e6175b0f8569a8d8d99636a69b1effa991ee2e38a00f21e/interactive_curve_fit-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "112d8821b52b08ec32e5c94b88a42b79",
                "sha256": "c193c67b693e0a807c1793caab6ed14a1230e5499eb9b83d6a235280783539c0"
            },
            "downloads": -1,
            "filename": "interactive_curve_fit-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "112d8821b52b08ec32e5c94b88a42b79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 356000,
            "upload_time": "2022-12-14T00:27:26",
            "upload_time_iso_8601": "2022-12-14T00:27:26.531946Z",
            "url": "https://files.pythonhosted.org/packages/d6/26/7fc933035b994ce00bd7529d17466390ca8a69f345e93fa914e1702cda85/interactive_curve_fit-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-14 00:27:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "passive-radio",
    "github_project": "interactive-curve-fit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "interactive-curve-fit"
}
        
Elapsed time: 0.02643s