Skip to content

Commit

Permalink
API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewReid854 committed Nov 11, 2021
1 parent c3301d7 commit e991157
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 422 deletions.
20 changes: 4 additions & 16 deletions docs/Acceleration factor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,10 @@ Acceleration factor
The Arrhenius model for Acceleration factor due to higher temperature is :math:`AF = exp\left[\frac{E_a}{K_B}\left(\frac{1}{T_{use}}-\frac{1}{T_{acc}}\right)\right]`
This function accepts T_use as a mandatory input and you may specify any two of the three other variables, and the third variable will be found.

Inputs:

- T_use - Temp of usage in Celsius
- T_acc - Temp of acceleration in Celsius (optional input)
- Ea - Activation energy in eV (optional input)
- AF - Acceleration factor (optional input)
- print_results - True/False. Default is True

Outputs:

- Results will be printed to console if print_results is True
- AF - Acceleration Factor
- T_acc - Accelerated temperature (°C)
- T_use - Use temperature (°C)
- Ea - Activation energy (eV)

.. admonition:: API Reference

For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/PoF/acceleration_factor.html>`_.

In the example below, the acceleration factor is found for an accelerated test at 100°C for a component that is normally run at 60°C and has an activation energy of 1.2 eV.

.. code:: python
Expand Down
1 change: 1 addition & 0 deletions docs/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Changelog

**Other**

- Improvements to the API documentation for Convert_data, Datasets, PoF, and Utils modules. This has been a long term body of work to reformat the documentation, and it is finally complete.

**Version: 0.7.1 --- Released 26 Oct 2021**
'''''''''''''''''''''''''''''''''''''''''''
Expand Down
92 changes: 2 additions & 90 deletions docs/Converting data between different formats.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,97 +32,9 @@ Each of the three data formats has an acceptable reduced form as follows:

For more information on these three data formats as well as how to import data from Microsoft Excel (.xlsx files) into Python, please see the section on `Importing data from Excel <https://reliability.readthedocs.io/en/latest/Importing%20data%20from%20Excel.html>`_.

**XCN_to_FR**
.. admonition:: API Reference

Inputs:

- X - the failure or right_censored time. This must be an array or list.
- C - the censoring code for each X. This must be an array or list. Defaults are recognised from the lists shown below.
- N - the quantity for each X. This must be an array or list. Optional Input. If omitted all items are assumed to have quantity (N) of 1.
- censor_code - specify the censor code you have used if it does not appear in the defaults. Optional input. Default censor codes that will be recognised (not case sensitive): 'R', 'RC', 'RIGHT CENS', 'RIGHT CENSORED', 'C', 'CENSORED', 'CENS', 'S', 'SUSP', 'SUSPENSION', 'SUSPENDED', 'UF', 'UNFAILED', 'UNFAIL', 'NF', 'NO FAIL', 'NO FAILURE', 'NOT FAILED', 1
- failure_code - specify the failure code you have used if it does not appear in the defaults. Optional Input. Default failure codes that will be recognised (not case sensitive): 'F', 'FAIL', 'FAILED', 'FAILURE', 0

Outputs:

- failures
- right_censored

**XCN_to_FNRN**

Inputs:

- X - the failure or right_censored time. This must be an array or list.
- C - the censoring code for each X. This must be an array or list. Defaults are recognised from the lists shown below.
- N - the quantity for each X. This must be an array or list. Optional Input. If omitted all items are assumed to have quantity (N) of 1.
- censor_code - specify the censor code you have used if it does not appear in the defaults. Optional input. Default censor codes that will be recognised (not case sensitive): 'R', 'RC', 'RIGHT CENS', 'RIGHT CENSORED', 'C', 'CENSORED', 'CENS', 'S', 'SUSP', 'SUSPENSION', 'SUSPENDED', 'UF', 'UNFAILED', 'UNFAIL', 'NF', 'NO FAIL', 'NO FAILURE', 'NOT FAILED', 1
- failure_code - specify the failure code you have used if it does not appear in the defaults. Optional Input. Default failure codes that will be recognised (not case sensitive): 'F', 'FAIL', 'FAILED', 'FAILURE', 0

