dosview 0.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.
dosview-0.1/PKG-INFO ADDED
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: dosview
3
+ Version: 0.1
4
+ Summary: A .dos file viewer
5
+ Classifier: Development Status :: 3 - Alpha
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3.6
9
+ Classifier: Programming Language :: Python :: 3.7
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: setuptools
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pandas
17
+ Requires-Dist: pyqt5
dosview-0.1/README.md ADDED
File without changes
@@ -0,0 +1,128 @@
1
+ import sys
2
+ import argparse
3
+ from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
4
+ from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
5
+ from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
6
+ import random
7
+ import csv
8
+ from matplotlib.figure import Figure
9
+ from threading import Thread
10
+
11
+ import matplotlib.pyplot as plt
12
+ import pandas as pd
13
+
14
+ def parse_file(file_path):
15
+
16
+ metadata = {}
17
+ df_log = pd.read_csv(file_path, sep = ',', header = None, names=range(505))
18
+ data_types = df_log[0].unique().tolist()
19
+
20
+ df_spectrum = df_log [df_log[0] == '$HIST']
21
+ df_spectrum = df_spectrum.drop(columns=[0, 1, 3, 4, 5, 6, 7])
22
+
23
+ new_columns = ['time'] + list(range(df_spectrum.shape[1] - 1))
24
+ df_spectrum.columns = new_columns
25
+
26
+ df_spectrum['time'] = df_spectrum['time'].astype(float)
27
+ duration = df_spectrum['time'].max() - df_spectrum['time'].min()
28
+
29
+ metadata['log_info'] = {}
30
+ metadata['log_info']['internal_time_min'] = df_spectrum['time'].min()
31
+ metadata['log_info']['internal_time_max'] = df_spectrum['time'].max()
32
+ metadata['log_info']['log_duration'] = float(duration)
33
+ metadata['log_info']['spectral_count'] = df_spectrum.shape[0]
34
+ metadata['log_info']['channels'] = df_spectrum.shape[1] - 1 # remove time column
35
+ metadata['log_info']['types'] = data_types
36
+
37
+ df_spectrum['time'] = df_spectrum['time'] - df_spectrum['time'].min()
38
+
39
+ sums = df_spectrum.drop('time', axis=1).sum(axis=1) #.div(total_time)
40
+
41
+ hist = df_spectrum.drop('time', axis=1).sum(axis=0)
42
+
43
+ return [df_spectrum['time'], sums, hist]
44
+
45
+
46
+
47
+
48
+
49
+ class PlotCanvas(FigureCanvas):
50
+ def __init__(self, parent=None, width=5, height=4, dpi=100, file_path=None):
51
+ fig = Figure(figsize=(width, height), dpi=dpi)
52
+ self.axes = fig.add_subplot(211)
53
+ FigureCanvas.__init__(self, fig)
54
+ self.setParent(parent)
55
+ self.data = []
56
+ self.file_path = file_path
57
+ Thread(target=self.load_data).start()
58
+
59
+ def load_data(self):
60
+ self.data = parse_file(self.file_path)
61
+ self.plot()
62
+
63
+ def plot(self):
64
+ self.axes.clear() # Clear previous plot
65
+
66
+ self.axes.plot(self.data[0]/60.0, self.data[1], 'r.', alpha=0.2)
67
+ self.axes.figure.canvas.draw()
68
+
69
+ window_size = 20 # Define the size of the window for the moving average
70
+ rolling_avg = self.data[1].rolling(window=window_size).mean()
71
+ self.axes.plot(self.data[0]/60.0, rolling_avg, 'r-', lw=2)
72
+
73
+ self.axes.set_xlabel('Time (min)')
74
+ self.axes.set_ylabel('Count (total)')
75
+
76
+ self.axes2 = self.figure.add_subplot(212) # Add second subplot
77
+ self.axes2.clear() # Clear previous plot
78
+ self.axes2.plot(self.data[2], 'b.', alpha=0.3)
79
+
80
+ self.axes2.set_xlabel('Channel')
81
+ self.axes2.set_ylabel('Count')
82
+
83
+
84
+ self.axes.grid()
85
+ self.axes2.grid()
86
+
87
+ self.axes.figure.canvas.draw()
88
+
89
+ self.figure.tight_layout()
90
+ self.axes.figure.tight_layout()
91
+
92
+
93
+ class App(QMainWindow):
94
+ def __init__(self, file_path):
95
+ super().__init__()
96
+ self.left = 100
97
+ self.top = 100
98
+ self.title = 'dosview'
99
+ self.width = 640
100
+ self.height = 400
101
+ self.file_path = file_path
102
+ self.initUI()
103
+
104
+ def initUI(self):
105
+ self.setWindowTitle(self.title)
106
+ self.setGeometry(self.left, self.top, self.width, self.height)
107
+
108
+ m = PlotCanvas(self, width=5, height=4, file_path=self.file_path)
109
+ self.setCentralWidget(m)
110
+ m.move(0,0)
111
+
112
+ # Add navigation toolbar
113
+ self.addToolBar(NavigationToolbar(m, self))
114
+
115
+ self.show()
116
+
117
+
118
+ def main():
119
+ parser = argparse.ArgumentParser(description='Process some integers.')
120
+ parser.add_argument('file_path', type=str, help='Path to the input file')
121
+ args = parser.parse_args()
122
+
123
+ app = QApplication(sys.argv)
124
+ ex = App(args.file_path)
125
+ sys.exit(app.exec_())
126
+
127
+ if __name__ == '__main__':
128
+ main()
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.1
2
+ Name: dosview
3
+ Version: 0.1
4
+ Summary: A .dos file viewer
5
+ Classifier: Development Status :: 3 - Alpha
6
+ Classifier: Intended Audience :: Developers
7
+ Classifier: License :: OSI Approved :: MIT License
8
+ Classifier: Programming Language :: Python :: 3.6
9
+ Classifier: Programming Language :: Python :: 3.7
10
+ Classifier: Programming Language :: Python :: 3.8
11
+ Classifier: Programming Language :: Python :: 3.9
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: setuptools
14
+ Requires-Dist: matplotlib
15
+ Requires-Dist: numpy
16
+ Requires-Dist: pandas
17
+ Requires-Dist: pyqt5
@@ -0,0 +1,9 @@
1
+ README.md
2
+ setup.py
3
+ dosview/__init__.py
4
+ dosview.egg-info/PKG-INFO
5
+ dosview.egg-info/SOURCES.txt
6
+ dosview.egg-info/dependency_links.txt
7
+ dosview.egg-info/entry_points.txt
8
+ dosview.egg-info/requires.txt
9
+ dosview.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ dosview = dosview:main
@@ -0,0 +1,5 @@
1
+ setuptools
2
+ matplotlib
3
+ numpy
4
+ pandas
5
+ pyqt5
@@ -0,0 +1 @@
1
+ dosview
dosview-0.1/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
dosview-0.1/setup.py ADDED
@@ -0,0 +1,33 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ # Read requirements.txt
4
+ with open('requirements.txt') as f:
5
+ required = f.read().splitlines()
6
+
7
+ # Read README.md for the long description
8
+ with open('README.md', 'r', encoding='utf-8') as f:
9
+ long_description = f.read()
10
+
11
+ setup(
12
+ name='dosview',
13
+ version='0.1',
14
+ description='A .dos file viewer',
15
+ long_description=long_description,
16
+ long_description_content_type='text/markdown',
17
+ packages=find_packages(),
18
+ entry_points={
19
+ 'console_scripts': [
20
+ 'dosview = dosview:main',
21
+ ],
22
+ },
23
+ install_requires=required,
24
+ classifiers=[
25
+ 'Development Status :: 3 - Alpha',
26
+ 'Intended Audience :: Developers',
27
+ 'License :: OSI Approved :: MIT License',
28
+ 'Programming Language :: Python :: 3.6',
29
+ 'Programming Language :: Python :: 3.7',
30
+ 'Programming Language :: Python :: 3.8',
31
+ 'Programming Language :: Python :: 3.9',
32
+ ],
33
+ )