DiaModality 0.1.8__tar.gz → 0.2.1__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.8
3
+ Version: 0.2.1
4
4
  Summary: Tool to plot modality vector diagrams
5
5
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
6
6
  License: MIT License
@@ -27,7 +27,9 @@ License: MIT License
27
27
  Project-URL: Homepage, https://github.com/konung-yaropolk/DiaModality
28
28
  Project-URL: Issues, https://github.com/konung-yaropolk/DiaModality/issues
29
29
  Keywords: Visualization,Science,Plotting,Matplotlib
30
+ Classifier: Programming Language :: Python
30
31
  Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.12
31
33
  Classifier: License :: OSI Approved :: MIT License
32
34
  Classifier: Operating System :: OS Independent
33
35
  Classifier: Development Status :: 4 - Beta
@@ -39,6 +41,7 @@ Description-Content-Type: text/markdown
39
41
  License-File: LICENSE
40
42
  Requires-Dist: numpy
41
43
  Requires-Dist: matplotlib
44
+ Requires-Dist: scsv
42
45
 
43
46
  # DiaModality - The Modality Diagram
44
47
 
@@ -103,8 +106,8 @@ with open(file_path, mode='w', newline='') as file:
103
106
  ---
104
107
  ``plot_sample_data.py``:
105
108
  ```python
106
- import DiaModality.CsvParser as csv
107
109
  import DiaModality.ModalityPlot as plt
110
+ import scsv as csv
108
111
  import os
109
112
 
110
113
  # input files:
@@ -119,7 +122,7 @@ for file in files:
119
122
  file_path = os.path.join(script_dir, file)
120
123
 
121
124
  # Parse data from csv file
122
- new_csv = csv.LoadCsv(file_path)
125
+ new_csv = csv.OpenFile(file_path)
123
126
  data, binarization = new_csv.ParseCsv(3, 3)
124
127
 
125
128
  # Make figure:
@@ -141,6 +144,7 @@ for file in files:
141
144
  # else draw trimodal vectors only
142
145
  whole_sum=True, # Calculate all three modality vectors despite binarization
143
146
  figsize=(10, 10),
147
+ dpi=200,
144
148
  title='Modality Diagram Example',
145
149
  colors=(
146
150
  'tab:green', # Set 1 color
@@ -61,8 +61,8 @@ with open(file_path, mode='w', newline='') as file:
61
61
  ---
62
62
  ``plot_sample_data.py``:
63
63
  ```python
64
- import DiaModality.CsvParser as csv
65
64
  import DiaModality.ModalityPlot as plt
65
+ import scsv as csv
66
66
  import os
67
67
 
68
68
  # input files:
@@ -77,7 +77,7 @@ for file in files:
77
77
  file_path = os.path.join(script_dir, file)
78
78
 
79
79
  # Parse data from csv file
80
- new_csv = csv.LoadCsv(file_path)
80
+ new_csv = csv.OpenFile(file_path)
81
81
  data, binarization = new_csv.ParseCsv(3, 3)
82
82
 
83
83
  # Make figure:
@@ -99,6 +99,7 @@ for file in files:
99
99
  # else draw trimodal vectors only
100
100
  whole_sum=True, # Calculate all three modality vectors despite binarization
101
101
  figsize=(10, 10),
102
+ dpi=200,
102
103
  title='Modality Diagram Example',