Outputs:

- failures
- num_failures
- right_censored
- num_right_censored

**FNRN_to_XCN**

Inputs:

- failures - array or list
- num_failures - array or list. Length must match length of failures
- right_censored - array or list. Optional input.
- num_right_censored - array or list. Optional Input. Length must match length of right_censored
- censor_code - the int or str to use for the censored items. Optional input. Default is 'C'
- failure_code - the int or str to use for the failed items. Optional input. Default is 'F'

Outputs:

- X - event time
- C - censor code
- N - number of events at each event time

**FR_to_XCN**

Inputs:

- failures - array or list
- right_censored - array or list. Optional input.
- censor_code - the int or str to use for the censored items. Optional input. Default is 'C'
- failure_code - the int or str to use for the failed items. Optional input. Default is 'F'

Outputs:

- X - event time
- C - censor code
- N - number of events at each event time

**FNRN_to_FR**

Inputs:

- failures - array or list
- num_failures - array or list. Length must match length of failures
- right_censored - array or list. Optional input.
- num_right_censored - array or list. Optional Input. Length must match length of right_censored

Outputs:

- failures
- right_censored

**FR_to_FNRN**

Inputs:

- failures - array or list
- right_censored - array or list. Optional Input.

Outputs:

- failures
- num_failures
- right_censored
- num_right_censored
For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/Convert_data.html>`_.

All of the six conversion functions contain the following methods:

Expand Down
25 changes: 4 additions & 21 deletions docs/Creep.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,9 @@ Creep is the progressive accumulation of plastic strain in a component under str

The function `creep_rupture_curves` plots the creep rupture curves for a given set of creep data. The function also fits the lines of best fit to each temperature. The time to failure for a given temperature can be found by specifying stress_trace and temp_trace.

Inputs:
.. admonition:: API Reference

- temp_array - an array or list of temperatures
- stress_array- an array or list of stresses
- TTF_array - an array or list of times to failure at the given temperatures and stresses
- stress_trace - The stress to use for finding the time to failure (only 1 value is accepted)
- temp_trace - The temperature to use for finding the time to failure (only 1 value is accepted)

Outputs:

- The plot is the only output. Use plt.show() to show it.
For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/PoF/creep_rupture_curves.html>`_.

