SimbioReader 0.1.7.dev1__tar.gz → 0.1.8__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.
- {simbioreader-0.1.7.dev1/src/SimbioReader.egg-info → simbioreader-0.1.8}/PKG-INFO +3 -1
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/README.md +1 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/pyproject.toml +2 -1
- simbioreader-0.1.8/src/SimbioReader/simbioreader.py +367 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8/src/SimbioReader.egg-info}/PKG-INFO +3 -1
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/SOURCES.txt +1 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/requires.txt +1 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/LICENSE +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/setup.cfg +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/__init__.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/console.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/constants.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/exceptions.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/externals.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/filters.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/phases.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/tools.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader/version.py +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/dependency_links.txt +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/entry_points.txt +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/top_level.txt +0 -0
- {simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SimbioReader
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo
|
|
5
5
|
Author-email: Romolo Politi <Romolo.Politi@inaf.it>
|
|
6
6
|
License: GNU GPL ver3
|
|
@@ -14,11 +14,13 @@ Requires-Dist: numpy
|
|
|
14
14
|
Requires-Dist: pandas
|
|
15
15
|
Requires-Dist: rich
|
|
16
16
|
Requires-Dist: update_checker
|
|
17
|
+
Requires-Dist: pillow
|
|
17
18
|
Requires-Dist: importlib-metadata; python_version > "3.10"
|
|
18
19
|
Provides-Extra: docs
|
|
19
20
|
Requires-Dist: sphinx; extra == "docs"
|
|
20
21
|
|
|
21
22
|
# SimbioReader
|
|
23
|
+
[](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/python-publish.yml)
|
|
22
24
|
|
|
23
25
|
SimbioReader is the official Python reader for the data of the Spectrometer And Imagers For Mpo Bepicolombo Integrated Observatory System on board the ESA mission BepiColombo.
|
|
24
26
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# SimbioReader
|
|
2
|
+
[](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/python-publish.yml)
|
|
2
3
|
|
|
3
4
|
SimbioReader is the official Python reader for the data of the Spectrometer And Imagers For Mpo Bepicolombo Integrated Observatory System on board the ESA mission BepiColombo.
|
|
4
5
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "SimbioReader"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.8"
|
|
4
4
|
description="Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo"
|
|
5
5
|
dependencies = [
|
|
6
6
|
"numpy",
|
|
7
7
|
"pandas",
|
|
8
8
|
"rich",
|
|
9
9
|
"update_checker",
|
|
10
|
+
"pillow",
|
|
10
11
|
'importlib-metadata; python_version>"3.10"',
|
|
11
12
|
]
|
|
12
13
|
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from os import path
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from re import sub
|
|
6
|
+
from xml.dom.minidom import parse
|
|
7
|
+
|
|
8
|
+
import numpy as np
|
|
9
|
+
import pandas as pd
|
|
10
|
+
from PIL import Image as im
|
|
11
|
+
from rich import print
|
|
12
|
+
from rich.columns import Columns
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from rich.panel import Panel
|
|
15
|
+
from rich.table import Table
|
|
16
|
+
from rich.text import Text
|
|
17
|
+
from update_checker import UpdateChecker
|
|
18
|
+
|
|
19
|
+
from SimbioReader.constants import FMODE, MSG
|
|
20
|
+
from SimbioReader.exceptions import SizeError
|
|
21
|
+
from SimbioReader.tools import getElement, getValue
|
|
22
|
+
from SimbioReader.version import version
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def camel_case(s):
|
|
26
|
+
s = sub(r"(_|-)+", " ", s).title().replace(" ", "")
|
|
27
|
+
return ''.join([s[0].lower(), s[1:]])
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def snake_case(s):
|
|
31
|
+
return '_'.join(
|
|
32
|
+
sub('([A-Z][a-z]+)', r' \1',
|
|
33
|
+
sub('([A-Z]+)', r' \1',
|
|
34
|
+
s.replace('-', ' '))).split()).lower()
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
__version__ = version.full()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def hdr_readr(file_name:Path):
|
|
41
|
+
with open(file_name, FMODE.READ) as f:
|
|
42
|
+
lines = f.readlines()
|
|
43
|
+
img_data = {}
|
|
44
|
+
info = ['samples', 'lines', 'bands', 'data type', 'Integration Time',
|
|
45
|
+
'Compression Box', 'IBR', 'Start pixel row',
|
|
46
|
+
'Start pixel col', 'Stop pixel row', 'Stop pixel col',
|
|
47
|
+
'Binning W1']
|
|
48
|
+
for line in lines:
|
|
49
|
+
sect = line.split('=')
|
|
50
|
+
if sect[0].strip() in info:
|
|
51
|
+
|
|
52
|
+
if sect[0].strip() == 'Integration Time':
|
|
53
|
+
img_data[snake_case(sect[0].strip())] = float(sect[-1].strip())
|
|
54
|
+
elif sect[0].strip() == 'Compression Box':
|
|
55
|
+
img_data[snake_case(sect[0].strip())] = sect[-1].strip()
|
|
56
|
+
elif sect[0].strip() == 'data type':
|
|
57
|
+
img_data[snake_case(sect[0].strip())] = int(sect[-1].strip())
|
|
58
|
+
else:
|
|
59
|
+
img_data[sect[0].strip()] = int(sect[-1].split('(')[0].strip())
|
|
60
|
+
return img_data
|
|
61
|
+
|
|
62
|
+
def xmlReader(file_name:Path,channel:str):
|
|
63
|
+
tree=parse(file_name.__str__())
|
|
64
|
+
|
|
65
|
+
img_data = {}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
img_data["Integration_Time"] = float(tree.getElementsByTagName(
|
|
69
|
+
"img:exposure_duration")[0].firstChild.data)/1000
|
|
70
|
+
elem = tree.getElementsByTagName('Axis_Array')
|
|
71
|
+
for item in elem:
|
|
72
|
+
# print(item.getElementsByTagName('axis_name')
|
|
73
|
+
# [0].firstChild.data.lower())
|
|
74
|
+
img_data[item.getElementsByTagName('axis_name')[0].firstChild.data.lower()+'s'] = \
|
|
75
|
+
int(item.getElementsByTagName('elements')[0].firstChild.data)
|
|
76
|
+
img_data['start_pixel_row'] = int(
|
|
77
|
+
tree.getElementsByTagName('img:first_line')[0].firstChild.data)
|
|
78
|
+
img_data['start_pixel_col'] = int(
|
|
79
|
+
tree.getElementsByTagName('img:first_sample')[0].firstChild.data)
|
|
80
|
+
# img_data['lines']=int(elem[0].firstChild.data)
|
|
81
|
+
# img_data['samples']=int(elem[1].firstChild.data)
|
|
82
|
+
|
|
83
|
+
# img_data['bands']=1
|
|
84
|
+
dataType=tree.getElementsByTagName('data_type')[0].firstChild.data
|
|
85
|
+
if dataType == 'UnsignedMSB2':
|
|
86
|
+
img_data['data_type'] = 2
|
|
87
|
+
elif dataType == 'IEEE754MSBDouble':
|
|
88
|
+
img_data['data_type'] = 5
|
|
89
|
+
# manca:
|
|
90
|
+
# - il dato della compressione
|
|
91
|
+
# - il dato dell'IBR
|
|
92
|
+
# - il dato della dimensione delle bande
|
|
93
|
+
# - il dato dello stop pixel row
|
|
94
|
+
# - il dato dello stop pixel col
|
|
95
|
+
# - il dato del binning W1
|
|
96
|
+
# - il dato del binning spettrale
|
|
97
|
+
return img_data
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# @dataclass
|
|
101
|
+
class SimbioReader:
|
|
102
|
+
''' Read a Simbio file'''
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def __init__(self, fileName: Path, log: logging = None,
|
|
106
|
+
debug: bool = False, verbose: bool = False,
|
|
107
|
+
xml: bool=False, console:Console=None, updateCheck:bool = True):
|
|
108
|
+
if console is None:
|
|
109
|
+
from SimbioReader.console import console
|
|
110
|
+
self.console=console
|
|
111
|
+
else:
|
|
112
|
+
self.console=console
|
|
113
|
+
if updateCheck:
|
|
114
|
+
checker = UpdateChecker()
|
|
115
|
+
result = checker.check('SimbioReader', version.short())
|
|
116
|
+
if result:
|
|
117
|
+
# TODO: Check this part after the delivery on pypi.org
|
|
118
|
+
self.console.print(result)
|
|
119
|
+
if type(fileName) is not Path:
|
|
120
|
+
fileName = Path(fileName).resolve()
|
|
121
|
+
if 'stc' in fileName.stem:
|
|
122
|
+
self.channel = "STC"
|
|
123
|
+
elif 'hric' in fileName.stem:
|
|
124
|
+
self.channel = "HRIC"
|
|
125
|
+
elif 'vihi' in fileName.stem:
|
|
126
|
+
self.channel = "VIHI"
|
|
127
|
+
else:
|
|
128
|
+
raise ValueError('The file is not a Simbio file')
|
|
129
|
+
|
|
130
|
+
self.fileName = fileName.absolute()
|
|
131
|
+
self.log = log
|
|
132
|
+
self.debug = debug
|
|
133
|
+
self.verbose = verbose
|
|
134
|
+
self.read(xml)
|
|
135
|
+
|
|
136
|
+
def read(self,xml:bool):
|
|
137
|
+
ext = ['.dat', '.xml']
|
|
138
|
+
for e in ext:
|
|
139
|
+
if not self.fileName.with_suffix(e).exists():
|
|
140
|
+
raise ValueError(
|
|
141
|
+
f"The file {self.fileName.stem} does not exist ({self.fileName.with_suffix(e)})")
|
|
142
|
+
message = f"Reading {self.fileName}"
|
|
143
|
+
if self.log:
|
|
144
|
+
self.log.info(message)
|
|
145
|
+
if self.verbose:
|
|
146
|
+
self.console.print(f"{MSG.INFO}{message}")
|
|
147
|
+
if not self.fileName.with_suffix('.csv').exists():
|
|
148
|
+
message = f"The HK file do not exists"
|
|
149
|
+
if self.log:
|
|
150
|
+
self.log.warning(message)
|
|
151
|
+
if self.verbose:
|
|
152
|
+
self.console.print(f"{MSG.WARNING}{message}")
|
|
153
|
+
else:
|
|
154
|
+
if self.verbose:
|
|
155
|
+
self.console.print(f"{MSG.INFO}Read the HK from the csv")
|
|
156
|
+
df = pd.read_csv(self.fileName.with_suffix('.csv'), sep=',', header=0)
|
|
157
|
+
# f"{self.fileName.parent}/{self.fileName.stem.replace('img','hk')}.csv", sep=',', header=0)
|
|
158
|
+
for i in df.columns:
|
|
159
|
+
if type(df[i].values[0]) is str:
|
|
160
|
+
val = df[i].values[0].strip()
|
|
161
|
+
else:
|
|
162
|
+
val = df[i].values[0]
|
|
163
|
+
setattr(self, i.strip(), val)
|
|
164
|
+
|
|
165
|
+
#
|
|
166
|
+
# if xml:
|
|
167
|
+
# if not path.exists(f"{self.fileName.parent}/{self.fileName.stem}.xml"):
|
|
168
|
+
# raise ValueError(
|
|
169
|
+
# f"The file {self.fileName.stem}.{e} does not exist")
|
|
170
|
+
img_data =xmlReader(self.fileName.with_suffix('.xml'),self.channel)
|
|
171
|
+
doc = parse(self.fileName.with_suffix('.xml').__str__())
|
|
172
|
+
idArea = getElement(doc, 'Identification_Area')
|
|
173
|
+
self.title = getValue(idArea, 'title')
|
|
174
|
+
self.dataModelVersion = getValue(idArea, 'information_model_version')
|
|
175
|
+
# TODO: Check on the datamodel version
|
|
176
|
+
|
|
177
|
+
obsArea = getElement(doc, 'Observation_Area')
|
|
178
|
+
timeCoords = getElement(obsArea, 'Time_Coordinates')
|
|
179
|
+
self.startTime = getValue(timeCoords, 'start_date_time')
|
|
180
|
+
self.stopTime = getValue(timeCoords, 'stop_date_time')
|
|
181
|
+
|
|
182
|
+
primResSum = getElement(obsArea, 'Primary_Result_Summary')
|
|
183
|
+
self.level = getValue(primResSum, 'processing_level')
|
|
184
|
+
|
|
185
|
+
targetInfo = getElement(obsArea, 'Target_Identification')
|
|
186
|
+
self.tarName = getValue(targetInfo, 'name')
|
|
187
|
+
self.tarType = getValue(targetInfo, 'type')
|
|
188
|
+
|
|
189
|
+
missionArea = getElement(doc, 'Mission_Area')
|
|
190
|
+
missionInfo = getElement(missionArea, 'psa:Mission_Information')
|
|
191
|
+
self.startScet = getValue(
|
|
192
|
+
missionInfo, 'psa:spacecraft_clock_start_count')
|
|
193
|
+
self.stopScet = getValue(
|
|
194
|
+
missionInfo, 'psa:spacecraft_clock_stop_count')
|
|
195
|
+
self.phaseName = getValue(
|
|
196
|
+
missionInfo, 'psa:mission_phase_name')
|
|
197
|
+
|
|
198
|
+
discArea = getElement(doc, 'Discipline_Area')
|
|
199
|
+
|
|
200
|
+
expInfo = getElement(discArea, 'img:Exposure')
|
|
201
|
+
self.exposure = float(getValue(expInfo, 'img:exposure_duration'))/1000.
|
|
202
|
+
|
|
203
|
+
subFrame = getElement(discArea, 'img:Subframe')
|
|
204
|
+
self.firstLine = int(getValue(subFrame, 'img:first_line'))
|
|
205
|
+
self.firstSample = int(getValue(subFrame, 'img:first_sample'))
|
|
206
|
+
self.lines = int(getValue(subFrame, 'img:lines'))
|
|
207
|
+
self.samples = int(getValue(subFrame, 'img:samples'))
|
|
208
|
+
self.lineFov = float(getValue(subFrame, 'img:line_fov'))
|
|
209
|
+
self.sampleFov = float(getValue(subFrame, 'img:sample_fov'))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# else:
|
|
213
|
+
# if not path.exists(f"{self.fileName.parent}/{self.fileName.stem}.hdr"):
|
|
214
|
+
# raise ValueError(
|
|
215
|
+
# f"The file {self.fileName.stem}{e} does not exist")
|
|
216
|
+
# img_data = hdr_readr(self.fileName.with_suffix('.hdr'))
|
|
217
|
+
# self.samples=img_data['samples']
|
|
218
|
+
# self.lines=img_data['lines']
|
|
219
|
+
if self.channel == "VIHI":
|
|
220
|
+
axis = getElement(doc, 'Array_3D_Spectrum')
|
|
221
|
+
db = getElement(axis, 'Axis_Array',2)
|
|
222
|
+
# self.bands=img_data['bands']
|
|
223
|
+
self.bands = int(getValue(axis,'elements'))
|
|
224
|
+
else:
|
|
225
|
+
self.bands=1
|
|
226
|
+
# f"{self.fileName.parent}/{self.fileName.stem}.hdr")
|
|
227
|
+
|
|
228
|
+
# self.scetConvert()
|
|
229
|
+
if img_data['data_type'] == 2:
|
|
230
|
+
data_type = np.int16
|
|
231
|
+
if img_data['data_type'] == 5:
|
|
232
|
+
data_type=np.float64
|
|
233
|
+
for elemn in img_data.keys():
|
|
234
|
+
setattr(self, elemn, img_data[elemn])
|
|
235
|
+
if self.verbose:
|
|
236
|
+
self.console.print(f"{MSG.INFO}Loading: {self.fileName}")
|
|
237
|
+
if self.channel == 'VIHI':
|
|
238
|
+
imgSize = img_data['samples']*img_data['lines']*img_data['bands']*16
|
|
239
|
+
self.console.print(
|
|
240
|
+
f"{MSG.INFO}Image size: {img_data['samples']}x{img_data['lines']}x{img_data['bands']}")
|
|
241
|
+
else:
|
|
242
|
+
imgSize = img_data['samples'] * img_data['lines']*16
|
|
243
|
+
self.console.print(
|
|
244
|
+
f"{MSG.INFO}Image size: {img_data['samples']}x{img_data['lines']}")
|
|
245
|
+
self.console.print(f"{MSG.INFO}File size: {self.fileName.stat().st_size*8}")
|
|
246
|
+
self.console.print(
|
|
247
|
+
f"{MSG.INFO}Computed File Size: {imgSize}")
|
|
248
|
+
if self.fileName.stat().st_size*8 != imgSize:
|
|
249
|
+
raise SizeError(self.fileName.stat().st_size *
|
|
250
|
+
8,imgSize)
|
|
251
|
+
#print(img_data['samples'],img_data['lines'],img_data['bands'])
|
|
252
|
+
if self.channel == "VIHI":
|
|
253
|
+
self.img = np.fromfile(self.fileName, dtype=data_type,
|
|
254
|
+
count=img_data['samples']*img_data['lines']*img_data['bands'])
|
|
255
|
+
else:
|
|
256
|
+
self.img = np.fromfile(self.fileName, dtype=data_type,
|
|
257
|
+
count=img_data['samples']*img_data['lines'])
|
|
258
|
+
if self.channel == 'VIHI':
|
|
259
|
+
if self.lines==1:
|
|
260
|
+
self.img.shape = ( self.samples,self.bands)
|
|
261
|
+
else:
|
|
262
|
+
self.img.shape = (self.lines,self.samples, self.bands )
|
|
263
|
+
else:
|
|
264
|
+
self.img.shape = (self.samples, self.lines)
|
|
265
|
+
if self.verbose:
|
|
266
|
+
self.console.print(f"{MSG.INFO}Dimension of the old image array: {self.img.ndim}")
|
|
267
|
+
# print(f"Size of the old image array: {self.img.size}")
|
|
268
|
+
|
|
269
|
+
def Show(self,prt=True):
|
|
270
|
+
# print(self.__dict__)
|
|
271
|
+
sep=' = '
|
|
272
|
+
sep2 = ' : '
|
|
273
|
+
|
|
274
|
+
info=Table.grid()
|
|
275
|
+
info.add_column(style='yellow', justify='right')
|
|
276
|
+
info.add_column()
|
|
277
|
+
info.add_column(style='cyan', justify='left')
|
|
278
|
+
info.add_row('Title',sep2,self.title)
|
|
279
|
+
info.add_row('DataModel Version', sep2, self.dataModelVersion)
|
|
280
|
+
info.add_row('Start Acquisition', sep2, self.startTime)
|
|
281
|
+
info.add_row('Stop Acquisition', sep2, self.stopTime)
|
|
282
|
+
info.add_row('Stort Acquisition SCET',sep2, self.startScet)
|
|
283
|
+
info.add_row("Stop Acquisition SCET", sep2, self.stopScet)
|
|
284
|
+
info.add_row("Phase Name", sep2, self.phaseName)
|
|
285
|
+
|
|
286
|
+
g=Table.grid()
|
|
287
|
+
g.add_column()
|
|
288
|
+
g.add_row(Panel(Text(self.channel, justify='center', style='magenta'), border_style='yellow', title="Channel"))
|
|
289
|
+
g.add_row(Panel(Text(self.level.upper(), justify='center',
|
|
290
|
+
style='magenta'), border_style='yellow', title="Level"))
|
|
291
|
+
|
|
292
|
+
tbs=Table.grid()
|
|
293
|
+
tbs.add_column(style='yellow',justify='right')
|
|
294
|
+
tbs.add_column()
|
|
295
|
+
tbs.add_column(style='cyan',justify='left')
|
|
296
|
+
tbs.add_row('Samples',sep,str(self.samples))
|
|
297
|
+
tbs.add_row('Lines',sep,str(self.lines))
|
|
298
|
+
if self.channel == 'VIHI':
|
|
299
|
+
tbs.add_row('Bands',sep,str(self.bands))
|
|
300
|
+
tbs.add_section()
|
|
301
|
+
tbs.add_row("First Line", sep, str(self.firstLine))
|
|
302
|
+
tbs.add_row("First Sample", sep, str(self.firstSample))
|
|
303
|
+
tbs.add_row('Line FOV',sep, str(self.lineFov))
|
|
304
|
+
tbs.add_row('Sample FOV', sep, str(self.sampleFov))
|
|
305
|
+
|
|
306
|
+
# g.add_row(Panel(tbs, title='Image Info',
|
|
307
|
+
# border_style='yellow', expand=True))
|
|
308
|
+
|
|
309
|
+
t=Table.grid()
|
|
310
|
+
t.add_column(style='yellow', justify='right')
|
|
311
|
+
t.add_column()
|
|
312
|
+
t.add_column(style='cyan', justify='left')
|
|
313
|
+
t.add_row("Name",sep2,self.tarName)
|
|
314
|
+
t.add_row("Type", sep2, self.tarType)
|
|
315
|
+
|
|
316
|
+
g.add_row(Panel(t, title='Target Info',
|
|
317
|
+
border_style='yellow'))
|
|
318
|
+
|
|
319
|
+
g.add_row(Panel(tbs, title='Image Info',
|
|
320
|
+
border_style='yellow', expand=True))
|
|
321
|
+
|
|
322
|
+
hk=Table.grid()
|
|
323
|
+
hk.add_column(style='yellow', justify='right')
|
|
324
|
+
hk.add_column()
|
|
325
|
+
hk.add_column(style='cyan', justify='left')
|
|
326
|
+
df = pd.read_csv(self.fileName.with_suffix('.csv'), sep=',', header=0)
|
|
327
|
+
for i in df.columns:
|
|
328
|
+
hk.add_row(i.strip(), sep, f"{df[i].values[0]}".strip())
|
|
329
|
+
infoP = Panel(info, title="General Info",
|
|
330
|
+
border_style='yellow', expand=False)
|
|
331
|
+
phk=Panel(hk,title='HouseKeeping',border_style='yellow',expand=False)
|
|
332
|
+
if prt:
|
|
333
|
+
self.console.print(Columns([g, infoP, phk], title=self.fileName.stem))
|
|
334
|
+
else:
|
|
335
|
+
return Columns([g, infoP, phk], title=self.fileName.stem)
|
|
336
|
+
pass
|
|
337
|
+
|
|
338
|
+
def __str__(self):
|
|
339
|
+
return f"SimbioReader object {version} - from file {self.fileName.stem}"
|
|
340
|
+
# def scetConvert(self):
|
|
341
|
+
# temp = divmod(self.ACQUISITION_TIME_SCET, 1)
|
|
342
|
+
# self.ACQUISITION_TIME_SCET = f"1/{int(temp[0])}:{int(temp[1]*2**16)}"
|
|
343
|
+
|
|
344
|
+
def savePreview(self,img_type:str='png',quality:int=100, outFolder:Path=None):
|
|
345
|
+
|
|
346
|
+
if outFolder is None:
|
|
347
|
+
dest = self.fileName.parent
|
|
348
|
+
else:
|
|
349
|
+
if type(outFolder) is not Path:
|
|
350
|
+
outFolder = Path(outFolder)
|
|
351
|
+
dest=outFolder
|
|
352
|
+
if img_type in ['png','tif']:
|
|
353
|
+
data = im.fromarray(self.img)
|
|
354
|
+
# print(data.getpixel((50, 50)))
|
|
355
|
+
data.save(f"{dest}/{self.fileName.stem}.{img_type}",
|
|
356
|
+
quality=quality)
|
|
357
|
+
elif img_type == 'jpg':
|
|
358
|
+
data = im.fromarray(self.img,mode='L')
|
|
359
|
+
# print(data.getpixel((50,50)))
|
|
360
|
+
data.save(f"{dest}/{self.fileName.stem}.{img_type}",
|
|
361
|
+
quality=quality)
|
|
362
|
+
# print(self.img[0,0])
|
|
363
|
+
pass
|
|
364
|
+
|
|
365
|
+
def image(self):
|
|
366
|
+
data = im.fromarray(self.img)
|
|
367
|
+
return data
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: SimbioReader
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.8
|
|
4
4
|
Summary: Python Reader for the data from SIMBIO-SYS instrument suite on-board the ESA mission BepiColombo
|
|
5
5
|
Author-email: Romolo Politi <Romolo.Politi@inaf.it>
|
|
6
6
|
License: GNU GPL ver3
|
|
@@ -14,11 +14,13 @@ Requires-Dist: numpy
|
|
|
14
14
|
Requires-Dist: pandas
|
|
15
15
|
Requires-Dist: rich
|
|
16
16
|
Requires-Dist: update_checker
|
|
17
|
+
Requires-Dist: pillow
|
|
17
18
|
Requires-Dist: importlib-metadata; python_version > "3.10"
|
|
18
19
|
Provides-Extra: docs
|
|
19
20
|
Requires-Dist: sphinx; extra == "docs"
|
|
20
21
|
|
|
21
22
|
# SimbioReader
|
|
23
|
+
[](https://github.com/SIMBIO-SYS/SimbioReader/actions/workflows/python-publish.yml)
|
|
22
24
|
|
|
23
25
|
SimbioReader is the official Python reader for the data of the Spectrometer And Imagers For Mpo Bepicolombo Integrated Observatory System on board the ESA mission BepiColombo.
|
|
24
26
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{simbioreader-0.1.7.dev1 → simbioreader-0.1.8}/src/SimbioReader.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|