103
104
  colors=(
104
105
  'tab:green', # Set 1 color
@@ -14,7 +14,9 @@ keywords = ["Visualization", "Science", "Plotting", "Matplotlib"]
14
14
  readme = {file = "README.md", content-type = "text/markdown"}
15
15
  requires-python = ">=3.10"
16
16
  classifiers = [
17
+ "Programming Language :: Python",
17
18
  "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.12",
18
20
  "License :: OSI Approved :: MIT License",
19
21
  "Operating System :: OS Independent",
20
22
  "Development Status :: 4 - Beta",
@@ -25,6 +27,7 @@ classifiers = [
25
27
  dependencies = [
26
28
  "numpy",
27
29
  "matplotlib",
30
+ "scsv",
28
31
  ]
29
32
 
30
33
  [project.urls]
@@ -20,6 +20,7 @@ class __Figure():
20
20
  linewidth=0.5,
21
21
  alpha=0.8,
22
22
  figsize=(10, 10),
23
+ dpi=300,
23
24
  title='',
24
25
  ) -> None:
25
26
 
@@ -28,11 +29,12 @@ class __Figure():
28
29
  self.linewidth = linewidth
29
30
  self.alpha = alpha
30
31
  self.figsize = figsize
32
+ self.dpi = dpi
31
33
  self.title = title
32
34
  self.debug_flag = DEBUG
33
35
 
34
36
  # Prepare figure:
35
- self.fig = plt.figure(figsize=self.figsize)
37
+ self.fig = plt.figure(figsize=self.figsize, dpi=self.dpi)
36
38
  self._make_layout()
37
39
 
38
40
  def _make_layout(self) -> None:
@@ -85,6 +87,7 @@ class ModalityPlot(__Figure, __Output):
85
87
  full_center=True,
86
88
  whole_sum=True, # Calculate all three modality vectors despite binarization
87
89
  figsize=(10, 10),
90
+ dpi=300,
88
91
  title='',
89
92
  colors=(
90
93
  'tab:green', # Set 1 color
@@ -135,6 +138,7 @@ class ModalityPlot(__Figure, __Output):
135
138
  linewidth,
136
139
  alpha,
137
140
  figsize,
141
+ dpi,
138
142
  title,
139
143
  )
140
144
 
@@ -0,0 +1 @@
1
+ __version__ = "0.2.1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: DiaModality
3
- Version: 0.1.8
3
+ Version: 0.2.1
4
4
  Summary: Tool to plot modality vector diagrams
5
5
  Author-email: konung-yaropolk <yaropolk1995@gmail.com>
6
6
  License: MIT License
@@ -27,7 +27,9 @@ License: MIT License
27
27
  Project-URL: Homepage, https://github.com/konung-yaropolk/DiaModality
28
28
  Project-URL: Issues, https://github.com/konung-yaropolk/DiaModality/issues
29
29
  Keywords: Visualization,Science,Plotting,Matplotlib
30
+ Classifier: Programming Language :: Python
30
31
  Classifier: Programming Language :: Python :: 3
32
+ Classifier: Programming Language :: Python :: 3.12
31
33
  Classifier: License :: OSI Approved :: MIT License
32
34
  Classifier: Operating System :: OS Independent
33
35
  Classifier: Development Status :: 4 - Beta
@@ -39,6 +41,7 @@ Description-Content-Type: text/markdown
39
41
  License-File: LICENSE
40
42
  Requires-Dist: numpy
41
43
  Requires-Dist: matplotlib
44
+ Requires-Dist: scsv
42
45
 
43
46
  # DiaModality - The Modality Diagram
44
47
 
@@ -103,8 +106,8 @@ with open(file_path, mode='w', newline='') as file:
103
106
  ---
104
107
  ``plot_sample_data.py``:
105
108
  ```python
106
- import DiaModality.CsvParser as csv
107
109
  import DiaModality.ModalityPlot as plt
110
+ import scsv as csv
108
111
  import os
109
112
 
110
113
  # input files:
@@ -119,7 +122,7 @@ for file in files:
119
122
  file_path = os.path.join(script_dir, file)
120
123
 
121
124
  # Parse data from csv file
122
- new_csv = csv.LoadCsv(file_path)
125
+ new_csv = csv.OpenFile(file_path)
123
126
  data, binarization = new_csv.ParseCsv(3, 3)
124
127
 
125
128
  # Make figure:
@@ -141,6 +144,7 @@ for file in files:
141
144
  # else draw trimodal vectors only
142
145
  whole_sum=True, # Calculate all three modality vectors despite binarization
143
146
  figsize=(10, 10),
147
+ dpi=200,
144
148
  title='Modality Diagram Example',
145
149
  colors=(
146
150
  'tab:green', # Set 1 color
@@ -6,7 +6,6 @@ src/DiaModality/ModalityPlot.py
6
6
  src/DiaModality/__init__.py
7
7
  src/DiaModality/__main__.py
8
8
  src/DiaModality/_version.py
9
- src/DiaModality/scsv.py
10
9
  src/DiaModality.egg-info/PKG-INFO
11
10
  src/DiaModality.egg-info/SOURCES.txt
12
11
  src/DiaModality.egg-info/dependency_links.txt
@@ -1 +0,0 @@
1
- __version__ = "0.1.8"
@@ -1,108 +0,0 @@
1
- #!/usr/bin/env python
2
- import csv
3
-
4
- class __Transform_methods():
5
-
6
- def _floatify_recursive(self, data):
7
- if isinstance(data, list):
8
- # Recursively process sublists and filter out None values
9
- processed_list = [self._floatify_recursive(item) for item in data]
10
- return [item for item in processed_list if item is not None]
11
- else:
12
- try:
13
- # Try to convert the item to float
14
- return float(data)
15
- except (ValueError, TypeError):
16
- # If conversion fails, replace with None
17
- self.warning_flag_non_numeric_data = True
18
- return None
19
-
20
- def _transpose_matrix(self, matrix):
21
- max_len = max(len(row) for row in matrix)
22
- padded_matrix = [row + [None] * (max_len - len(row)) for row in matrix]
23
- transposed = [[padded_matrix[j][i] for j in range(len(padded_matrix))] for i in range(max_len)]
24
- # Remove None values if padding was used
25
- return [[element for element in row if element is not None] for row in transposed]
26
-
27
-
28
- class OpenFile(__Transform_methods):
29
- '''
30
- The input CSV file must be comma delimited and contains only numeric
31
- data or empty cells. Each empty cell considers as None.
32
- '''
33
-
34
- def __init__(self, file_path: str, floatify=False, delimiter: str = ',', lineterminator: str = "\r\n") -> None:
35
- self.file_path = file_path
36
- self.floatify = floatify
37
-
38
- with open(self.file_path, 'r', encoding='utf-8-sig') as file:
39
- self.Rows = list(csv.reader(file, delimiter=delimiter, lineterminator=lineterminator))
40
-
41
- self.Cols = self._transpose_matrix(self.Rows)
42
-
43
- def GetTableByRows(self) -> list:
44
- return self.Rows
45
-
46
- def GetTableByCols(self) -> list:
47
- return self.Cols
48
-
49
- def GetCol(self, col_id) -> list:
50
- assert col_id > 0, 'Column numger must be starting from 1'
51
- output = []
52
- for row in self.Rows:
53
- try:
54
- value = float(row[col_id-1])
55
- output.append(value)
56
- except (ValueError, IndexError):
57
- # Replace non-number cells and empty cells with None
58
- output.append(None)
59
-
60
- return output
61
-
62
- def GetCols(self, *args) -> list:
63
- '''
64
- The input is a list of integers.
65
- Output is list of lists of columns.
66
- Each int represents how many columns to return.
67
- Eg: input: (3, 2)
68
- output: list of two lists of columns, first one with [0:2] cols
69
- and second one with [2:3] cols from the original csv.
70
- '''
71
- output = []
72
-
73
- for i, arg in enumerate(args):
74
- output.append([])
75
- start = sum(args) - sum(args[i:])
76
- stop = start + arg
77
-
78
- for col_id in range(start, stop):
79
- output[i].append(self.GetCol(col_id+1))
80
-
81
- return output
82
-
83
- def GetRows(self, *args) -> list:
84
- '''
85
- The input is a list of integers.
86
- Output is list of matrices.
87
- Each int represents each output matrix and defines
88
- how many columns to include in the matrix.
89
- Eg: input: (3, 2)
90
- output: list of two matrices, first one with 1-3 cols
91
- and second one with 4-5 cols from the original csv.
92
- '''
93
- output = []
94
-
95
- for i, arg in enumerate(args):
96
- output.append([])
97
- start = sum(args) - sum(args[i:])
98
- stop = start + arg
99
-
100
- for row in self.Rows:
101
- output[i].append(
102
- [float(cell) if cell else None for cell in row[start:stop]]
103
- )
104
-
105
- return output
106
-
107
- if __name__ == '__main__':
108
- print('\nThis script can be used as an imported module only\n')
File without changes
File without changes
File without changes