Example 1
---------
Expand All @@ -40,18 +32,9 @@ In the following example (taken from example 2.16 of Probabilistic Physics of Fa

The function `creep_failure_time` uses the Larson-Miller relation to find the time to failure due to creep. The method uses a known failure time (time_low) at a lower failure temperature (temp_low) to find the unknown failure time at the higher temperature (temp_high). This relation requires the input temperatures in Fahrenheit. To convert Celsius to Fahrenheit use :math:`F = C\times(9/5)+32`. Also note that the conversion between Fahrenheit and Rankine used in this calculation is :math:`R = F+459.67`.

Inputs:

- temp_low - temperature (in degrees Fahrenheit) where the time_low is known
- temp_high - temperature (in degrees Fahrenheit) which time_high is unknown and will be found by this function
- time_low - time to failure at temp_low
- C - creep constant (default is 20). Typically 20-22 for metals
- print_results - True/False

Outputs:
.. admonition:: API Reference

- The time to failure at the higher temperature.
- If print_results is True, the output will also be printed to the console.
For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/PoF/creep_failure_time.html>`_.

Example 2
---------
Expand Down
6 changes: 5 additions & 1 deletion docs/Datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
Datasets
''''''''

There are a few datasets that have been included with reliability that users may find useful for testing and experimenting. While this list is currently small, expect it to increase significantly over time. Within `reliability.Datasets` the following datasets are available:
.. admonition:: API Reference

For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/Datasets.html>`_.

There are a few datasets that have been included with reliability that users may find useful for testing and experimenting. Within `reliability.Datasets` the following datasets are available:

**Standard datasets**

Expand Down
62 changes: 6 additions & 56 deletions docs/Fracture mechanics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,32 +20,9 @@ While there are formulas to find the parameters q and Kt, these formulas have no

Kt can be found from the `eFatigue website <https://www.efatigue.com/constantamplitude/stressconcentration/>`_ which has an online calculator that will provide you with the appropriate Kt for your notched geometry.

Inputs:

- P - Force applied on the component [units of MPa]
- A - Cross sectional area of the component (at the point of crack initiation) [units of mm^2]
- Sy - Yield strength of the material [units of MPa]
- E - Elastic modulus (Young's modulus) [units of MPa]
- K - Strength coefficient of the material
- n - Strain hardening exponent of the material
- b - Elastic strain exponent of the material
- c - Plastic strain exponent of the material
- sigma_f - Fatigue strength coefficient of the material
- epsilon_f - Fatigue strain coefficient of the material
- q - Notch sensitivity factor. (default is 1 for no notch)
- Kt - stress concentration factor. (default is 1 for no notch)
- mean_stress_correction_method - must be either ‘morrow’, ’modified_morrow’, or ‘SWT'. Default is 'modified_morrow' as this is the same as the uncorrected Coffin-Manson relationship when mean stress is zero.

Outputs:

- The results will be printed to the console if print_results is True
- sigma_max
- sigma_min
- sigma_mean
- epsilon_max
- epsilon_min
- epsilon_mean
- cycles_to_failure
.. admonition:: API Reference

For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/PoF/fracture_mechanics_crack_initiation.html>`_.

Example 1
---------
Expand Down Expand Up @@ -76,36 +53,9 @@ The iterative method does not make those assumptions and as a result, the parame

This function is applicable only to thin plates with a through thickness edge crack or a centre crack (which is to be specified using the parameter crack_type). You may also use this function for notched components (edge notches only, not centre holes) by specifying the parameters Kt and D which are based on the geometry of the notch. For any notched components, this method assumes the notched component has a "shallow notch" where the notch depth (D) is much less than the plate width (W). The value of Kt for notched components may be found on the `eFatigue website <https://www.efatigue.com/constantamplitude/stressconcentration/>`_. In the case of notched components, the local stress concentration from the notch will often cause slower crack growth. In these cases, the crack length is calculated in two parts (stage 1 and stage 2) which can clearly be seen on the plot using the iterative method (as shown in the example below).

Inputs:

- Kc - fracture toughness
- Kt - stress concentration factor (default is 1 for no notch).
- D - depth of the notch (mm) (default is None for no notch). A notched component is assumed to be doubly-notched (symmetric notches on both sides so that no bending occurs)
- C - material constant (sometimes referred to as A)
- m - material constant (sometimes referred to as n). This value must not be 2.
- P - external load on the material (MPa)
- t - plate thickness (mm)
- W - plate width (mm)
- a_initial - initial crack length (mm) (default is 1 mm)
- a_final - final crack length (mm) - default is None in which case a_final is assumed to be a_crit (length at failure). It is useful to be able to enter a_final in cases where there are different loading regimes over time.
- crack_type - must be either 'edge' or 'center'. Default is 'edge'. The geometry factor used for each of these in the simplified method is f(g) = 1.12 for edge and f(g) = 1.0 for center. The iterative method calculates these values exactly using a_initial and W (plate width).
- print_results - True/False. Default is True
- show_plot - True/False. Default is True.

Outputs:

- If print_results is True, all outputs will be printed with a description of the process.
- If show_plot is True, the crack growth plot will be shown for the iterative method.
- Nf_stage_1_simplified (in the case of single stage calculations this will be zero)
- Nf_stage_2_simplified
- Nf_total_simplified
- final_crack_length_simplified
- transition_length_simplified
- Nf_stage_1_iterative (in the case of single stage calculations this will be zero)
- Nf_stage_2_iterative
- Nf_total_iterative
- final_crack_length_iterative
- transition_length_iterative
.. admonition:: API Reference

For inputs and outputs see the `API reference <https://reliability.readthedocs.io/en/latest/API/PoF/fracture_mechanics_crack_growth.html>`_.

Example 2
---------
Expand Down

0 comments on commit e991157

Please sign in to comment.