DiaModality 0.1.3__tar.gz → 0.1.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DiaModality
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Tool to plot modality vector diagrams
5
5
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
6
6
  License: MIT License
@@ -98,49 +98,54 @@ import DiaModality.CsvParser as csv
98
98
  import DiaModality.ModalityPlot as plt
99
99
  import os
100
100
 
101
- # input file:
102
- files = 'modality_data.csv'
101
+ # input files:
102
+ files = ['modality_data.csv']
103
103
 
104
- # Get full path of input files
104
+ # Get full path
105
105
  script_dir = os.path.dirname(os.path.realpath(__file__))
106
- file_path = os.path.join(script_dir, file)
107
-
108
- # Parse data from csv file
109
- new_csv = csv.LoadCsv(file_path)
110
- data, binarization = new_csv.ParseCsv(3, 3)
111
-
112
- # Make figure:
113
- plot = plt.ModalityPlot(
114
- data,
115
- binarization,
116
- modalities=['Set 1', 'Set 2', 'Set 3'],
117
- angles=[210, 90, 330],
118
- labels=False,
119
- scalecircle=0.5, # Scale circle radius
120
- scalecircle_linestyle=':',
121
- scalecircle_linewidth=0.75,
122
- marker='', # vector endpoints marker
123
- linestyle='-',
124
- linewidth=0.5,
125
- alpha=0.5,
126
- same_scale=False, # Draw all the subplots in the same scale
127
- full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
128
- whole_sum=True, # Calculate all three modality vectors despite binarization
129
- figsize=(10, 10),
130
- title='Modality Diagram Example',
131
- colors=(
132
- 'tab:green', # Set 1 color
133
- 'navy', # Set 2 color
134
- 'tab:red', # Set 3 color
135
- '#1E88E5', # Sets 1 & 2 intersection color
136
- '#FF9933', # Sets 1 & 3 intersection color
137
- '#9900FF', # Sets 2 & 3 intersection color
138
- 'black', # All sets intersection color
139
- ),
140
- )
141
-
142
- plot.save(file_path, type='png', transparent=False)
143
- plot.show()
106
+
107
+ for file in files:
108
+
109
+ # Get full path of input files
110
+ file_path = os.path.join(script_dir, file)
111
+
112
+ # Parse data from csv file
113
+ new_csv = csv.LoadCsv(file_path)
114
+ data, binarization = new_csv.ParseCsv(3, 3)
115
+
116
+ # Make figure:
117
+ plot = plt.ModalityPlot(
118
+ data,
119
+ binarization,
120
+ modalities=[
121
+ 'Set 1', 'Set 2', 'Set 3'],
122
+ angles=[210, 90, 330],
123
+ labels=False,
124
+ scalecircle=0.5, # Scale circle radius
125
+ scalecircle_linestyle=':',
126
+ scalecircle_linewidth=0.75,
127
+ marker='', # vector endpoints marker
128
+ linestyle='-',
129
+ linewidth=0.5,
130
+ alpha=0.5,
131
+ same_scale=False, # Draw all the subplots in the same scale
132
+ full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
133
+ whole_sum=True, # Calculate all three modality vectors despite binarization
134
+ figsize=(10, 10),
135
+ title='Modality Diagram Example',
136
+ colors=(
137
+ 'tab:green', # Set 1 color
138
+ 'navy', # Set 2 color
139
+ 'tab:red', # Set 3 color
140
+ '#1E88E5', # Sets 1 & 2 intersection color
141
+ '#FF9933', # Sets 1 & 3 intersection color
142
+ '#9900FF', # Sets 2 & 3 intersection color
143
+ 'black', # All sets intersection color
144
+ ),
145
+ )
146
+
147
+ plot.save(file_path, type='png', transparent=False)
148
+ plot.show()
144
149
  ```
145
150
 
146
151
  Source page:
@@ -0,0 +1,113 @@
1
+ # DiaModality - The Modality Diagram
2
+
3
+ Simple tool to plot vector modality diagram
4
+
5
+ ### To install package run the command:
6
+ ```bash
7
+ pip install diamodality
8
+ ```
9
+
10
+
11
+ ### How to use:
12
+ See the /demo directory on Git repo or
13
+ create and run the following two files:
14
+
15
+ ---
16
+ ``generate_sample_data.py``:
17
+ ```python
18
+ import csv
19
+ import random
20
+ import os
21
+
22
+ num_rows = 1500
23
+ output_file = 'modality_data.csv'
24
+
25
+ # locate working directory
26
+ script_dir = os.path.dirname(os.path.realpath(__file__))
27
+ file_path = os.path.join(script_dir, output_file)
28
+
29
+ # Open a new CSV file to write the data
30
+ with open(file_path, mode='w', newline='') as file:
31
+ writer = csv.writer(file)
32
+
33
+ # Generate the data
34
+ signal_treshold = 1.5
35
+ for _ in range(num_rows):
36
+
37
+ # generate data columns:
38
+ col1 = random.uniform(0, 2.7)
39
+ col2 = random.uniform(0, 3.3)
40
+ col3 = random.uniform(0, 7.3)
41
+
42
+ # generate binarization columns:
43
+ col4 = 1 if col1 > signal_treshold else ''
44
+ col5 = 1 if col2 > signal_treshold else ''
45
+ col6 = 1 if col3 > signal_treshold else ''
46
+
47
+ writer.writerow([col1, col2, col3, col4, col5, col6])
48
+
49
+ ```
50
+
51
+
52
+ ---
53
+ ``plot_sample_data.py``:
54
+ ```python
55
+ import DiaModality.CsvParser as csv
56
+ import DiaModality.ModalityPlot as plt
57
+ import os
58
+
59
+ # input files:
60
+ files = ['modality_data.csv']
61
+
62
+ # Get full path
63
+ script_dir = os.path.dirname(os.path.realpath(__file__))
64
+
65
+ for file in files:
66
+
67
+ # Get full path of input files
68
+ file_path = os.path.join(script_dir, file)
69
+
70
+ # Parse data from csv file
71
+ new_csv = csv.LoadCsv(file_path)
72
+ data, binarization = new_csv.ParseCsv(3, 3)
73
+
74
+ # Make figure:
75
+ plot = plt.ModalityPlot(
76
+ data,
77
+ binarization,
78
+ modalities=[
79
+ 'Set 1', 'Set 2', 'Set 3'],
80
+ angles=[210, 90, 330],
81
+ labels=False,
82
+ scalecircle=0.5, # Scale circle radius
83
+ scalecircle_linestyle=':',
84
+ scalecircle_linewidth=0.75,
85
+ marker='', # vector endpoints marker
86
+ linestyle='-',
87
+ linewidth=0.5,
88
+ alpha=0.5,
89
+ same_scale=False, # Draw all the subplots in the same scale
90
+ full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
91
+ whole_sum=True, # Calculate all three modality vectors despite binarization
92
+ figsize=(10, 10),
93
+ title='Modality Diagram Example',
94
+ colors=(
95
+ 'tab:green', # Set 1 color
96
+ 'navy', # Set 2 color
97
+ 'tab:red', # Set 3 color
98
+ '#1E88E5', # Sets 1 & 2 intersection color
99
+ '#FF9933', # Sets 1 & 3 intersection color
100
+ '#9900FF', # Sets 2 & 3 intersection color
101
+ 'black', # All sets intersection color
102
+ ),
103
+ )
104
+
105
+ plot.save(file_path, type='png', transparent=False)
106
+ plot.show()
107
+ ```
108
+
109
+ Source page:
110
+ https://github.com/konung-yaropolk/DiaModality
111
+
112
+
113
+ ![modality_data csv](https://github.com/user-attachments/assets/eb77b4d7-281f-45b0-a5ce-4c2442fc9a75)
@@ -0,0 +1 @@
1
+ __version__ = "0.1.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DiaModality
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Tool to plot modality vector diagrams
5
5
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
6
6
  License: MIT License
@@ -98,49 +98,54 @@ import DiaModality.CsvParser as csv
98
98
  import DiaModality.ModalityPlot as plt
99
99
  import os
100
100
 
101
- # input file:
102
- files = 'modality_data.csv'
101
+ # input files:
102
+ files = ['modality_data.csv']
103
103
 
104
- # Get full path of input files
104
+ # Get full path
105
105
  script_dir = os.path.dirname(os.path.realpath(__file__))
106
- file_path = os.path.join(script_dir, file)
107
-
108
- # Parse data from csv file
109
- new_csv = csv.LoadCsv(file_path)
110
- data, binarization = new_csv.ParseCsv(3, 3)
111
-
112
- # Make figure:
113
- plot = plt.ModalityPlot(
114
- data,
115
- binarization,
116
- modalities=['Set 1', 'Set 2', 'Set 3'],
117
- angles=[210, 90, 330],
118
- labels=False,
119
- scalecircle=0.5, # Scale circle radius
120
- scalecircle_linestyle=':',
121
- scalecircle_linewidth=0.75,
122
- marker='', # vector endpoints marker
123
- linestyle='-',
124
- linewidth=0.5,
125
- alpha=0.5,
126
- same_scale=False, # Draw all the subplots in the same scale
127
- full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
128
- whole_sum=True, # Calculate all three modality vectors despite binarization
129
- figsize=(10, 10),
130
- title='Modality Diagram Example',
131
- colors=(
132
- 'tab:green', # Set 1 color
133
- 'navy', # Set 2 color
134
- 'tab:red', # Set 3 color
135
- '#1E88E5', # Sets 1 & 2 intersection color
136
- '#FF9933', # Sets 1 & 3 intersection color
137
- '#9900FF', # Sets 2 & 3 intersection color
138
- 'black', # All sets intersection color
139
- ),
140
- )
141
-
142
- plot.save(file_path, type='png', transparent=False)
143
- plot.show()
106
+
107
+ for file in files:
108
+
109
+ # Get full path of input files
110
+ file_path = os.path.join(script_dir, file)
111
+
112
+ # Parse data from csv file
113
+ new_csv = csv.LoadCsv(file_path)
114
+ data, binarization = new_csv.ParseCsv(3, 3)
115
+
116
+ # Make figure:
117
+ plot = plt.ModalityPlot(
118
+ data,
119
+ binarization,
120
+ modalities=[
121
+ 'Set 1', 'Set 2', 'Set 3'],
122
+ angles=[210, 90, 330],
123
+ labels=False,
124
+ scalecircle=0.5, # Scale circle radius
125
+ scalecircle_linestyle=':',
126
+ scalecircle_linewidth=0.75,
127
+ marker='', # vector endpoints marker
128
+ linestyle='-',
129
+ linewidth=0.5,
130
+ alpha=0.5,
131
+ same_scale=False, # Draw all the subplots in the same scale
132
+ full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
133
+ whole_sum=True, # Calculate all three modality vectors despite binarization
134
+ figsize=(10, 10),
135
+ title='Modality Diagram Example',
136
+ colors=(
137
+ 'tab:green', # Set 1 color
138
+ 'navy', # Set 2 color
139
+ 'tab:red', # Set 3 color
140
+ '#1E88E5', # Sets 1 & 2 intersection color
141
+ '#FF9933', # Sets 1 & 3 intersection color
142
+ '#9900FF', # Sets 2 & 3 intersection color
143
+ 'black', # All sets intersection color
144
+ ),
145
+ )
146
+
147
+ plot.save(file_path, type='png', transparent=False)
148
+ plot.show()
144
149
  ```
