picnik-v0.1.9


Namepicnik-v0.1.9 JSON
Version 0.1.9 PyPI version JSON
download
home_pagehttps://github.com/ErickErock/pICNIK
SummaryA package to make isoconversional computations for non-isothermal kinetics
upload_time2023-12-22 22:15:37
maintainer
docs_urlNone
authorErickErock
requires_python>=3.7,<4.0
licenseMIT
keywords non-isothermal kinetics isoconversion isoconversional computations
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pICNIK 

pICNIK is a module with implemented isoconversional computations for non-isothermal kinetcis.\
The package has an object oriented interface with two classes:`DataExtraction` and `ActivationEnergy`, with the purpose of managing the experimental data and computing activation energies  with the next isoconversional methods: 

- Ozawa-Flynn-Wall (OFW)\
- Kissinger-Akahira-Sunose (KAS)\ 
- Friedman (Fr)\
- Vyazovkin (Vy)\
- Advanced method of Vyazovkin (aVy)\

Additionally, the `ActivationEnergy` class contains methods to make isothermal and non-isothermal predictions based on the isoconversional principle. Furthermore, the class has methods to reconstruct the reaction model in its integrl expression ($g(\alpha)$) given an activation energy ($E$) and an pre-exponential factor ($A$).

The repository consist in the following directories:
- picnik.py. Contains the package
- examples. Contains a script (example.py) which executes some commmands of picnik in order to ilustrate the suggested procedure. And three more directories which contain data to use with example.py:
    - Constant_E. Simulated TGA data for a process with constant activation energy.
    - Two_Steps. Simulated TGA data for a process with two steps, each with constant activation energy.
    - Variable_E. Simulated TGA data for a process with variable activation energy.
- picnik_Test.ipynb. A jupyter notebook test some of the implemented functions.
- pICNIK_walk-through.ipynb. A jupyter notebook with a simple one-step process example and a guide to the usage of the library.
- poetry.lock. Defines the version of the dependencies for picnik.

### Installation

`picnik` can be installed from PyPi with `pip`:
`$ pip install picnik`


### `DataExtraction` class

It has methods to open the .csv files containing the thermogravimetric data as pandas DataFrames for the experimental data, computing and adding the conversion for the process and the conversion rate as columns in the DataFrame.\
The class also has methods for creating isoconversional DataFrames of time, temperature, conversion rates (for the OFW, KAS, Fr and Vy methods) and also "advanced" DataFrames of time and temperature (for the aVy method).\
Example:

    import picnik as pnk
 
    files = ["HR_1.csv","HR_2.csv",...,"HR_n.csv"]
    xtr = pnk.DataExtraction()
    Beta, T0 = xtr.read_files(files,encoding)
    xtr.Conversion(T0,Tf)
    TDF,tDF,dDF,TaDF,taDF,daDF = xtr.Isoconversion(advanced=(bool))
    
    
The DataFrames are also stored as attributes of the `xtr` object 


### ActivationEnergy class

This class has methods to compute the activation energies with the DataFrames created with the `xtr` object along with its associated error. The `Fr()`,`OFW()`,`KAS()` methods return a tuple of three, two and two elements respectively. The first element of the tuples is a numpy array containing the isoconversional activation energies. The second element contains the associated error within a 95\% confidence interval. The third element in the case of the `Fr()` method is a numpy array containing the intercept of the Friedman method. The `Vy()` and `aVy()` only return a numpy array of isoconversional activation energies, the error associated to this methods are obtained with the `Vy_error()` and `aVy_error()` methods
Example:

    ace = pnk.ActivationEnergy(Beta,
                               T0,
                               TDF,
                               dDF,
                               TaDF,
                               taDF)
    E_Fr, E_OFW, E_KAS, E_Vy, E_aVy = ace.Fr(), ace.OFW(), ace.KAS(), ace.Vy(), ace.aVy()
    
The constructor of this class needs six arguments, a list/array/tuple of Temperature rates, a list/array of initial temperatures and four DataFrames: one of temperature, one of convertsion rates and two "advanced" one of temperature and the other of time.

#### Pre-exponential factor

 The pre-exponential factor is computed by means of the so-called compensation effect, which implies a linear relation between the pre-exponential factor and the activation energy: $\ln{A}=a+bE$

 A linear regression is computed over a set of {$E_{i}$,$\ln{A_{i}}$} to obtain the parameters $a$ and $b$.
 The values of {$E_{i}$,$\ln{A_{i}}$} are obatined from fitting different models $f(\alpha)_{i}$ (defined in the picnik.rxn_models submodule) to the experimental data

 All this information is returned from the `ActivationEnergy.compensation_effect` method

    ln_A,a, b, Avals, Evals = ace.compensation_effect(E_aVy,B=ace.Beta[0])

