duvals-triangle-plotter 1.0__tar.gz → 1.2__tar.gz
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.
- duvals_triangle_plotter-1.2/PKG-INFO +65 -0
- duvals_triangle_plotter-1.2/README.md +28 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter/__init__.py +19 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter/constants.py +132 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter/duvals_triangle_plotter.py +142 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter.egg-info/PKG-INFO +65 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/duvals_triangle_plotter.egg-info/SOURCES.txt +1 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter.egg-info/entry_points.txt +2 -0
- duvals_triangle_plotter-1.2/duvals_triangle_plotter.egg-info/requires.txt +1 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/duvals_triangle_plotter.egg-info/top_level.txt +2 -0
- duvals_triangle_plotter-1.2/pyproject.toml +65 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/setup.py +13 -5
- duvals_triangle_plotter-1.0/PKG-INFO +0 -49
- duvals_triangle_plotter-1.0/README.md +0 -31
- duvals_triangle_plotter-1.0/duvals_triangle_plotter/__init__.py +0 -1
- duvals_triangle_plotter-1.0/duvals_triangle_plotter/constants.py +0 -115
- duvals_triangle_plotter-1.0/duvals_triangle_plotter/duvals_triangle_plotter.py +0 -108
- duvals_triangle_plotter-1.0/duvals_triangle_plotter.egg-info/PKG-INFO +0 -49
- duvals_triangle_plotter-1.0/duvals_triangle_plotter.egg-info/entry_points.txt +0 -2
- duvals_triangle_plotter-1.0/duvals_triangle_plotter.egg-info/requires.txt +0 -1
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/LICENSE.txt +0 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/MANIFEST.in +0 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/duvals_triangle_plotter/__main__.py +0 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/duvals_triangle_plotter.egg-info/dependency_links.txt +0 -0
- {duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: duvals-triangle-plotter
|
|
3
|
+
Version: 1.2
|
|
4
|
+
Summary: Duval's Triangle Plotter — Python library for generating Duval's Triangle plots for DGA
|
|
5
|
+
Home-page: https://nagusubra.github.io/duvals-triangle-plotter/
|
|
6
|
+
Author: Subramanian Narayanan
|
|
7
|
+
Author-email: Subramanian Narayanan <snarayan@nagusubra.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://nagusubra.github.io/duvals-triangle-plotter/
|
|
10
|
+
Project-URL: Documentation, https://nagusubra.github.io/duvals-triangle-plotter/
|
|
11
|
+
Project-URL: Repository, https://github.com/nagusubra/duvals-triangle-plotter
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/nagusubra/duvals-triangle-plotter/issues
|
|
13
|
+
Project-URL: Changelog, https://github.com/nagusubra/duvals-triangle-plotter/blob/main/CHANGELOG.txt
|
|
14
|
+
Keywords: duval,duvals-triangle,dga,dissolved-gas-analysis,transformer,power-transformer,fault-diagnosis,ternary-plot,plotly,visualization
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.6
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE.txt
|
|
33
|
+
Requires-Dist: plotly>=5.0
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# Duval's Triangle Plotter
|
|
39
|
+
|
|
40
|
+
Python library for generating [Duval's Triangle](https://nagusubra.github.io/duvals-triangle-plotter/) plots — a ternary diagnostic tool used in Dissolved Gas Analysis (DGA) for power transformer condition monitoring.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install duvals-triangle-plotter
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import duvals_triangle_plotter as dtp
|
|
52
|
+
|
|
53
|
+
trace = dtp.get_duval_points_traces(
|
|
54
|
+
[0.09], [0.0], [0.91], "2000-08-16"
|
|
55
|
+
)
|
|
56
|
+
fig = dtp.get_duvals_triangle_plot([trace], show_plot=True)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
Full documentation and API reference: [nagusubra.github.io/duvals-triangle-plotter](https://nagusubra.github.io/duvals-triangle-plotter/)
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Duval's Triangle Plotter
|
|
2
|
+
|
|
3
|
+
Python library for generating [Duval's Triangle](https://nagusubra.github.io/duvals-triangle-plotter/) plots — a ternary diagnostic tool used in Dissolved Gas Analysis (DGA) for power transformer condition monitoring.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install duvals-triangle-plotter
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import duvals_triangle_plotter as dtp
|
|
15
|
+
|
|
16
|
+
trace = dtp.get_duval_points_traces(
|
|
17
|
+
[0.09], [0.0], [0.91], "2000-08-16"
|
|
18
|
+
)
|
|
19
|
+
fig = dtp.get_duvals_triangle_plot([trace], show_plot=True)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Documentation
|
|
23
|
+
|
|
24
|
+
Full documentation and API reference: [nagusubra.github.io/duvals-triangle-plotter](https://nagusubra.github.io/duvals-triangle-plotter/)
|
|
25
|
+
|
|
26
|
+
## License
|
|
27
|
+
|
|
28
|
+
MIT
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""
|
|
2
|
+
duvals_triangle_plotter — Python library for generating Duval's Triangle plots.
|
|
3
|
+
|
|
4
|
+
Duval's Triangle is a ternary plot used in Dissolved Gas Analysis (DGA) to
|
|
5
|
+
diagnose faults in power transformers based on relative concentrations of
|
|
6
|
+
methane (CH4), acetylene (C2H2), and ethylene (C2H4).
|
|
7
|
+
|
|
8
|
+
Public API
|
|
9
|
+
----------
|
|
10
|
+
get_duval_points_traces(methane_points_list, acetylene_points_list,
|
|
11
|
+
ethylene_points_list, date)
|
|
12
|
+
Build a scatterternary trace dict from gas concentration data.
|
|
13
|
+
|
|
14
|
+
get_duvals_triangle_plot(duval_points_list, show_plot=False,
|
|
15
|
+
equipment_name="General Site")
|
|
16
|
+
Generate a complete Plotly Figure with fault regions and data traces.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
from .duvals_triangle_plotter import get_duval_points_traces, get_duvals_triangle_plot
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Region definitions for Duval's Triangle.
|
|
3
|
+
|
|
4
|
+
Each constant is a Plotly ``scatterternary`` trace that fills a polygon
|
|
5
|
+
corresponding to a specific fault type identified by Dissolved Gas Analysis.
|
|
6
|
+
|
|
7
|
+
The seven standard regions defined here are used by
|
|
8
|
+
``get_duvals_triangle_plot`` to render the diagnostic zones on the ternary
|
|
9
|
+
plot. Coordinates represent relative percentages of methane (a-axis),
|
|
10
|
+
acetylene (b-axis), and ethylene (c-axis) after normalising the three gas
|
|
11
|
+
concentrations to 100 %.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
pd_region = {
|
|
15
|
+
# PD — Corona / Partial Discharges.
|
|
16
|
+
# Low-energy electrical discharges within gas-filled cavities in the
|
|
17
|
+
# insulation. Typically the first sign of insulation aging.
|
|
18
|
+
"uid": "pd_region",
|
|
19
|
+
"a": [98, 1, 98],
|
|
20
|
+
"b": [0, 0, 2],
|
|
21
|
+
"c": [2, 0, 0],
|
|
22
|
+
"fill": "toself",
|
|
23
|
+
"line": {"color": "#444"},
|
|
24
|
+
"mode": "lines",
|
|
25
|
+
"text": "PD",
|
|
26
|
+
"type": "scatterternary",
|
|
27
|
+
"fillcolor": "#b3de69",
|
|
28
|
+
"name": "PD - Corona Partial Discharges"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
d1_region = {
|
|
32
|
+
# D1 — Electrical Discharges of Low Energy.
|
|
33
|
+
# Low-energy sparking or arcing, often associated with poor connections or
|
|
34
|
+
# floating-potential components.
|
|
35
|
+
"uid": "d1_region",
|
|
36
|
+
"a": [0, 0, 64, 87],
|
|
37
|
+
"b": [1, 77, 13, 13],
|
|
38
|
+
"c": [0, 23, 23, 0],
|
|
39
|
+
"fill": "toself",
|
|
40
|
+
"line": {"color": "#444"},
|
|
41
|
+
"mode": "lines",
|
|
42
|
+
"text": "D1",
|
|
43
|
+
"type": "scatterternary",
|
|
44
|
+
"fillcolor": "#ffffb3",
|
|
45
|
+
"name": "D1 - Electrical Discharges of Low Energy"
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
d2_region = {
|
|
49
|
+
# D2 — Electrical Discharges of High Energy.
|
|
50
|
+
# High-energy arcing capable of producing significant volumes of fault gas
|
|
51
|
+
# and causing rapid insulation degradation.
|
|
52
|
+
"uid": "d2_region",
|
|
53
|
+
"a": [0, 0, 31, 47, 64],
|
|
54
|
+
"b": [77, 29, 29, 13, 13],
|
|
55
|
+
"c": [23, 71, 40, 40, 23],
|
|
56
|
+
"fill": "toself",
|
|
57
|
+
"line": {"color": "#444"},
|
|
58
|
+
"mode": "lines",
|
|
59
|
+
"text": "D2",
|
|
60
|
+
"type": "scatterternary",
|
|
61
|
+
"fillcolor": "#bebada",
|
|
62
|
+
"name": "D2 - Electrical Discharges of High Energy"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
dt_region = {
|
|
66
|
+
# DT — Electrical and Thermal Fault (Mixed).
|
|
67
|
+
# A mixed-fault zone where both electrical discharges and thermal
|
|
68
|
+
# decomposition contribute to the gas profile.
|
|
69
|
+
"uid": "dt_region",
|
|
70
|
+
"a": [0, 0, 35, 46, 96, 87, 47, 31],
|
|
71
|
+
"b": [29, 15, 15, 4, 4, 13, 13, 29],
|
|
72
|
+
"c": [71, 85, 50, 50, 0, 0, 40, 40],
|
|
73
|
+
"fill": "toself",
|
|
74
|
+
"line": {"color": "#444"},
|
|
75
|
+
"mode": "lines",
|
|
76
|
+
"text": "DT",
|
|
77
|
+
"hoverlabel": {"font": {"color": "black"}},
|
|
78
|
+
"type": "scatterternary",
|
|
79
|
+
"fillcolor": "#fb8072",
|
|
80
|
+
"name": "DT - Electrical and Thermal Fault"
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
t1_region = {
|
|
84
|
+
# T1 — Thermal Faults, T < 300 C.
|
|
85
|
+
# Low-temperature thermal faults, typically from prolonged overload or
|
|
86
|
+
# inadequate cooling.
|
|
87
|
+
"uid": "t1_region",
|
|
88
|
+
"a": [76, 80, 98, 98, 96],
|
|
89
|
+
"b": [4, 0, 0, 2, 4],
|
|
90
|
+
"c": [20, 20, 2, 0, 0],
|
|
91
|
+
"fill": "toself",
|
|
92
|
+
"line": {"color": "#444"},
|
|
93
|
+
"mode": "lines",
|
|
94
|
+
"text": "T1",
|
|
95
|
+
"type": "scatterternary",
|
|
96
|
+
"fillcolor": "#80b1d3",
|
|
97
|
+
"name": "T1 - Thermal Faults, T<300C"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
t2_region = {
|
|
101
|
+
# T2 — Thermal Faults, 300 C < T < 700 C.
|
|
102
|
+
# Medium-temperature thermal faults, often from localised hot spots in the
|
|
103
|
+
# core or windings.
|
|
104
|
+
"uid": "t2_region",
|
|
105
|
+
"a": [46, 50, 80, 76],
|
|
106
|
+
"b": [4, 0, 0, 4],
|
|
107
|
+
"c": [50, 50, 20, 20],
|
|
108
|
+
"fill": "toself",
|
|
109
|
+
"line": {"color": "#444"},
|
|
110
|
+
"mode": "lines",
|
|
111
|
+
"text": "T2",
|
|
112
|
+
"type": "scatterternary",
|
|
113
|
+
"fillcolor": "#fdb462",
|
|
114
|
+
"name": "T2 - Thermal Faults, 300C<T<700C"
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
t3_region = {
|
|
118
|
+
# T3 — Thermal Faults, T > 700 C.
|
|
119
|
+
# High-temperature thermal faults, typically from sustained arcing or
|
|
120
|
+
# severe core overheating.
|
|
121
|
+
"uid": "t3_region",
|
|
122
|
+
"a": [0, 0, 50, 35],
|
|
123
|
+
"b": [15, 0, 0, 15],
|
|
124
|
+
"c": [85, 1, 50, 50],
|
|
125
|
+
"fill": "toself",
|
|
126
|
+
"line": {"color": "#444"},
|
|
127
|
+
"mode": "lines",
|
|
128
|
+
"text": "T3",
|
|
129
|
+
"type": "scatterternary",
|
|
130
|
+
"fillcolor": "#8dd3c7",
|
|
131
|
+
"name": "T3 - Thermal Faults, T>700C"
|
|
132
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
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
|
+
|
|
5
|
+
def get_layout(equipment_name: str):
|
|
6
|
+
"""Build a layout dictionary for the Duval's Triangle ternary plot.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
equipment_name : str
|
|
11
|
+
Name of the transformer or equipment displayed in the plot title.
|
|
12
|
+
|
|
13
|
+
Returns
|
|
14
|
+
-------
|
|
15
|
+
dict
|
|
16
|
+
Plotly layout configuration with ternary axes, margins, and title.
|
|
17
|
+
|
|
18
|
+
Examples
|
|
19
|
+
--------
|
|
20
|
+
>>> layout = get_layout("Transformer A")
|
|
21
|
+
>>> layout["title"]
|
|
22
|
+
"<b>Duval's Triangle (Dissolved Gas Analysis) for : Transformer A</b>"
|
|
23
|
+
"""
|
|
24
|
+
layout = {
|
|
25
|
+
"title": "<b>Duval's Triangle (Dissolved Gas Analysis) for : {0}</b>".format(equipment_name),
|
|
26
|
+
"width": 1044*1.8,
|
|
27
|
+
"height": 545*1.8,
|
|
28
|
+
"ternary": {
|
|
29
|
+
"sum": 100,
|
|
30
|
+
"aaxis": {
|
|
31
|
+
"min": 0.01,
|
|
32
|
+
"ticks": "outside",
|
|
33
|
+
"title": "<b> CH4 (Methane) </b>",
|
|
34
|
+
"linewidth": 8,
|
|
35
|
+
"ticksuffix": "%",
|
|
36
|
+
},
|
|
37
|
+
"baxis": {
|
|
38
|
+
"min": 0.01,
|
|
39
|
+
"ticks": "outside",
|
|
40
|
+
"title": "<b> C2H2 (Acetylene) </b>",
|
|
41
|
+
"linewidth": 8,
|
|
42
|
+
"ticksuffix": "%"
|
|
43
|
+
},
|
|
44
|
+
"caxis": {
|
|
45
|
+
"min": 0.01,
|
|
46
|
+
"ticks": "outside",
|
|
47
|
+
"title": "<b> C2H4 (Ethylene) </b>",
|
|
48
|
+
"linewidth": 8,
|
|
49
|
+
"ticksuffix": "%"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"autosize": True,
|
|
53
|
+
"showlegend": True,
|
|
54
|
+
"margin": {"pad":100},
|
|
55
|
+
}
|
|
56
|
+
return layout
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def get_duval_points_traces(methane_points_list: list, acetylene_points_list: list, ethylene_points_list: list, date: str):
|
|
60
|
+
"""Create a Plotly scatterternary trace from gas concentration data.
|
|
61
|
+
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
methane_points_list : list of float
|
|
65
|
+
Concentration of methane (CH4) for each sample, in ppm.
|
|
66
|
+
acetylene_points_list : list of float
|
|
67
|
+
Concentration of acetylene (C2H2) for each sample, in ppm.
|
|
68
|
+
ethylene_points_list : list of float
|
|
69
|
+
Concentration of ethylene (C2H4) for each sample, in ppm.
|
|
70
|
+
date : str
|
|
71
|
+
Label or date associated with the samples (displayed in legend and hover).
|
|
72
|
+
|
|
73
|
+
Returns
|
|
74
|
+
-------
|
|
75
|
+
dict
|
|
76
|
+
A dict representing a Plotly ``scatterternary`` trace, ready to be
|
|
77
|
+
passed to ``get_duvals_triangle_plot``.
|
|
78
|
+
|
|
79
|
+
Examples
|
|
80
|
+
--------
|
|
81
|
+
>>> trace = get_duval_points_traces([0.09], [0.0], [0.91], "2000-08-16")
|
|
82
|
+
>>> trace["type"]
|
|
83
|
+
'scatterternary'
|
|
84
|
+
"""
|
|
85
|
+
duval_points = {
|
|
86
|
+
"a": methane_points_list,
|
|
87
|
+
"b": acetylene_points_list,
|
|
88
|
+
"c": ethylene_points_list,
|
|
89
|
+
"mode": "markers",
|
|
90
|
+
"type": "scatterternary",
|
|
91
|
+
"marker": {
|
|
92
|
+
"size": 18,
|
|
93
|
+
"color": "black",
|
|
94
|
+
"symbol": 217,
|
|
95
|
+
},
|
|
96
|
+
"cliponaxis": True,
|
|
97
|
+
"hovertemplate": "Sample Date: {0}<br>".format(date) + "Methane (CH4): %{a:.2f}%<br>" + "Acetylene (C2H2): %{b:.2f}%<br>" + "Ethylene (C2H4): %{c:.2f}%<br>",
|
|
98
|
+
"name": "Sample Date: {0}<br>".format(date)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return duval_points
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def get_duvals_triangle_plot(duval_points_list: list, show_plot:bool = False, equipment_name:str = "General Site"):
|
|
105
|
+
"""Generate a complete Duval's Triangle Plotly Figure.
|
|
106
|
+
|
|
107
|
+
The figure overlays the seven standard fault regions (PD, D1, D2, DT, T1,
|
|
108
|
+
T2, T3) with the user-supplied data traces.
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
duval_points_list : list of dict
|
|
113
|
+
One or more scatterternary trace dicts, typically created by
|
|
114
|
+
``get_duval_points_traces``.
|
|
115
|
+
show_plot : bool, optional
|
|
116
|
+
If True, display the figure immediately in the browser (default False).
|
|
117
|
+
equipment_name : str, optional
|
|
118
|
+
Name of the equipment shown in the plot title (default "General Site").
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
go.Figure
|
|
123
|
+
A Plotly Figure containing the Duval's Triangle plot with fault
|
|
124
|
+
regions and data points.
|
|
125
|
+
|
|
126
|
+
Examples
|
|
127
|
+
--------
|
|
128
|
+
>>> trace = get_duval_points_traces([0.09], [0.0], [0.91], "2000-08-16")
|
|
129
|
+
>>> fig = get_duvals_triangle_plot([trace], show_plot=False)
|
|
130
|
+
>>> isinstance(fig, go.Figure)
|
|
131
|
+
True
|
|
132
|
+
"""
|
|
133
|
+
data = [pd_region, d1_region, d2_region, dt_region, t1_region, t2_region, t3_region]
|
|
134
|
+
data.extend(duval_points_list)
|
|
135
|
+
|
|
136
|
+
fig = go.Figure(data=data, layout = get_layout(equipment_name))
|
|
137
|
+
fig.update_layout(get_layout(equipment_name))
|
|
138
|
+
|
|
139
|
+
if show_plot:
|
|
140
|
+
fig.show()
|
|
141
|
+
|
|
142
|
+
return fig
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: duvals-triangle-plotter
|
|
3
|
+
Version: 1.2
|
|
4
|
+
Summary: Duval's Triangle Plotter — Python library for generating Duval's Triangle plots for DGA
|
|
5
|
+
Home-page: https://nagusubra.github.io/duvals-triangle-plotter/
|
|
6
|
+
Author: Subramanian Narayanan
|
|
7
|
+
Author-email: Subramanian Narayanan <snarayan@nagusubra.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://nagusubra.github.io/duvals-triangle-plotter/
|
|
10
|
+
Project-URL: Documentation, https://nagusubra.github.io/duvals-triangle-plotter/
|
|
11
|
+
Project-URL: Repository, https://github.com/nagusubra/duvals-triangle-plotter
|
|
12
|
+
Project-URL: Bug Tracker, https://github.com/nagusubra/duvals-triangle-plotter/issues
|
|
13
|
+
Project-URL: Changelog, https://github.com/nagusubra/duvals-triangle-plotter/blob/main/CHANGELOG.txt
|
|
14
|
+
Keywords: duval,duvals-triangle,dga,dissolved-gas-analysis,transformer,power-transformer,fault-diagnosis,ternary-plot,plotly,visualization
|
|
15
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
16
|
+
Classifier: Intended Audience :: Science/Research
|
|
17
|
+
Classifier: Natural Language :: English
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.6
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
27
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
28
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
29
|
+
Classifier: Typing :: Typed
|
|
30
|
+
Requires-Python: >=3.6
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
License-File: LICENSE.txt
|
|
33
|
+
Requires-Dist: plotly>=5.0
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# Duval's Triangle Plotter
|
|
39
|
+
|
|
40
|
+
Python library for generating [Duval's Triangle](https://nagusubra.github.io/duvals-triangle-plotter/) plots — a ternary diagnostic tool used in Dissolved Gas Analysis (DGA) for power transformer condition monitoring.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install duvals-triangle-plotter
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import duvals_triangle_plotter as dtp
|
|
52
|
+
|
|
53
|
+
trace = dtp.get_duval_points_traces(
|
|
54
|
+
[0.09], [0.0], [0.91], "2000-08-16"
|
|
55
|
+
)
|
|
56
|
+
fig = dtp.get_duvals_triangle_plot([trace], show_plot=True)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Documentation
|
|
60
|
+
|
|
61
|
+
Full documentation and API reference: [nagusubra.github.io/duvals-triangle-plotter](https://nagusubra.github.io/duvals-triangle-plotter/)
|
|
62
|
+
|
|
63
|
+
## License
|
|
64
|
+
|
|
65
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
plotly>=5.0
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "duvals-triangle-plotter"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Duval's Triangle Plotter — Python library for generating Duval's Triangle plots for DGA"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.6"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Subramanian Narayanan", email = "snarayan@nagusubra.com"},
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"duval",
|
|
17
|
+
"duvals-triangle",
|
|
18
|
+
"dga",
|
|
19
|
+
"dissolved-gas-analysis",
|
|
20
|
+
"transformer",
|
|
21
|
+
"power-transformer",
|
|
22
|
+
"fault-diagnosis",
|
|
23
|
+
"ternary-plot",
|
|
24
|
+
"plotly",
|
|
25
|
+
"visualization",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 5 - Production/Stable",
|
|
29
|
+
"Intended Audience :: Science/Research",
|
|
30
|
+
"Natural Language :: English",
|
|
31
|
+
"Operating System :: OS Independent",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
|
+
"Programming Language :: Python :: 3.6",
|
|
34
|
+
"Programming Language :: Python :: 3.7",
|
|
35
|
+
"Programming Language :: Python :: 3.8",
|
|
36
|
+
"Programming Language :: Python :: 3.9",
|
|
37
|
+
"Programming Language :: Python :: 3.10",
|
|
38
|
+
"Programming Language :: Python :: 3.11",
|
|
39
|
+
"Programming Language :: Python :: 3.12",
|
|
40
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
41
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
42
|
+
"Typing :: Typed",
|
|
43
|
+
]
|
|
44
|
+
dependencies = [
|
|
45
|
+
"plotly>=5.0",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.urls]
|
|
49
|
+
Homepage = "https://nagusubra.github.io/duvals-triangle-plotter/"
|
|
50
|
+
Documentation = "https://nagusubra.github.io/duvals-triangle-plotter/"
|
|
51
|
+
Repository = "https://github.com/nagusubra/duvals-triangle-plotter"
|
|
52
|
+
"Bug Tracker" = "https://github.com/nagusubra/duvals-triangle-plotter/issues"
|
|
53
|
+
"Changelog" = "https://github.com/nagusubra/duvals-triangle-plotter/blob/main/CHANGELOG.txt"
|
|
54
|
+
|
|
55
|
+
[project.scripts]
|
|
56
|
+
duvals-triangle-plotter = "duvals_triangle_plotter.__main__:main"
|
|
57
|
+
|
|
58
|
+
[tool.setuptools]
|
|
59
|
+
packages = {find = {}}
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.package-data]
|
|
62
|
+
duvals_triangle_plotter = ["*.py", "py.typed"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
testpaths = ["test_duvals_triangle_plotter.py"]
|
|
@@ -2,11 +2,10 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name='duvals_triangle_plotter',
|
|
5
|
-
version='1.
|
|
5
|
+
version='1.2',
|
|
6
6
|
packages=find_packages(),
|
|
7
7
|
install_requires=[
|
|
8
8
|
'plotly',
|
|
9
|
-
# Add any other dependencies here
|
|
10
9
|
],
|
|
11
10
|
entry_points={
|
|
12
11
|
'console_scripts': [
|
|
@@ -15,11 +14,15 @@ setup(
|
|
|
15
14
|
},
|
|
16
15
|
include_package_data=True,
|
|
17
16
|
author='Subramanian Narayanan',
|
|
18
|
-
author_email='
|
|
19
|
-
description="Duval's Triangle Plotter
|
|
17
|
+
author_email='snarayan@nagusubra.com',
|
|
18
|
+
description="Duval's Triangle Plotter — Python library for generating Duval's Triangle plots for DGA",
|
|
20
19
|
long_description=open('README.md').read(),
|
|
21
20
|
long_description_content_type='text/markdown',
|
|
22
|
-
url='https://github.
|
|
21
|
+
url='https://nagusubra.github.io/duvals-triangle-plotter/',
|
|
22
|
+
project_urls={
|
|
23
|
+
'Source Code': 'https://github.com/nagusubra/duvals-triangle-plotter',
|
|
24
|
+
'Bug Tracker': 'https://github.com/nagusubra/duvals-triangle-plotter/issues',
|
|
25
|
+
},
|
|
23
26
|
license='MIT',
|
|
24
27
|
classifiers=[
|
|
25
28
|
'License :: OSI Approved :: MIT License',
|
|
@@ -28,5 +31,10 @@ setup(
|
|
|
28
31
|
'Programming Language :: Python :: 3.7',
|
|
29
32
|
'Programming Language :: Python :: 3.8',
|
|
30
33
|
'Programming Language :: Python :: 3.9',
|
|
34
|
+
'Programming Language :: Python :: 3.10',
|
|
35
|
+
'Programming Language :: Python :: 3.11',
|
|
36
|
+
'Programming Language :: Python :: 3.12',
|
|
37
|
+
'Topic :: Scientific/Engineering :: Visualization',
|
|
38
|
+
'Intended Audience :: Science/Research',
|
|
31
39
|
],
|
|
32
40
|
)
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Duval's Triangle Plotter
|
|
2
|
-
|
|
3
|
-
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.
|
|
4
|
-
|
|
5
|
-
## Introduction
|
|
6
|
-
|
|
7
|
-
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.
|
|
8
|
-
|
|
9
|
-
## Features
|
|
10
|
-
|
|
11
|
-
- Generate Duval's Triangle plots with customizable configurations.
|
|
12
|
-
- Plot various regions on Duval's Triangle, such as PD (Partial Discharges), D1, D2, DT, T1, T2, and T3.
|
|
13
|
-
- Customize layout, colors, and symbols for better visualization.
|
|
14
|
-
|
|
15
|
-
## Getting Started
|
|
16
|
-
|
|
17
|
-
### Installation
|
|
18
|
-
```bash
|
|
19
|
-
pip install duvals-triangle-plotter
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### Usage
|
|
23
|
-
```python
|
|
24
|
-
import duvals_triangle_plotter as dtp
|
|
25
|
-
|
|
26
|
-
duval_points = [
|
|
27
|
-
dtp.get_duval_points_traces([0.09], [0.0], [0.91], "2000-08-16")
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
dtp.get_duvals_triangle_plot(duval_points, show_plot=True)
|
|
31
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
from .duvals_triangle_plotter import get_duval_points_traces, get_duvals_triangle_plot
|
|
@@ -1,115 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
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
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
plotly
|
|
File without changes
|
|
File without changes
|
{duvals_triangle_plotter-1.0 → duvals_triangle_plotter-1.2}/duvals_triangle_plotter/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|