145
150
 
146
151
  Source page:
@@ -1,108 +0,0 @@
1
- # DiaModality - The Modality Diagram
2
-
3
- Simple tool to plot vector modality diagram
4
-
5
- ### To install package run the command:
6
- ```bash
7
- pip install diamodality
8
- ```
9
-
10
-
11
- ### How to use:
12
- See the /demo directory on Git repo or
13
- create and run the following two files:
14
-
15
- ---
16
- ``generate_sample_data.py``:
17
- ```python
18
- import csv
19
- import random
20
- import os
21
-
22
- num_rows = 1500
23
- output_file = 'modality_data.csv'
24
-
25
- # locate working directory
26
- script_dir = os.path.dirname(os.path.realpath(__file__))
27
- file_path = os.path.join(script_dir, output_file)
28
-
29
- # Open a new CSV file to write the data
30
- with open(file_path, mode='w', newline='') as file:
31
- writer = csv.writer(file)
32
-
33
- # Generate the data
34
- signal_treshold = 1.5
35
- for _ in range(num_rows):
36
-
37
- # generate data columns:
38
- col1 = random.uniform(0, 2.7)
39
- col2 = random.uniform(0, 3.3)
40
- col3 = random.uniform(0, 7.3)
41
-
42
- # generate binarization columns:
43
- col4 = 1 if col1 > signal_treshold else ''
44
- col5 = 1 if col2 > signal_treshold else ''
45
- col6 = 1 if col3 > signal_treshold else ''
46
-
47
- writer.writerow([col1, col2, col3, col4, col5, col6])
48
-
49
- ```
50
-
51
-
52
- ---
53
- ``plot_sample_data.py``:
54
- ```python
55
- import DiaModality.CsvParser as csv
56
- import DiaModality.ModalityPlot as plt
57
- import os
58
-
59
- # input file:
60
- files = 'modality_data.csv'
61
-
62
- # Get full path of input files
63
- script_dir = os.path.dirname(os.path.realpath(__file__))
64
- file_path = os.path.join(script_dir, file)
65
-
66
- # Parse data from csv file
67
- new_csv = csv.LoadCsv(file_path)
68
- data, binarization = new_csv.ParseCsv(3, 3)
69
-
70
- # Make figure:
71
- plot = plt.ModalityPlot(
72
- data,
73
- binarization,
74
- modalities=['Set 1', 'Set 2', 'Set 3'],
75
- angles=[210, 90, 330],
76
- labels=False,
77
- scalecircle=0.5, # Scale circle radius
78
- scalecircle_linestyle=':',
79
- scalecircle_linewidth=0.75,
80
- marker='', # vector endpoints marker
81
- linestyle='-',
82
- linewidth=0.5,
83
- alpha=0.5,
84
- same_scale=False, # Draw all the subplots in the same scale
85
- full_center=True, # Draw all vectors in the central subplot, else draw trimodal vectors only
86
- whole_sum=True, # Calculate all three modality vectors despite binarization
87
- figsize=(10, 10),
88
- title='Modality Diagram Example',
89
- colors=(
90
- 'tab:green', # Set 1 color
91
- 'navy', # Set 2 color
92
- 'tab:red', # Set 3 color
93
- '#1E88E5', # Sets 1 & 2 intersection color
94
- '#FF9933', # Sets 1 & 3 intersection color
95
- '#9900FF', # Sets 2 & 3 intersection color
96
- 'black', # All sets intersection color
97
- ),
98
- )
99
-
100
- plot.save(file_path, type='png', transparent=False)
101
- plot.show()
102
- ```
103
-
104
- Source page:
105
- https://github.com/konung-yaropolk/DiaModality
106
-
107
-
108
- ![modality_data csv](https://github.com/user-attachments/assets/eb77b4d7-281f-45b0-a5ce-4c2442fc9a75)
@@ -1 +0,0 @@
1
- __version__ = "0.1.3"
File without changes
File without changes
File without changes
File without changes