#### Model reconstruction

 The numerical reconstruction of the reaction model is carried on in its integral form, $g(\alpha)$
 Given an array of activation energy, $E$, and an array of pre-exponential factor, the integral reaction model can be computed as: 
 $g(\alpha) = \sum_{i} g(\alpha_{i}) = \sum_{i} A_{\alpha_{i}} \int_{t_{\alpha_{i-1}}}^{t_{\alpha_{i}}}\exp(-\frac{E_{\alpha_{i}}}{RT(t_{\alpha_{i}})})dt$

    g_r  = ace.reconstruction(E_aVy,np.exp(ln_A), 3)

#### Isothermal prediction
The `ActivationEnergy`class contains three methods for isothermal prediction, each based on a different equation:

 a) Model based prediction:          $t_{\alpha_{i}} = \frac{\sum_{i}g(\alpha_{i})}{A\exp{(-\frac{E}{RT_{0}})}}$   ...(1)
 b) Isoconversion prediction A:      $t_{\alpha_{i}} = \frac{\int_{t_{\alpha_{0}}}^{t_{\alpha_{i}}}\exp(-\frac{E}{RT(t)})}{\exp{(-\frac{E}{RT_{0}})}}$   ...(2)
 c) Isoconversion prediction B:      $J[E_{\alpha},T(t)]=J[E_{\alpha},T_{0}]$   ...(3)

 As it can be seen from the expressions above, the methods do not compute conversion as a funciton of time, but they compute the time required to reach a given conversion

    tim_pred1 = ace.t_isothermal(E_aVy,np.exp(ln_A),Tiso,col=0,g_a=g_r,alpha=alpha)       # eq (1)
    tim_pred2 = ace.t_isothermal(E_aVy,np.exp(ln_A),Tiso,col=0,isoconv=True)              # eq (2) 
    ap,Tp,tp  = ace.prediction(E_aVy,B=0,isoT =575, alpha=0.999)                          # eq (3)

#### Non-isothermal prediction

The `ActivationEnergy.prediction(` method is so general that it can be used to simulate conversion under an arbitrary temperature program which may be a linear or user-defined as a python function.

    ap2,Tp2,tp2 = ace.prediction(E_aVy,B=10,alpha=0.999)   # linear heating rate of 10 K/min    


    def Temp_program(t):
	"""
	Temperaure program with isothermal and linear steps: a linear ramp with heating rate of 5 K/min for
	53 minutes (to reach a temperature of 575 K), then, isothermal until process reaches a 100% conversion
	"""
	if t <= 53:
	    return 35+273 + 5*t
	else:
	    return 575

    ap3,Tp3,tp3 = ace.prediction(E_aVy,B=0,T_func = Temp_program,alpha=0.999)

### Exporting results

