duvals-triangle-plotter 1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ from .duvals_triangle_plotter import get_duval_points_traces, get_duvals_triangle_plot
@@ -0,0 +1,12 @@
1
+ from .duvals_triangle_plotter import get_duval_points_traces, get_duvals_triangle_plot
2
+
3
+ def main():
4
+ # Example usage
5
+ duval_points = [
6
+ get_duval_points_traces([0.09], [0.0], [0.91], "2000-08-16")
7
+ ]
8
+
9
+ get_duvals_triangle_plot(duval_points, show_plot=True)
10
+
11
+ if __name__ == "__main__":
12
+ main()
@@ -0,0 +1,115 @@
1
+ """
2
+ Constants for Duval's Triangle Plot Configuration
3
+ """
4
+
5
+ pd_region = {
6
+ # Get configuration for the PD (Partial Discharges) region in Duval's Triangle plot.
7
+
8
+ "uid": "pd_region",
9
+ "a": [98, 1, 98], # methane
10
+ "b": [0, 0, 2], # acetylene
11
+ "c": [2, 0, 0], # ethylene
12
+ "fill": "toself",
13
+ "line": {"color": "#444"},
14
+ "mode": "lines",
15
+ "text": "PD",
16
+ "type": "scatterternary",
17
+ "fillcolor": "#b3de69",
18
+ "name": "PD - Corona Partial Discharges"
19
+ }
20
+
21
+ d1_region = {
22
+ # Get configuration for the D1 (Electrical Discharges of Low Energy) region in Duval's Triangle plot.
23
+
24
+ "uid": "d1_region",
25
+ "a": [0, 0, 64, 87], # methane
26
+ "b": [1, 77, 13, 13], # acetylene
27
+ "c": [0, 23, 23, 0], # ethylene
28
+ "fill": "toself",
29
+ "line": {"color": "#444"},
30
+ "mode": "lines",
31
+ "text": "D1",
32
+ "type": "scatterternary",
33
+ "fillcolor": "#ffffb3",
34
+ "name": "D1 - Electrical Discharges of Low Energy"
35
+ }
36
+
37
+ d2_region = {
38
+ # Get configuration for the D2 (Electrical Discharges of High Energy) region in Duval's Triangle plot.
39
+ "uid": "d2_region",
40
+ "a": [0, 0, 31, 47, 64], # methane
41
+ "b": [77, 29, 29, 13, 13], # acetylene
42
+ "c": [23, 71, 40, 40, 23], # ethylene
43
+ "fill": "toself",
44
+ "line": {"color": "#444"},
45
+ "mode": "lines",
46
+ "text": "D2",
47
+ "type": "scatterternary",
48
+ "fillcolor": "#bebada",
49
+ "name": "D2 - Electrical Discharges of High Energy"
50
+ }
51
+
52
+ dt_region = {
53
+ # Get configuration for the DT (Electrical and Thermal Fault) region in Duval's Triangle plot.
54
+
55
+ "uid": "dt_region",
56
+ "a": [0, 0, 35, 46, 96, 87, 47, 31], # methane
57
+ "b": [29, 15, 15, 4, 4, 13, 13, 29], # acetylene
58
+ "c": [71, 85, 50, 50, 0, 0, 40, 40], # ethylene
59
+ "fill": "toself",
60
+ "line": {"color": "#444"},
61
+ "mode": "lines",
62
+ "text": "DT",
63
+ "hoverlabel": {"font": {"color": "black"}},
64
+ "type": "scatterternary",
65
+ "fillcolor": "#fb8072",
66
+ "name": "DT - Electrical and Thermal Fault"
67
+ }
68
+
69
+ t1_region = {
70
+ # Get configuration for the T1 (Thermal Faults, T<300 C) region in Duval's Triangle plot.
71
+
72
+ "uid": "t1_region",
73
+ "a": [76, 80, 98, 98, 96], # methane
74
+ "b": [4, 0, 0, 2, 4], # acetylene
75
+ "c": [20, 20, 2, 0, 0], # ethylene
76
+ "fill": "toself",
77
+ "line": {"color": "#444"},
78
+ "mode": "lines",
79
+ "text": "T1",
80
+ "type": "scatterternary",
81
+ "fillcolor": "#80b1d3",
82
+ "name": "T1 - Thermal Faults, T<300C"
83
+ }
84
+
85
+ t2_region = {
86
+ # Get configuration for the T2 (Thermal Faults, 300 C<T<700 C) region in Duval's Triangle plot.
87
+ "uid": "t2_region",
88
+ "a": [46, 50, 80, 76], # methane
89
+ "b": [4, 0, 0, 4], # acetylene
90
+ "c": [50, 50, 20, 20], # ethylene
91
+ "fill": "toself",
92
+ "line": {"color": "#444"},
93
+ "mode": "lines",
94
+ "text": "T2",
95
+ "type": "scatterternary",
96
+ "fillcolor": "#fdb462",
97
+ "name": "T2 - Thermal Faults, 300C<T<700C"
98
+ }
99
+
100
+ t3_region = {
101
+ # Get configuration for the T3 (Thermal Faults, T>700 C) region in Duval's Triangle plot.
102
+
103
+ "uid": "t3_region",
104
+ "a": [0, 0, 50, 35], # methane
105
+ "b": [15, 0, 0, 15], # acetylene
106
+ "c": [85, 1, 50, 50], # ethylene
107
+ "fill": "toself",
108
+ "line": {"color": "#444"},
109
+ "mode": "lines",
110
+ "text": "T3",
111
+ "type": "scatterternary",
112
+ "fillcolor": "#8dd3c7",
113
+ "name": "T3",
114
+ "name": "T3 - Thermal Faults, T>700C"
115
+ }
@@ -0,0 +1,108 @@
1
+ import plotly.graph_objects as go
2
+ from duvals_triangle_plotter.constants import pd_region, d1_region, d2_region, dt_region, t1_region, t2_region, t3_region
3
+
4
+ def get_layout(equipment_name: str):
5
+
6
+ """
7
+ Generate layout configuration for Duval's Triangle plot.
8
+
9
+ Parameters:
10
+ - equipment_name (str): The name of the equipment for which the Duval's Triangle is plotted.
11
+
12
+ Returns:
13
+ dict: A dictionary containing layout configuration for the Duval's Triangle plot.
14
+ """
15
+
16
+ layout = {
17
+ "title": "<b>Duval's Triangle (Dissolved Gas Analysis) for : {0}</b>".format(equipment_name),
18
+ "width": 1044*1.8, # adjust respectively
19
+ "height": 545*1.8, # adjust respectively
20
+ "ternary": {
21
+ "sum": 100,
22
+ "aaxis": {
23
+ "min": 0.01,
24
+ "ticks": "outside",
25
+ "title": "<b> CH4 (Methane) </b>",
26
+ "linewidth": 8,
27
+ "ticksuffix": "%",
28
+ },
29
+ "baxis": {
30
+ "min": 0.01,
31
+ "ticks": "outside",
32
+ "title": "<b> C2H2 (Acetylene) </b>",
33
+ "linewidth": 8,
34
+ "ticksuffix": "%"
35
+ },
36
+ "caxis": {
37
+ "min": 0.01,
38
+ "ticks": "outside",
39
+ "title": "<b> C2H4 (Ethylene) </b>",
40
+ "linewidth": 8,
41
+ "ticksuffix": "%"
42
+ }
43
+ },
44
+ "autosize": True,
45
+ "showlegend": True,
46
+ "margin": {"pad":100},
47
+ }
48
+ return layout
49
+
50
+ def get_duval_points_traces(methane_points_list: list, acetylene_points_list: list, ethylene_points_list: list, date: str):
51
+
52
+ """
53
+ Get traces for Duval's Triangle points.
54
+
55
+ Parameters:
56
+ - methane_points_list (list): List of methane points where each element is concentration level of methane in ppm.
57
+ - acetylene_points_list (list): List of acetylene points where each element is concentration level of acetylene in ppm.
58
+ - ethylene_points_list (list): List of ethylene points where each element is concentration level of ethylene in ppm.
59
+ - date (str): Date associated with the samples.
60
+
61
+ Returns:
62
+ dict: A dictionary containing traces for Duval's Triangle points.
63
+ """
64
+
65
+ duval_points = {
66
+ "a": methane_points_list, # methane
67
+ "b": acetylene_points_list, # acetylene
68
+ "c": ethylene_points_list, # ethylene
69
+ "mode": "markers",
70
+ "type": "scatterternary",
71
+ "marker": {
72
+ "size": 18, # adjust respectively
73
+ "color": "black",
74
+ "symbol": 217, # a different symbol number would give a different marker style
75
+ },
76
+ "cliponaxis": True,
77
+ "hovertemplate": "Sample Date: {0}<br>".format(date) + "Methane (CH4): %{a:.2f}%<br>" + "Acetylene (C2H2): %{b:.2f}%<br>" + "Ethylene (C2H4): %{c:.2f}%<br>",
78
+ "name": "Sample Date: {0}<br>".format(date)
79
+ }
80
+
81
+ return duval_points
82
+
83
+ def get_duvals_triangle_plot(duval_points_list: list, show_plot:bool = False, equipment_name:str = "General Site"):
84
+
85
+ """
86
+ Generate Duval's Triangle plot.
87
+
88
+ Parameters:
89
+ - duval_points_list (list): List of Duval's Triangle points.
90
+ - show_plot (bool): Flag to determine whether to display the plot.
91
+ - equipment_name (str): Name of the equipment for which the plot is generated.
92
+
93
+ Returns:
94
+ go.Figure: A Plotly Figure containing Duval's Triangle plot.
95
+ """
96
+
97
+ # print("The data of recieved duval_points_list: ", duval_points_list)
98
+
99
+ data = [pd_region, d1_region, d2_region, dt_region, t1_region, t2_region, t3_region]
100
+ data.extend(duval_points_list)
101
+
102
+ fig = go.Figure(data=data, layout = get_layout(equipment_name))
103
+ fig.update_layout(get_layout(equipment_name))
104
+
105
+ if show_plot:
106
+ fig.show()
107
+
108
+ return fig
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2023] [Subramanian Narayanan]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,49 @@
1
+ Metadata-Version: 2.1
2
+ Name: duvals-triangle-plotter
3
+ Version: 1.0
4
+ Summary: Duval's Triangle Plotter - Python library for generating Duval's Triangle plots
5
+ Home-page: https://github.com/yourusername/duvals_triangle_plotter
6
+ Author: Subramanian Narayanan
7
+ Author-email: your.email@example.com
8
+ License: MIT
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.6
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE.txt
17
+ Requires-Dist: plotly
18
+
19
+ # Duval's Triangle Plotter
20
+
21
+ Duval's Triangle Plotter is a Python library for generating Duval's Triangle plots, which are commonly used in Dissolved Gas Analysis (DGA) for monitoring power transformers.
22
+
23
+ ## Introduction
24
+
25
+ Duval's Triangle is a graphical representation used in DGA to analyze the concentration levels of different gases, such as methane, acetylene, and ethylene, dissolved in transformer oil. This project provides a Python library that allows users to easily create Duval's Triangle plots for their DGA data.
26
+
27
+ ## Features
28
+
29
+ - Generate Duval's Triangle plots with customizable configurations.
30
+ - Plot various regions on Duval's Triangle, such as PD (Partial Discharges), D1, D2, DT, T1, T2, and T3.
31
+ - Customize layout, colors, and symbols for better visualization.
32
+
33
+ ## Getting Started
34
+
35
+ ### Installation
36
+ ```bash
37
+ pip install duvals-triangle-plotter
38
+ ```
39
+
40
+ ### Usage
41
+ ```python
42
+ import duvals_triangle_plotter as dtp
43
+
44
+ duval_points = [
45
+ dtp.get_duval_points_traces([0.09], [0.0], [0.91], "2000-08-16")
46
+ ]
47
+
48
+ dtp.get_duvals_triangle_plot(duval_points, show_plot=True)
49
+ ```
@@ -0,0 +1,10 @@
1
+ duvals_triangle_plotter/__init__.py,sha256=w3NtmtwdimbCsBQIjBMRdDUXDD9CHekGNn-l67nxyiY,86
2
+ duvals_triangle_plotter/__main__.py,sha256=PIiQ3d9on5WkY4sqwiYe1mV6sgOB-HykP8mR072GLF4,325
3
+ duvals_triangle_plotter/constants.py,sha256=Zl6O6yW6VvVrFiOnhGXoZhSv-Hv_cQuYu1P4pdXch9E,4351
4
+ duvals_triangle_plotter/duvals_triangle_plotter.py,sha256=0W65FKtwqtkdm9jPWOzpoOL49VRqpq6eeR6DeSP1sgM,4842
5
+ duvals_triangle_plotter-1.0.dist-info/LICENSE.txt,sha256=TDDGmMjhDJb7QywlzDHIGUpc5r6tTPcxVcW7hlWXl2U,1101
6
+ duvals_triangle_plotter-1.0.dist-info/METADATA,sha256=0lWwZ99x2gKab53FRQfxOpWn-fJdb-T9C0EEl7q0k1w,1814
7
+ duvals_triangle_plotter-1.0.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
8
+ duvals_triangle_plotter-1.0.dist-info/entry_points.txt,sha256=n6XLTHFDS-Oc4MZTS5Uf3WjUz_5Gp3_ChFXxfbsaJdg,82
9
+ duvals_triangle_plotter-1.0.dist-info/top_level.txt,sha256=EYAYK9LA_S41GcGjJJyZkqn8Pa_9N6LH01X8_t3KhLI,24
10
+ duvals_triangle_plotter-1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.2)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ duvals_triangle_plotter = duvals_triangle_plotter.__main__:main
@@ -0,0 +1 @@
1
+ duvals_triangle_plotter