# Package of functions for manipulating Tensile Test data
## Contents
- [Description](#Description)
- [read_testdata](#read_testdata)
- [to_tension](#to_tension)
- [linearize_diag](#linearize_diag)
- [cut_end](#cut_end)
- [correct_diag](#correct_diag)
- [get_info](#get_info)
- [plot_sample](#plot_sample)
- [plot_group](#plot_group)
- [Author](#Author)
- [Copyright and license](#copyright-and-license)
## Description
The main purpose of this code is to read, manipulate, correct and adequately plot Stress x Strain diagrams, and there is no guarantee that it will work for other types of tests or other universal testing machines.
Furthermore, this is an open source project developed on an individual basis in order to assist students and researchers in their academic/research activities, so if something does not work correctly, updates/bug fixes should not be expected, even though the Feedback is very appreciated through the author's communication channels.
For the code to work properly, it is necessary to pay close attention to the formatting of the original data. The package's functions expect a specific formatting that must be met to avoid errors, further details on the read_testdata topic.
This is expected to be the default formatting output for data from Shimadzu. If the formatting is different, it will be necessary to either change the functions of the package or to alter the data formatting accordingly.
## read_testdata
The read_testdata function is intended to read the database generated by the universal testing machine in a simplified way, eliminating all the processing steps that are necessary to carry out the loading and reading manually.
The expected arguments are:
- file - database file (mainly a .csv directly from Shimdazu test machine)
- encoding - file encoding (by default: ANSI)
``` code
read_testdata(file, encoding="ANSI")
```
As already said, it is important that the formatting and organization of the database is exactly as shown in the example image below, that is, it is strictly necessary that the columns and rows have the exactly same nomenclature and order of appearance in the example below (including language). Otherwise, it will be necessary to load and read the database (and all the necessary treatment) manually via code or to alter the function algorithm.
<a>
<img src="https://github.com/GabrielVZanata/pyTensileTest/blob/main/formatodataset.png" alt="Required format for dataset" width=400 height=200>
</a>
## to_tension
The to_tension function allows obtaining the actual tension applied to the sample, calculating it based on the force applied by the machine and the effective diameter of the sample.
The expected arguments are:
- df - the Dataframe containing the force and displacement data (in the df format returned by the read_testdata function)
- diam - list containing the diameters of each sample, in the order they appear in the Dataframe.
``` code
to_tension(df, diam)
```
## linearize_diag
The linearize_diag function identifies the most linear stretch for correction of the initial stretch (linear elastic) of the diagrams, which is generally imprecisely generated during the tests. This function must be used in conjunction with the correct_diag function.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
- min_rsq - the minimum value of R² that the algorithm should look for. Note that the value of R² varies from 0 to 1, the measure approaching 1 being more linear. However, if a value is set too high, the function may not find such a linear stretch, which will cause errors.
- int_size - the size of the intervals to be analyzed in number of instants. By default, the function will analyze the data in sections containing 300 instants. The larger this interval, the more intense the linearization will be.
If the algorithm does not find a section with defined R² and interval size, these arguments must be changed (reduced) to avoid errors.
``` code
linearize_diag(df, min_rsq=0.9996, int_size=300)
```
## cut_end
The cut_end function performs the removal of the sections measured and plotted by the testing machine after the sample rupture.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
``` code
cut_end(df)
```
## correct_diag
The correct_diag function applies the to_tension, linearize_diag, cut_end functions to completely correct the diagrams by changing the force measurements to tension, linearizing the initial runs, correcting the deformation and removing the data after the break.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
- min_rsq - the minimum value of R² that the algorithm should look for. Note that the value of R² varies from 0 to 1, the measure approaching 1 being more linear. However, if a value is set too high, the function may not find such a linear stretch, which will cause errors.
- int_size - the size of the intervals to be analyzed in number of instants. By default, the function will analyze the data in sections containing 300 instants. The larger this interval, the more intense the linearization will be.
If the algorithm does not find a section with defined R² and interval size, these arguments must be changed (reduced) to avoid errors.
- correct_force - If TRUE it will apply the to_tension function to the dataframe and wait to receive the diam parameter.
- diam - list containing the diameters of each sample, in the order they appear in the Dataframe.
``` code
correct_diag(df, cut=False, min_rsq = 0.9996, int_size=300, correct_force=False, diam=[])
```
<a>
<img src="https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1N.png" alt="Uncorrected diagram" width=400 height=300>
</a>
<a>
<img src="https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1.png" alt="Corrected diagram" width=400 height=300>
</a>
## get_info
The get_info function allows to obtain the maximum stress and strain at maximum stress.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
- numbar - appearance number of the desired sample (starting at 0), for example: to analyze the 8th sample of the dataframe, use numbar=7.
- parse - True to return the result in Dataframe format, False to return in list format.
``` code
get_info(df, numbar=0, parse=False)
```
## plot_sample
The plot_sample function plots the stress x strain diagram for an individual sample.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
- numbar - appearance number of the desired sample (starting at 0), for example: to plot the 8th sample of the dataframe, use numbar=7.
- obs - A string with a note to be appended to the title of the plot.
- save - True to save the plot to disk.
- folder - Directory where the plot should be saved.
- info - True to add the maximum stress and displacement at maximum stress to the plot.
``` code
plot_sample(df, numbar=0, obs="", save=False, folder="", info=False)
```
<a>
<img src="https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1.png" alt="Individual plot" width=400 height=300>
</a>
## plot_group
The plot_gorup function plots the stress x strain diagram for a group of selected samples.
The expected arguments are:
- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)
- list - list with the appearance numbers of the desired samples (starting at 0), for example: to plot the 2nd, 3rd, 8th and 10th samples of the dataframe, use list=[1,2,7,9] .
- obs - A string with a note to be appended to the title of the plot.
- save - True to save the plot to disk.
- folder - Directory where the plot should be saved.
- group_name - String to define the name of the group of samples to be presented in the title of the plot.
``` code
plot_group (df, list, obs="", group_name="", save=False, folder="")
```
<a>
<img src="https://github.com/GabrielVZanata/pyTensileTest/blob/main/Amostras%20de%2016mm.png" alt="Group plot" width=400 height=300>
</a>
## Autor
**Gabriel Valverde Zanata da Silva**
- <https://github.com/GabrielVZanata>
- <https://www.linkedin.com/in/gabriel-valverde-62141a227/>
This code was developed by Gabriel Valverde Zanata da Silva, a former student at the Polytechnic School of the University of Sao Paulo, to facilitate the manipulation and analysis of test data from the Shimadzu universal testing machine.
The communication channels cited above can be used for reporting bugs and giving suggestions.
## Copyright and license
Code and documentation copyright 2023 Gabriel Valverde Zanata da Silva. Code released under the [MIT License](https://reponame/blob/master/LICENSE).
Raw data
{
"_id": null,
"home_page": "https://github.com/GabrielVZanata/pyTensileTest",
"name": "pyTensileTest",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "shimadzu tensile test",
"author": "Gabriel Valverde Zanata da Silva",
"author_email": "gabriel.valverde@hotmail.com",
"download_url": "https://files.pythonhosted.org/packages/75/f6/15b188c378ca41f0d214dbff375d4a77bec61d28804023d0917058550259/pyTensileTest-0.0.7.tar.gz",
"platform": null,
"description": "# Package of functions for manipulating Tensile Test data\r\n\r\n## Contents\r\n\r\n- [Description](#Description)\r\n- [read_testdata](#read_testdata)\r\n- [to_tension](#to_tension)\r\n- [linearize_diag](#linearize_diag)\r\n- [cut_end](#cut_end)\r\n- [correct_diag](#correct_diag)\r\n- [get_info](#get_info)\r\n- [plot_sample](#plot_sample)\r\n- [plot_group](#plot_group)\r\n- [Author](#Author)\r\n- [Copyright and license](#copyright-and-license)\r\n\r\n\r\n## Description\r\n\r\nThe main purpose of this code is to read, manipulate, correct and adequately plot Stress x Strain diagrams, and there is no guarantee that it will work for other types of tests or other universal testing machines.\r\n\r\nFurthermore, this is an open source project developed on an individual basis in order to assist students and researchers in their academic/research activities, so if something does not work correctly, updates/bug fixes should not be expected, even though the Feedback is very appreciated through the author's communication channels.\r\n\r\nFor the code to work properly, it is necessary to pay close attention to the formatting of the original data. The package's functions expect a specific formatting that must be met to avoid errors, further details on the read_testdata topic.\r\n\r\nThis is expected to be the default formatting output for data from Shimadzu. If the formatting is different, it will be necessary to either change the functions of the package or to alter the data formatting accordingly. \r\n\r\n\r\n## read_testdata\r\n\r\nThe read_testdata function is intended to read the database generated by the universal testing machine in a simplified way, eliminating all the processing steps that are necessary to carry out the loading and reading manually.\r\n\r\nThe expected arguments are:\r\n- file - database file (mainly a .csv directly from Shimdazu test machine)\r\n- encoding - file encoding (by default: ANSI)\r\n\r\n``` code\r\nread_testdata(file, encoding=\"ANSI\")\r\n```\r\nAs already said, it is important that the formatting and organization of the database is exactly as shown in the example image below, that is, it is strictly necessary that the columns and rows have the exactly same nomenclature and order of appearance in the example below (including language). Otherwise, it will be necessary to load and read the database (and all the necessary treatment) manually via code or to alter the function algorithm.\r\n\r\n<a>\r\n <img src=\"https://github.com/GabrielVZanata/pyTensileTest/blob/main/formatodataset.png\" alt=\"Required format for dataset\" width=400 height=200>\r\n </a>\r\n\r\n\r\n## to_tension\r\n\r\nThe to_tension function allows obtaining the actual tension applied to the sample, calculating it based on the force applied by the machine and the effective diameter of the sample.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the force and displacement data (in the df format returned by the read_testdata function)\r\n- diam - list containing the diameters of each sample, in the order they appear in the Dataframe.\r\n\r\n``` code\r\nto_tension(df, diam)\r\n```\r\n\r\n## linearize_diag\r\n\r\nThe linearize_diag function identifies the most linear stretch for correction of the initial stretch (linear elastic) of the diagrams, which is generally imprecisely generated during the tests. This function must be used in conjunction with the correct_diag function.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n- min_rsq - the minimum value of R\u00c2\u00b2 that the algorithm should look for. Note that the value of R\u00c2\u00b2 varies from 0 to 1, the measure approaching 1 being more linear. However, if a value is set too high, the function may not find such a linear stretch, which will cause errors.\r\n- int_size - the size of the intervals to be analyzed in number of instants. By default, the function will analyze the data in sections containing 300 instants. The larger this interval, the more intense the linearization will be.\r\nIf the algorithm does not find a section with defined R\u00c2\u00b2 and interval size, these arguments must be changed (reduced) to avoid errors.\r\n\r\n``` code\r\nlinearize_diag(df, min_rsq=0.9996, int_size=300)\r\n```\r\n\r\n## cut_end\r\n\r\nThe cut_end function performs the removal of the sections measured and plotted by the testing machine after the sample rupture.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n\r\n``` code\r\ncut_end(df)\r\n```\r\n\r\n \r\n## correct_diag\r\n\r\nThe correct_diag function applies the to_tension, linearize_diag, cut_end functions to completely correct the diagrams by changing the force measurements to tension, linearizing the initial runs, correcting the deformation and removing the data after the break.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n- min_rsq - the minimum value of R\u00c2\u00b2 that the algorithm should look for. Note that the value of R\u00c2\u00b2 varies from 0 to 1, the measure approaching 1 being more linear. However, if a value is set too high, the function may not find such a linear stretch, which will cause errors.\r\n- int_size - the size of the intervals to be analyzed in number of instants. By default, the function will analyze the data in sections containing 300 instants. The larger this interval, the more intense the linearization will be.\r\nIf the algorithm does not find a section with defined R\u00c2\u00b2 and interval size, these arguments must be changed (reduced) to avoid errors.\r\n- correct_force - If TRUE it will apply the to_tension function to the dataframe and wait to receive the diam parameter.\r\n- diam - list containing the diameters of each sample, in the order they appear in the Dataframe.\r\n\r\n``` code\r\ncorrect_diag(df, cut=False, min_rsq = 0.9996, int_size=300, correct_force=False, diam=[])\r\n```\r\n <a>\r\n <img src=\"https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1N.png\" alt=\"Uncorrected diagram\" width=400 height=300>\r\n </a>\r\n <a>\r\n <img src=\"https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1.png\" alt=\"Corrected diagram\" width=400 height=300>\r\n </a>\r\n \r\n## get_info\r\n\r\nThe get_info function allows to obtain the maximum stress and strain at maximum stress.\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n- numbar - appearance number of the desired sample (starting at 0), for example: to analyze the 8th sample of the dataframe, use numbar=7.\r\n- parse - True to return the result in Dataframe format, False to return in list format.\r\n\r\n``` code\r\nget_info(df, numbar=0, parse=False)\r\n```\r\n\r\n## plot_sample\r\n\r\nThe plot_sample function plots the stress x strain diagram for an individual sample.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n- numbar - appearance number of the desired sample (starting at 0), for example: to plot the 8th sample of the dataframe, use numbar=7.\r\n- obs - A string with a note to be appended to the title of the plot.\r\n- save - True to save the plot to disk.\r\n- folder - Directory where the plot should be saved.\r\n- info - True to add the maximum stress and displacement at maximum stress to the plot.\r\n\r\n``` code\r\nplot_sample(df, numbar=0, obs=\"\", save=False, folder=\"\", info=False)\r\n```\r\n <a>\r\n <img src=\"https://github.com/GabrielVZanata/pyTensileTest/blob/main/5_1.png\" alt=\"Individual plot\" width=400 height=300>\r\n </a>\r\n\r\n \r\n## plot_group\r\n\r\nThe plot_gorup function plots the stress x strain diagram for a group of selected samples.\r\n\r\nThe expected arguments are:\r\n- df - the Dataframe containing the stress and displacement data (in the format of the df returned by the read_testdata function)\r\n- list - list with the appearance numbers of the desired samples (starting at 0), for example: to plot the 2nd, 3rd, 8th and 10th samples of the dataframe, use list=[1,2,7,9] .\r\n- obs - A string with a note to be appended to the title of the plot.\r\n- save - True to save the plot to disk.\r\n- folder - Directory where the plot should be saved.\r\n- group_name - String to define the name of the group of samples to be presented in the title of the plot.\r\n\r\n``` code\r\nplot_group (df, list, obs=\"\", group_name=\"\", save=False, folder=\"\")\r\n```\r\n <a>\r\n <img src=\"https://github.com/GabrielVZanata/pyTensileTest/blob/main/Amostras%20de%2016mm.png\" alt=\"Group plot\" width=400 height=300>\r\n </a>\r\n\r\n## Autor\r\n\r\n**Gabriel Valverde Zanata da Silva**\r\n\r\n- <https://github.com/GabrielVZanata>\r\n- <https://www.linkedin.com/in/gabriel-valverde-62141a227/>\r\n\r\nThis code was developed by Gabriel Valverde Zanata da Silva, a former student at the Polytechnic School of the University of Sao Paulo, to facilitate the manipulation and analysis of test data from the Shimadzu universal testing machine.\r\nThe communication channels cited above can be used for reporting bugs and giving suggestions. \r\n\r\n\r\n## Copyright and license\r\n\r\nCode and documentation copyright 2023 Gabriel Valverde Zanata da Silva. Code released under the [MIT License](https://reponame/blob/master/LICENSE).\r\n\r\n\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "A package for manipulating tensile test data, creating and correcting stress-strain diagrams.",
"version": "0.0.7",
"split_keywords": [
"shimadzu",
"tensile",
"test"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "75f615b188c378ca41f0d214dbff375d4a77bec61d28804023d0917058550259",
"md5": "e814b287085f94c2215514be5b2cffe9",
"sha256": "7df11e449ea49b62ce55ca02e803f6229c25eb0459ed5bf036411beb1aa9dd09"
},
"downloads": -1,
"filename": "pyTensileTest-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "e814b287085f94c2215514be5b2cffe9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8329,
"upload_time": "2023-02-03T14:40:39",
"upload_time_iso_8601": "2023-02-03T14:40:39.147438Z",
"url": "https://files.pythonhosted.org/packages/75/f6/15b188c378ca41f0d214dbff375d4a77bec61d28804023d0917058550259/pyTensileTest-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-03 14:40:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "GabrielVZanata",
"github_project": "pyTensileTest",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytensiletest"
}