The `ActivationEnergy`class also has methods to export the results as .csv or .xlsx files:

    ace.export_Ea(E_Fr, 
                  E_OFW, 
                  E_KAS, 
                  E_Vy, 
                  E_aVy,
                  file_t="xlsx" )

    export_prediction(time, Temp, alpha, name="prediction.csv")

    export_kinetic_triplet(E, ln_A, g_a, name="kinetic_triplet.csv")


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ErickErock/pICNIK",
    "name": "picnik-v0.1.9",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7,<4.0",
    "maintainer_email": "",
    "keywords": "non-isothermal kinetics,isoconversion,isoconversional computations",
    "author": "ErickErock",
    "author_email": "ramirez.orozco.erick@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ae/ac/4f4172ba1eb4dc6858f2178578f08fe5a6cd61c9a66e26d5885c19322785/PICNIK_v0.1.9-0.1.9.tar.gz",
    "platform": null,
    "description": "# pICNIK \n\npICNIK is a module with implemented isoconversional computations for non-isothermal kinetcis.\\\nThe package has an object oriented interface with two classes:`DataExtraction` and `ActivationEnergy`, with the purpose of managing the experimental data and computing activation energies  with the next isoconversional methods: \n\n- Ozawa-Flynn-Wall (OFW)\\\n- Kissinger-Akahira-Sunose (KAS)\\ \n- Friedman (Fr)\\\n- Vyazovkin (Vy)\\\n- Advanced method of Vyazovkin (aVy)\\\n\nAdditionally, the `ActivationEnergy` class contains methods to make isothermal and non-isothermal predictions based on the isoconversional principle. Furthermore, the class has methods to reconstruct the reaction model in its integrl expression ($g(\\alpha)$) given an activation energy ($E$) and an pre-exponential factor ($A$).\n\nThe repository consist in the following directories:\n- picnik.py. Contains the package\n- examples. Contains a script (example.py) which executes some commmands of picnik in order to ilustrate the suggested procedure. And three more directories which contain data to use with example.py:\n    - Constant_E. Simulated TGA data for a process with constant activation energy.\n    - Two_Steps. Simulated TGA data for a process with two steps, each with constant activation energy.\n    - Variable_E. Simulated TGA data for a process with variable activation energy.\n- picnik_Test.ipynb. A jupyter notebook test some of the implemented functions.\n- pICNIK_walk-through.ipynb. A jupyter notebook with a simple one-step process example and a guide to the usage of the library.\n- poetry.lock. Defines the version of the dependencies for picnik.\n\n### Installation\n\n`picnik` can be installed from PyPi with `pip`:\n`$ pip install picnik`\n\n\n### `DataExtraction` class\n\nIt has methods to open the .csv files containing the thermogravimetric data as pandas DataFrames for the experimental data, computing and adding the conversion for the process and the conversion rate as columns in the DataFrame.\\\nThe class also has methods for creating isoconversional DataFrames of time, temperature, conversion rates (for the OFW, KAS, Fr and Vy methods) and also \"advanced\" DataFrames of time and temperature (for the aVy method).\\\nExample:\n\n    import picnik as pnk\n \n    files = [\"HR_1.csv\",\"HR_2.csv\",...,\"HR_n.csv\"]\n    xtr = pnk.DataExtraction()\n    Beta, T0 = xtr.read_files(files,encoding)\n    xtr.Conversion(T0,Tf)\n    TDF,tDF,dDF,TaDF,taDF,daDF = xtr.Isoconversion(advanced=(bool))\n    \n    \nThe DataFrames are also stored as attributes of the `xtr` object \n\n\n### ActivationEnergy class\n\nThis class has methods to compute the activation energies with the DataFrames created with the `xtr` object along with its associated error. The `Fr()`,`OFW()`,`KAS()` methods return a tuple of three, two and two elements respectively. The first element of the tuples is a numpy array containing the isoconversional activation energies. The second element contains the associated error within a 95\\% confidence interval. The third element in the case of the `Fr()` method is a numpy array containing the intercept of the Friedman method. The `Vy()` and `aVy()` only return a numpy array of isoconversional activation energies, the error associated to this methods are obtained with the `Vy_error()` and `aVy_error()` methods\nExample:\n\n    ace = pnk.ActivationEnergy(Beta,\n                               T0,\n                               TDF,\n                               dDF,\n                               TaDF,\n                               taDF)\n    E_Fr, E_OFW, E_KAS, E_Vy, E_aVy = ace.Fr(), ace.OFW(), ace.KAS(), ace.Vy(), ace.aVy()\n    \nThe constructor of this class needs six arguments, a list/array/tuple of Temperature rates, a list/array of initial temperatures and four DataFrames: one of temperature, one of convertsion rates and two \"advanced\" one of temperature and the other of time.\n\n#### Pre-exponential factor\n\n The pre-exponential factor is computed by means of the so-called compensation effect, which implies a linear relation between the pre-exponential factor and the activation energy: $\\ln{A}=a+bE$\n\n A linear regression is computed over a set of {$E_{i}$,$\\ln{A_{i}}$} to obtain the parameters $a$ and $b$.\n The values of {$E_{i}$,$\\ln{A_{i}}$} are obatined from fitting different models $f(\\alpha)_{i}$ (defined in the picnik.rxn_models submodule) to the experimental data\n\n All this information is returned from the `ActivationEnergy.compensation_effect` method\n\n    ln_A,a, b, Avals, Evals = ace.compensation_effect(E_aVy,B=ace.Beta[0])\n\n#### Model reconstruction\n\n The numerical reconstruction of the reaction model is carried on in its integral form, $g(\\alpha)$\n Given an array of activation energy, $E$, and an array of pre-exponential factor, the integral reaction model can be computed as: \n $g(\\alpha) = \\sum_{i} g(\\alpha_{i}) = \\sum_{i} A_{\\alpha_{i}} \\int_{t_{\\alpha_{i-1}}}^{t_{\\alpha_{i}}}\\exp(-\\frac{E_{\\alpha_{i}}}{RT(t_{\\alpha_{i}})})dt$\n\n    g_r  = ace.reconstruction(E_aVy,np.exp(ln_A), 3)\n\n#### Isothermal prediction\nThe `ActivationEnergy`class contains three methods for isothermal prediction, each based on a different equation:\n\n a) Model based prediction:          $t_{\\alpha_{i}} = \\frac{\\sum_{i}g(\\alpha_{i})}{A\\exp{(-\\frac{E}{RT_{0}})}}$   ...(1)\n b) Isoconversion prediction A:      $t_{\\alpha_{i}} = \\frac{\\int_{t_{\\alpha_{0}}}^{t_{\\alpha_{i}}}\\exp(-\\frac{E}{RT(t)})}{\\exp{(-\\frac{E}{RT_{0}})}}$   ...(2)\n c) Isoconversion prediction B:      $J[E_{\\alpha},T(t)]=J[E_{\\alpha},T_{0}]$   ...(3)\n\n As it can be seen from the expressions above, the methods do not compute conversion as a funciton of time, but they compute the time required to reach a given conversion\n\n    tim_pred1 = ace.t_isothermal(E_aVy,np.exp(ln_A),Tiso,col=0,g_a=g_r,alpha=alpha)       # eq (1)\n    tim_pred2 = ace.t_isothermal(E_aVy,np.exp(ln_A),Tiso,col=0,isoconv=True)              # eq (2) \n    ap,Tp,tp  = ace.prediction(E_aVy,B=0,isoT =575, alpha=0.999)                          # eq (3)\n\n#### Non-isothermal prediction\n\nThe `ActivationEnergy.prediction(` method is so general that it can be used to simulate conversion under an arbitrary temperature program which may be a linear or user-defined as a python function.\n\n    ap2,Tp2,tp2 = ace.prediction(E_aVy,B=10,alpha=0.999)   # linear heating rate of 10 K/min    \n\n\n    def Temp_program(t):\n\t\"\"\"\n\tTemperaure program with isothermal and linear steps: a linear ramp with heating rate of 5 K/min for\n\t53 minutes (to reach a temperature of 575 K), then, isothermal until process reaches a 100% conversion\n\t\"\"\"\n\tif t <= 53:\n\t    return 35+273 + 5*t\n\telse:\n\t    return 575\n\n    ap3,Tp3,tp3 = ace.prediction(E_aVy,B=0,T_func = Temp_program,alpha=0.999)\n\n### Exporting results\n\nThe `ActivationEnergy`class also has methods to export the results as .csv or .xlsx files:\n\n    ace.export_Ea(E_Fr, \n                  E_OFW, \n                  E_KAS, \n                  E_Vy, \n                  E_aVy,\n                  file_t=\"xlsx\" )\n\n    export_prediction(time, Temp, alpha, name=\"prediction.csv\")\n\n    export_kinetic_triplet(E, ln_A, g_a, name=\"kinetic_triplet.csv\")\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A package to make isoconversional computations for non-isothermal kinetics",
    "version": "0.1.9",
    "project_urls": {
        "Homepage": "https://github.com/ErickErock/pICNIK",
        "Repository": "https://github.com/ErickErock/pICNIK"
    },
    "split_keywords": [
        "non-isothermal kinetics",
        "isoconversion",
        "isoconversional computations"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "58ae9b741fc482c14e29aba8722c1517a7b49e7d636ec8ef3ff1ad54f5fbc38a",
                "md5": "b69ee6f2e0c77ece2887d3bb9526f779",
                "sha256": "e0a23585e384f58998a000cb4e70c1d3037767f5be820dfd4c64730b361f8a51"
            },
            "downloads": -1,
            "filename": "PICNIK_v0.1.9-0.1.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b69ee6f2e0c77ece2887d3bb9526f779",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7,<4.0",
            "size": 23531,
            "upload_time": "2023-12-22T22:15:35",
            "upload_time_iso_8601": "2023-12-22T22:15:35.203519Z",
            "url": "https://files.pythonhosted.org/packages/58/ae/9b741fc482c14e29aba8722c1517a7b49e7d636ec8ef3ff1ad54f5fbc38a/PICNIK_v0.1.9-0.1.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aeac4f4172ba1eb4dc6858f2178578f08fe5a6cd61c9a66e26d5885c19322785",
                "md5": "027c8ca814c9038c58283b0aecb846a0",
                "sha256": "9c9e93d384c32588249208df55d8987ab32c4ca2e63a2e5c6d0665682f0c96bf"
            },
            "downloads": -1,
            "filename": "PICNIK_v0.1.9-0.1.9.tar.gz",
            "has_sig": false,
            "md5_digest": "027c8ca814c9038c58283b0aecb846a0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7,<4.0",
            "size": 25592,
            "upload_time": "2023-12-22T22:15:37",
            "upload_time_iso_8601": "2023-12-22T22:15:37.258667Z",
            "url": "https://files.pythonhosted.org/packages/ae/ac/4f4172ba1eb4dc6858f2178578f08fe5a6cd61c9a66e26d5885c19322785/PICNIK_v0.1.9-0.1.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-22 22:15:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ErickErock",
    "github_project": "pICNIK",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "picnik-v0.1.9"
}
        
Elapsed time: 0.52006s