spac-kit 0.1.0.dev0__py3-none-any.whl
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.
- spac_kit/__init__.py +0 -0
- spac_kit/parser/Packets.py +46 -0
- spac_kit/parser/__init__.py +10 -0
- spac_kit/parser/downlink_to_excel.py +97 -0
- spac_kit/parser/logger.conf +27 -0
- spac_kit/parser/parse_ccsds_downlink.py +375 -0
- spac_kit/parser/remove_non_ccsds_headers.py +144 -0
- spac_kit/parser/test_utils.py +67 -0
- spac_kit/parser/util.py +14 -0
- spac_kit-0.1.0.dev0.dist-info/METADATA +334 -0
- spac_kit-0.1.0.dev0.dist-info/RECORD +16 -0
- spac_kit-0.1.0.dev0.dist-info/WHEEL +5 -0
- spac_kit-0.1.0.dev0.dist-info/licenses/LICENSE.md +194 -0
- spac_kit-0.1.0.dev0.dist-info/namespace_packages.txt +1 -0
- spac_kit-0.1.0.dev0.dist-info/top_level.txt +1 -0
- spac_kit-0.1.0.dev0.dist-info/zip-safe +1 -0
spac_kit/__init__.py
ADDED
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""CCSDSpy packet specialized for configurable APID parsing."""
|
|
2
|
+
from typing import Callable
|
|
3
|
+
|
|
4
|
+
import ccsdspy
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SimpleAPIDPacket(ccsdspy.VariableLength):
|
|
8
|
+
"""Simple Packet definition, with name and associated APID."""
|
|
9
|
+
|
|
10
|
+
def __init__(self, fields: list[ccsdspy.PacketField], name: str, apid: int):
|
|
11
|
+
"""Constructor."""
|
|
12
|
+
super().__init__(fields)
|
|
13
|
+
self.apid = apid
|
|
14
|
+
self.name = name
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class PreParserAPIDPacket(SimpleAPIDPacket):
|
|
18
|
+
"""Packet definition used to pre-parse packets.
|
|
19
|
+
|
|
20
|
+
This is used when the structure vary for a single APID
|
|
21
|
+
depending on one field in this packet.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
def __init__(
|
|
25
|
+
self,
|
|
26
|
+
fields: list[ccsdspy.PacketField],
|
|
27
|
+
name: str,
|
|
28
|
+
apid: int,
|
|
29
|
+
decision_field: str = None,
|
|
30
|
+
decision_fun: Callable = lambda x: x,
|
|
31
|
+
):
|
|
32
|
+
"""Constructor."""
|
|
33
|
+
super().__init__(fields, apid, name)
|
|
34
|
+
self.decision_field = decision_field
|
|
35
|
+
self.decision_fun = decision_fun
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ParserSubAPIDPacket(SimpleAPIDPacket):
|
|
39
|
+
"""Packet definition associated to a specific flavor of structure within a single APID."""
|
|
40
|
+
|
|
41
|
+
def __init__(
|
|
42
|
+
self, fields: list[ccsdspy.PacketField], name: str, apid: int, sub_apid: int
|
|
43
|
+
):
|
|
44
|
+
"""Constructor."""
|
|
45
|
+
super().__init__(fields, apid, name)
|
|
46
|
+
self.sub_apid = sub_apid
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"""Generic code to parse a downlink binary file encoded using CCSDS."""
|
|
2
|
+
import os
|
|
3
|
+
from logging.config import fileConfig
|
|
4
|
+
|
|
5
|
+
conf_file_dir = os.path.dirname(os.path.abspath(__file__))
|
|
6
|
+
fileConfig(os.path.join(conf_file_dir, "logger.conf"))
|
|
7
|
+
|
|
8
|
+
from .parse_ccsds_downlink import parse_ccsds_file # noqa
|
|
9
|
+
from .remove_non_ccsds_headers import strip_non_ccsds_headers # noqa
|
|
10
|
+
from .test_utils import compare # noqa
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Utility to convert a downlink CCSDS binary file to excel."""
|
|
2
|
+
import argparse
|
|
3
|
+
import logging
|
|
4
|
+
import os.path
|
|
5
|
+
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from spac_kit.parser.parse_ccsds_downlink import parse_ccsds_file
|
|
8
|
+
from spac_kit.parser.remove_non_ccsds_headers import strip_non_ccsds_headers
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def get_parser():
|
|
14
|
+
"""Parser for the command line utility."""
|
|
15
|
+
parser = argparse.ArgumentParser(description="Parse Files")
|
|
16
|
+
parser.add_argument("--file", type=str, required=True, help="Input File")
|
|
17
|
+
parser.add_argument(
|
|
18
|
+
"--bdsem",
|
|
19
|
+
action="store_true",
|
|
20
|
+
help="Mode BDSEM, with specific, non-CCSDS, packet wrappers, "
|
|
21
|
+
"if not present, RAW mode is assumed, "
|
|
22
|
+
"with other specific non CCSDS markers in betwwen packets",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
parser.add_argument(
|
|
26
|
+
"--pkt-header",
|
|
27
|
+
action="store_true",
|
|
28
|
+
help="When additional non CCSDS header are added between packets",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"--json-header",
|
|
33
|
+
action="store_true",
|
|
34
|
+
help="When a JSON ASCII header starts the file",
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
parser.add_argument(
|
|
38
|
+
"--calculate-crc",
|
|
39
|
+
action="store_true",
|
|
40
|
+
help="Check if CRC in packet matches with the one calculateed, "
|
|
41
|
+
"return the calculated CRC in the spreadsheet next to the one of the packet.",
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return parser
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def add_tab_to_xlsx(dfs, writer, name=""):
|
|
48
|
+
"""Add tab to excel writer from a dictionary, recursively.
|
|
49
|
+
|
|
50
|
+
Only use the name in the leaf of the dictionary tree.
|
|
51
|
+
|
|
52
|
+
@param dfs: dictionary (of dictionary) of pandas dataframes or single pandas dataframe
|
|
53
|
+
@param writer: pandas.ExcelWriter
|
|
54
|
+
@param name: name of the tab to be used, optional when
|
|
55
|
+
@return: Nothing
|
|
56
|
+
"""
|
|
57
|
+
if isinstance(dfs, dict):
|
|
58
|
+
for name, df in dfs.items():
|
|
59
|
+
add_tab_to_xlsx(df, writer, name=name)
|
|
60
|
+
else:
|
|
61
|
+
logger.info("Adding tab %s to excel spreadsheet", name)
|
|
62
|
+
dfs.to_excel(writer, sheet_name=name, index=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def export_dfs_to_xlsx(dfs, filename1):
|
|
66
|
+
"""Export a dictionnary of pandas dataframes to an Excel file."""
|
|
67
|
+
with pd.ExcelWriter(filename1) as writer:
|
|
68
|
+
add_tab_to_xlsx(dfs, writer)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def export_ccsds_to_excel(ccsds_file, output_filename, do_calculate_crc):
|
|
72
|
+
"""Export a binary file of CCSDS packets into an Excel file."""
|
|
73
|
+
dfs = parse_ccsds_file(ccsds_file, do_calculate_crc)
|
|
74
|
+
export_dfs_to_xlsx(dfs, output_filename)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main():
|
|
78
|
+
"""Command line interface to parse downlink binary file and export to Excel file."""
|
|
79
|
+
parser = get_parser()
|
|
80
|
+
args = parser.parse_args()
|
|
81
|
+
|
|
82
|
+
with open(args.file, "rb") as f:
|
|
83
|
+
ccsds_file = strip_non_ccsds_headers(
|
|
84
|
+
f, args.bdsem, args.pkt_header, args.json_header
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
# to write the content of the file without non CCSDS code
|
|
88
|
+
# with open("ecm_test.bin", "wb") as f:
|
|
89
|
+
# f.write(ccsds_file.read())
|
|
90
|
+
|
|
91
|
+
file_base, _ = os.path.splitext(args.file)
|
|
92
|
+
xlsx_filename = file_base + ".xlsx"
|
|
93
|
+
export_ccsds_to_excel(ccsds_file, xlsx_filename, args.calculate_crc)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
if __name__ == "__main__":
|
|
97
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[loggers]
|
|
2
|
+
keys=root,sampleLogger
|
|
3
|
+
|
|
4
|
+
[handlers]
|
|
5
|
+
keys=consoleHandler
|
|
6
|
+
|
|
7
|
+
[formatters]
|
|
8
|
+
keys=sampleFormatter
|
|
9
|
+
|
|
10
|
+
[logger_root]
|
|
11
|
+
level=DEBUG
|
|
12
|
+
handlers=consoleHandler
|
|
13
|
+
|
|
14
|
+
[logger_sampleLogger]
|
|
15
|
+
level=DEBUG
|
|
16
|
+
handlers=consoleHandler
|
|
17
|
+
qualname=sampleLogger
|
|
18
|
+
propagate=0
|
|
19
|
+
|
|
20
|
+
[handler_consoleHandler]
|
|
21
|
+
class=StreamHandler
|
|
22
|
+
level=DEBUG
|
|
23
|
+
formatter=sampleFormatter
|
|
24
|
+
args=(sys.stdout,)
|
|
25
|
+
|
|
26
|
+
[formatter_sampleFormatter]
|
|
27
|
+
format=%(asctime)s - %(name)s - %(levelname)s - %(message)s
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
"""CCSDS parser for binary file with multiple APIDs."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import gc
|
|
5
|
+
import io
|
|
6
|
+
import logging
|
|
7
|
+
|
|
8
|
+
import ccsdspy
|
|
9
|
+
import crccheck
|
|
10
|
+
import numpy as np
|
|
11
|
+
import pandas as pd
|
|
12
|
+
from spac_kit.parser.util import default_pkt
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CCSDSParsingException(Exception):
|
|
18
|
+
"""CCSDS packet parsing Exception."""
|
|
19
|
+
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CRCNotCalculatedError(Exception):
|
|
24
|
+
"""CRC Calculation exception."""
|
|
25
|
+
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class CalculatedChecksum(ccsdspy.converters.Converter):
|
|
30
|
+
"""Converter which calculates a CRC checksum from a parsed packet and compare it with the one found in the packet.
|
|
31
|
+
|
|
32
|
+
TODO: make something better, by supporting any packets as input...
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
CRC = crccheck.crc.Crc16CcittFalse
|
|
36
|
+
JUMBO_CRC = crccheck.crc.Crc32Mpeg2
|
|
37
|
+
JUMBO_TLM_PKT_LEN_BYTES = 4089 # not including the CCSDS header
|
|
38
|
+
|
|
39
|
+
def __init__(self):
|
|
40
|
+
"""Initialization."""
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def calculate_crc(
|
|
45
|
+
cls,
|
|
46
|
+
ccsds_version_number,
|
|
47
|
+
ccsds_packet_type,
|
|
48
|
+
ccsds_secondary_flag,
|
|
49
|
+
ccsds_apid,
|
|
50
|
+
ccsds_sequence_flag,
|
|
51
|
+
ccsds_sequence_count,
|
|
52
|
+
ccsds_packet_length,
|
|
53
|
+
body,
|
|
54
|
+
):
|
|
55
|
+
"""Calculate one CRC from the parsed fields of one packet.
|
|
56
|
+
|
|
57
|
+
Parsed fields must be the CCSDS header and one body excluding the CRC at the end of the packet.
|
|
58
|
+
"""
|
|
59
|
+
pkt_header_bit_string = ""
|
|
60
|
+
# TODO re-use header field length in ccsdspy packet_types.py
|
|
61
|
+
pkt_header_bit_string += "{0:03b}".format(ccsds_version_number)
|
|
62
|
+
pkt_header_bit_string += "{0:01b}".format(ccsds_packet_type)
|
|
63
|
+
pkt_header_bit_string += "{0:01b}".format(ccsds_secondary_flag)
|
|
64
|
+
pkt_header_bit_string += "{0:011b}".format(ccsds_apid)
|
|
65
|
+
pkt_header_bit_string += "{0:02b}".format(ccsds_sequence_flag)
|
|
66
|
+
pkt_header_bit_string += "{0:014b}".format(ccsds_sequence_count)
|
|
67
|
+
pkt_header_bit_string += "{0:016b}".format(ccsds_packet_length)
|
|
68
|
+
pkt_bytearray = [
|
|
69
|
+
int(pkt_header_bit_string[i : i + 8], 2)
|
|
70
|
+
for i in range(0, len(pkt_header_bit_string), 8)
|
|
71
|
+
]
|
|
72
|
+
pkt_bytearray += body.tolist()
|
|
73
|
+
|
|
74
|
+
crc = (
|
|
75
|
+
cls.JUMBO_CRC
|
|
76
|
+
if ccsds_packet_length > cls.JUMBO_TLM_PKT_LEN_BYTES
|
|
77
|
+
else cls.CRC
|
|
78
|
+
)
|
|
79
|
+
return crc.calc(pkt_bytearray)
|
|
80
|
+
|
|
81
|
+
def convert(
|
|
82
|
+
self,
|
|
83
|
+
ccsds_version_number_array,
|
|
84
|
+
ccsds_packet_type_array,
|
|
85
|
+
ccsds_secondary_flag_array,
|
|
86
|
+
ccsds_apid_array,
|
|
87
|
+
ccsds_sequence_flag_array,
|
|
88
|
+
ccsds_sequence_count_array,
|
|
89
|
+
ccsds_packet_length_array,
|
|
90
|
+
body_array,
|
|
91
|
+
):
|
|
92
|
+
"""Converter to add a calculated CRC to the parsed packets.
|
|
93
|
+
|
|
94
|
+
@param ccsds_version_number_array: from the CCSDS header
|
|
95
|
+
@param ccsds_packet_type_array: from the CCSDS header
|
|
96
|
+
@param ccsds_secondary_flag_array: from the CCSDS header
|
|
97
|
+
@param ccsds_apid_array: from the CCSDS header
|
|
98
|
+
@param ccsds_sequence_flag_array: from the CCSDS header
|
|
99
|
+
@param ccsds_sequence_count_array: from the CCSDS header
|
|
100
|
+
@param ccsds_packet_length_array: from the CCSDS header
|
|
101
|
+
@param body_array: body of the packet, without the trailing CRC.
|
|
102
|
+
@return: the array of calculated CRCs.
|
|
103
|
+
"""
|
|
104
|
+
calculated_crc_array = []
|
|
105
|
+
|
|
106
|
+
for (
|
|
107
|
+
ccsds_version_number,
|
|
108
|
+
ccsds_packet_type,
|
|
109
|
+
ccsds_secondary_flag,
|
|
110
|
+
ccsds_apid,
|
|
111
|
+
ccsds_sequence_flag,
|
|
112
|
+
ccsds_sequence_count,
|
|
113
|
+
ccsds_packet_length,
|
|
114
|
+
body,
|
|
115
|
+
) in zip(
|
|
116
|
+
ccsds_version_number_array,
|
|
117
|
+
ccsds_packet_type_array,
|
|
118
|
+
ccsds_secondary_flag_array,
|
|
119
|
+
ccsds_apid_array,
|
|
120
|
+
ccsds_sequence_flag_array,
|
|
121
|
+
ccsds_sequence_count_array,
|
|
122
|
+
ccsds_packet_length_array,
|
|
123
|
+
body_array,
|
|
124
|
+
):
|
|
125
|
+
crc = self.calculate_crc(
|
|
126
|
+
ccsds_version_number,
|
|
127
|
+
ccsds_packet_type,
|
|
128
|
+
ccsds_secondary_flag,
|
|
129
|
+
ccsds_apid,
|
|
130
|
+
ccsds_sequence_flag,
|
|
131
|
+
ccsds_sequence_count,
|
|
132
|
+
ccsds_packet_length,
|
|
133
|
+
body,
|
|
134
|
+
)
|
|
135
|
+
calculated_crc_array.append(crc)
|
|
136
|
+
|
|
137
|
+
return calculated_crc_array
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def calculate_crc(f, crc_size_bytes=2):
|
|
141
|
+
"""Calculate a CRC for each packet so to compare it with the CRC sent at the end of the packets."""
|
|
142
|
+
pkt = ccsdspy.VariableLength(
|
|
143
|
+
[
|
|
144
|
+
ccsdspy.PacketArray(
|
|
145
|
+
name="body",
|
|
146
|
+
data_type="uint",
|
|
147
|
+
bit_length=8,
|
|
148
|
+
array_shape="expand", # makes the body field expand
|
|
149
|
+
),
|
|
150
|
+
ccsdspy.PacketField(
|
|
151
|
+
name="checksum_real", data_type="uint", bit_length=8 * crc_size_bytes
|
|
152
|
+
),
|
|
153
|
+
]
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
input_fields = [
|
|
157
|
+
"CCSDS_VERSION_NUMBER",
|
|
158
|
+
"CCSDS_PACKET_TYPE",
|
|
159
|
+
"CCSDS_SECONDARY_FLAG",
|
|
160
|
+
"CCSDS_APID",
|
|
161
|
+
"CCSDS_SEQUENCE_FLAG",
|
|
162
|
+
"CCSDS_SEQUENCE_COUNT",
|
|
163
|
+
"CCSDS_PACKET_LENGTH",
|
|
164
|
+
"body",
|
|
165
|
+
]
|
|
166
|
+
pkt.add_converted_field(
|
|
167
|
+
input_fields,
|
|
168
|
+
"checksum_calculated",
|
|
169
|
+
CalculatedChecksum(),
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
parsed_result = pkt.load(f, include_primary_header=True, reset_file_obj=True)
|
|
174
|
+
|
|
175
|
+
# check that the calculated checksum and the one found in the packet are the same
|
|
176
|
+
if np.all(
|
|
177
|
+
parsed_result["checksum_real"] == parsed_result["checksum_calculated"]
|
|
178
|
+
):
|
|
179
|
+
# return the found checksum for further comparisons
|
|
180
|
+
return parsed_result["checksum_real"]
|
|
181
|
+
else:
|
|
182
|
+
raise CCSDSParsingException(
|
|
183
|
+
"The CRC calculated does not match the CRC read in the packet "
|
|
184
|
+
)
|
|
185
|
+
except IndexError:
|
|
186
|
+
logger.warning("Unable to parse packet to calculate CRC")
|
|
187
|
+
raise CRCNotCalculatedError("Unable to parse packet to calculate CRC")
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def import_ccsds_packet_packages():
|
|
191
|
+
"""Import of the subpackages of ccsds.packets which are meant to contain the CCSDSpy packet definitions.
|
|
192
|
+
|
|
193
|
+
Stolen from https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-namespace-packages
|
|
194
|
+
|
|
195
|
+
@return: the set of the imported packages
|
|
196
|
+
"""
|
|
197
|
+
import importlib
|
|
198
|
+
import pkgutil
|
|
199
|
+
|
|
200
|
+
# TODO: use a constant for ccsds.packets
|
|
201
|
+
import ccsds.packets # noqa
|
|
202
|
+
|
|
203
|
+
def iter_namespace(ns_pkg):
|
|
204
|
+
return pkgutil.iter_modules(ns_pkg.__path__, ns_pkg.__name__ + ".")
|
|
205
|
+
|
|
206
|
+
return {
|
|
207
|
+
name: importlib.import_module(name)
|
|
208
|
+
for finder, name, ispkg in iter_namespace(ccsds.packets)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
def get_packet_definitions():
|
|
213
|
+
"""Select packet definitions which will be parsed in the first round or second round, as a refinement for some APIDs.
|
|
214
|
+
|
|
215
|
+
First round parsing: object instances of _BasePackets which have an `apid` but no `sub_apid`
|
|
216
|
+
Second round parsing: object instances of _BasePackets which have an `apid` and a `sub_apid`
|
|
217
|
+
"""
|
|
218
|
+
# TODO use the clasees defined in Packets.py to simply the handling of packets
|
|
219
|
+
first_round_parsers = {}
|
|
220
|
+
second_round_parsers = {}
|
|
221
|
+
|
|
222
|
+
import_ccsds_packet_packages()
|
|
223
|
+
|
|
224
|
+
for object in gc.get_objects():
|
|
225
|
+
if isinstance(object, ccsdspy.packet_types._BasePacket) and hasattr(
|
|
226
|
+
object, "apid"
|
|
227
|
+
):
|
|
228
|
+
if hasattr(object, "sub_apid"):
|
|
229
|
+
if object.apid not in second_round_parsers:
|
|
230
|
+
second_round_parsers[object.apid] = {}
|
|
231
|
+
if "pkts" not in second_round_parsers[object.apid]:
|
|
232
|
+
second_round_parsers[object.apid]["pkts"] = {}
|
|
233
|
+
second_round_parsers[object.apid]["pkts"][object.sub_apid] = object
|
|
234
|
+
else:
|
|
235
|
+
first_round_parsers[object.apid] = object
|
|
236
|
+
if hasattr(object, "decision_fun"):
|
|
237
|
+
if object.apid not in second_round_parsers:
|
|
238
|
+
second_round_parsers[object.apid] = {}
|
|
239
|
+
second_round_parsers[object.apid]["pre_parser"] = object
|
|
240
|
+
|
|
241
|
+
return first_round_parsers, second_round_parsers
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def get_sub_packet_keys(parsed_apids, sub_apid: dict):
|
|
245
|
+
"""Identify sub-packet keys when single APId does not have consistent packet structures."""
|
|
246
|
+
decision_fun = sub_apid["pre_parser"].decision_fun
|
|
247
|
+
if hasattr(sub_apid["pre_parser"], "decision_field"):
|
|
248
|
+
decision_field = sub_apid["pre_parser"].decision_field
|
|
249
|
+
return [
|
|
250
|
+
decision_fun(decision_value)
|
|
251
|
+
for decision_value in list(parsed_apids[decision_field])
|
|
252
|
+
]
|
|
253
|
+
else:
|
|
254
|
+
# all the elements of the parsed_aids dictionary have
|
|
255
|
+
# the same length which is the number of packet parsed.
|
|
256
|
+
# we pick the first one to iterate on our packets.
|
|
257
|
+
first_key = list(parsed_apids.keys())[0]
|
|
258
|
+
return [decision_fun() for _ in range(0, len(parsed_apids[first_key]))]
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def distribute_packets(keyss, stream1):
|
|
262
|
+
"""Distribute binary stream into multiple binary stream with consistent sub-packet structures.
|
|
263
|
+
|
|
264
|
+
Used when single APID does not have consistent packet structure.
|
|
265
|
+
"""
|
|
266
|
+
buffers = {}
|
|
267
|
+
rows = ccsdspy.utils.split_packet_bytes(stream1)
|
|
268
|
+
for i in range(0, len(keyss)):
|
|
269
|
+
if keyss[i] not in buffers:
|
|
270
|
+
buffers[keyss[i]] = bytes()
|
|
271
|
+
buffers[keyss[i]] += rows[i]
|
|
272
|
+
buffers = {k: io.BytesIO(v) for k, v in buffers.items()}
|
|
273
|
+
return buffers
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def parse_ccsds_file(ccsds_file: str, do_calculate_crc: bool = False):
|
|
277
|
+
"""Parse a pure CCSDS binary file (only CCSDS packets)."""
|
|
278
|
+
apid_packets, apid_multi_pkt = get_packet_definitions()
|
|
279
|
+
logger.info("Split input file per APIDs")
|
|
280
|
+
stream_by_apid = ccsdspy.utils.split_by_apid(ccsds_file)
|
|
281
|
+
dfs = dict()
|
|
282
|
+
for apid, streams in stream_by_apid.items():
|
|
283
|
+
logger.info("Parse APID %s", apid)
|
|
284
|
+
try:
|
|
285
|
+
pkt = apid_packets.get(apid, default_pkt)
|
|
286
|
+
parsed_apids = pkt.load(
|
|
287
|
+
streams, include_primary_header=True, reset_file_obj=True
|
|
288
|
+
)
|
|
289
|
+
if do_calculate_crc:
|
|
290
|
+
try:
|
|
291
|
+
parsed_apids["calculated_crc"] = calculate_crc(streams)
|
|
292
|
+
except CRCNotCalculatedError as e:
|
|
293
|
+
logger.warning(str(e))
|
|
294
|
+
name = get_tab_name(apid, pkt, dfs.keys())
|
|
295
|
+
if apid in apid_multi_pkt:
|
|
296
|
+
dfs[name] = dict()
|
|
297
|
+
keys = get_sub_packet_keys(parsed_apids, apid_multi_pkt[apid])
|
|
298
|
+
buffer = distribute_packets(keys, streams)
|
|
299
|
+
for key, minor_pkt in apid_multi_pkt[apid]["pkts"].items():
|
|
300
|
+
logger.info(
|
|
301
|
+
"Parse sub-APID %s %s",
|
|
302
|
+
apid_multi_pkt[apid]["pre_parser"].decision_fun,
|
|
303
|
+
key,
|
|
304
|
+
)
|
|
305
|
+
if hasattr(minor_pkt, "set_alt_inputs"):
|
|
306
|
+
minor_pkt.set_alt_inputs(
|
|
307
|
+
dfs[name]
|
|
308
|
+
) # add reference to previously parsed pkt in the same group
|
|
309
|
+
parsed_sub_apid = minor_pkt.load(
|
|
310
|
+
buffer[key], include_primary_header=True, reset_file_obj=True
|
|
311
|
+
)
|
|
312
|
+
inner_name = get_tab_name(apid, minor_pkt, dfs.keys())
|
|
313
|
+
parsed_sub_apid = cast_to_list(parsed_sub_apid)
|
|
314
|
+
if do_calculate_crc:
|
|
315
|
+
try:
|
|
316
|
+
parsed_sub_apid["calculated_crc"] = calculate_crc(streams)
|
|
317
|
+
except CRCNotCalculatedError as e:
|
|
318
|
+
logger.warning(str(e))
|
|
319
|
+
dfs[name][inner_name] = pd.DataFrame.from_dict(parsed_sub_apid)
|
|
320
|
+
logger.info(
|
|
321
|
+
"%s/%s, found %i records.",
|
|
322
|
+
name,
|
|
323
|
+
inner_name,
|
|
324
|
+
dfs[name][inner_name].size,
|
|
325
|
+
)
|
|
326
|
+
else:
|
|
327
|
+
try:
|
|
328
|
+
parsed_apids = cast_to_list(parsed_apids)
|
|
329
|
+
current_df = pd.DataFrame.from_dict(parsed_apids)
|
|
330
|
+
dfs[name] = current_df
|
|
331
|
+
logger.info("%s, found %i records.", name, len(current_df))
|
|
332
|
+
except ValueError as e:
|
|
333
|
+
print(str(e))
|
|
334
|
+
except AssertionError:
|
|
335
|
+
logger.warning(
|
|
336
|
+
"APID %i was not parseable because packet length inconsistent with CCSDS header description",
|
|
337
|
+
apid,
|
|
338
|
+
)
|
|
339
|
+
except CCSDSParsingException as e:
|
|
340
|
+
logger.warning("APID %i: %s", apid, str(e))
|
|
341
|
+
|
|
342
|
+
return dfs
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
def get_tab_name(apid, pkt_def, existing_names):
|
|
346
|
+
"""Proposes a tab name for each APID or sub-packet structure of an APID.
|
|
347
|
+
|
|
348
|
+
The tab name can be used as keys in the dictionary of DataFrames or as tab names in the Excel spreadsheet.
|
|
349
|
+
|
|
350
|
+
@param apid: APID
|
|
351
|
+
@param pkt_def: current packet definition.
|
|
352
|
+
preferably, the packet definition has a "name" property which will be used to name the tab.
|
|
353
|
+
If not available the name of the class implementing the packet structure definitionn is used.
|
|
354
|
+
@param existing_names: already used names, to avoid duplicates. A counter is added to duplicate names.
|
|
355
|
+
@return: a unique tab name for the current APID and packet structure definition.
|
|
356
|
+
"""
|
|
357
|
+
if hasattr(pkt_def, "name"):
|
|
358
|
+
name = f"{apid}.{pkt_def.name}"
|
|
359
|
+
else:
|
|
360
|
+
name = f"{apid}.{pkt_def.__class__.__name__}"
|
|
361
|
+
# we need that in case the name is used twice so that data is not overridden
|
|
362
|
+
n = 1
|
|
363
|
+
while name in existing_names:
|
|
364
|
+
name = f"{name} ({n})"
|
|
365
|
+
return name
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def cast_to_list(d):
|
|
369
|
+
"""Casts any multidimensional arrays to lists."""
|
|
370
|
+
for key, value in d.items():
|
|
371
|
+
if hasattr(value[0].__class__, "tolist"):
|
|
372
|
+
value = [v.tolist() for v in value]
|
|
373
|
+
d[key] = value
|
|
374
|
+
|
|
375
|
+
return d
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"""Remove non CCSDS binary code from input streams."""
|
|
2
|
+
import io
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
import bitstring
|
|
6
|
+
from tqdm import tqdm
|
|
7
|
+
|
|
8
|
+
logger = logging.getLogger(__name__)
|
|
9
|
+
|
|
10
|
+
BYTE_SIZE_IN_BITS = 8
|
|
11
|
+
CCSDS_HEADER_LENGTH_BYTES = 8
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def remove_bdsem_and_message_headers(f):
|
|
15
|
+
"""Removes extra headers provided by the BDSEM data generation.
|
|
16
|
+
|
|
17
|
+
@param f: file handler
|
|
18
|
+
@return: file handler
|
|
19
|
+
"""
|
|
20
|
+
buffer = io.BytesIO()
|
|
21
|
+
|
|
22
|
+
bit_stream = bitstring.ConstBitStream(f)
|
|
23
|
+
|
|
24
|
+
n_pkts = 0
|
|
25
|
+
logger.info("Remove BDSEM wrappers and message headers.")
|
|
26
|
+
pbar = tqdm(total=bit_stream.length)
|
|
27
|
+
while bit_stream.pos < bit_stream.length:
|
|
28
|
+
pbar.update(bit_stream.pos)
|
|
29
|
+
control_word = bit_stream.read("uintle:32")
|
|
30
|
+
sse_length = control_word
|
|
31
|
+
|
|
32
|
+
# skipping 32 bits of unused
|
|
33
|
+
_ = bit_stream.read(32)
|
|
34
|
+
packet_length = sse_length - 4 # remove the unused bytes
|
|
35
|
+
|
|
36
|
+
n_pkts += 1
|
|
37
|
+
logger.debug("read packet %i", n_pkts)
|
|
38
|
+
packet_data = bit_stream.read(packet_length * 8)
|
|
39
|
+
packet_data_bytes = packet_data.tobytes()
|
|
40
|
+
# read CCSDS header to double check the length of the packet
|
|
41
|
+
ccsds_packet_length = int.from_bytes(
|
|
42
|
+
packet_data_bytes[4:6], byteorder="big", signed=False
|
|
43
|
+
)
|
|
44
|
+
if ccsds_packet_length - 1 == packet_length - CCSDS_HEADER_LENGTH_BYTES:
|
|
45
|
+
buffer.write(packet_data_bytes)
|
|
46
|
+
else:
|
|
47
|
+
apid = (
|
|
48
|
+
int.from_bytes(packet_data_bytes[0:2], byteorder="big", signed=False)
|
|
49
|
+
& 0b0000011111111111
|
|
50
|
+
)
|
|
51
|
+
sequence_cnt = (
|
|
52
|
+
int.from_bytes(packet_data_bytes[2:3], byteorder="big", signed=False)
|
|
53
|
+
& 0b0011111111111111
|
|
54
|
+
)
|
|
55
|
+
logger.warning(
|
|
56
|
+
"Skip packet apid %i, sequence count %i: length did not match with the packet length specified in the message header",
|
|
57
|
+
apid,
|
|
58
|
+
sequence_cnt,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
buffer.seek(0)
|
|
62
|
+
return buffer
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def remove_bdsem(f):
|
|
66
|
+
"""Remove BDSEM headers."""
|
|
67
|
+
buffer = io.BytesIO()
|
|
68
|
+
|
|
69
|
+
bit_stream = bitstring.ConstBitStream(f)
|
|
70
|
+
logger.info("Remove BDSEM wrappers.")
|
|
71
|
+
pbar = tqdm(total=bit_stream.length)
|
|
72
|
+
while bit_stream.pos < bit_stream.length:
|
|
73
|
+
pbar.update(bit_stream.pos)
|
|
74
|
+
packet_header = bit_stream.read(48)
|
|
75
|
+
packet_length = packet_header[-16:].uint
|
|
76
|
+
packet_data = bit_stream.read(packet_length * 8)
|
|
77
|
+
crc = bit_stream.read(8)
|
|
78
|
+
buffer.write(packet_header.tobytes() + packet_data.tobytes() + crc.tobytes())
|
|
79
|
+
|
|
80
|
+
buffer.seek(0)
|
|
81
|
+
|
|
82
|
+
return buffer
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def remove_mise_and_headers(f):
|
|
86
|
+
"""Remove packet markers from Raw mode file."""
|
|
87
|
+
header_size = 4
|
|
88
|
+
ccsds_header_size = 6
|
|
89
|
+
offset_size = 1
|
|
90
|
+
buffer = io.BytesIO()
|
|
91
|
+
|
|
92
|
+
raw_data = f.read()
|
|
93
|
+
starting_idx = []
|
|
94
|
+
|
|
95
|
+
logger.info("Remove packet markers.")
|
|
96
|
+
logger.info("Get starting indices.")
|
|
97
|
+
for i in tqdm(range(0, len(raw_data[:-header_size]))):
|
|
98
|
+
if start_sequence(raw_data[i : i + header_size]):
|
|
99
|
+
starting_idx.append(i)
|
|
100
|
+
|
|
101
|
+
logger.info("Rebuild the binary stream skipping the markers")
|
|
102
|
+
for s in tqdm(starting_idx):
|
|
103
|
+
hdr_start = s + header_size
|
|
104
|
+
hdr_end = hdr_start + ccsds_header_size
|
|
105
|
+
ccsds_header = raw_data[hdr_start:hdr_end]
|
|
106
|
+
pkt_len = int.from_bytes(ccsds_header[-2:], byteorder="big") + offset_size
|
|
107
|
+
data = raw_data[hdr_start : hdr_end + pkt_len]
|
|
108
|
+
buffer.write(data)
|
|
109
|
+
|
|
110
|
+
buffer.seek(0)
|
|
111
|
+
|
|
112
|
+
return buffer
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def start_sequence(seq):
|
|
116
|
+
"""Returns True if seq is on the beginning of a marker between CCSDS packets."""
|
|
117
|
+
return seq[1] == 0xF0 and seq[0] == seq[2] == seq[3] != 0x00
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def strip_non_ccsds_headers(
|
|
121
|
+
file_handler, is_bdsem: bool, has_pkt_header: bool, has_json_header: bool
|
|
122
|
+
):
|
|
123
|
+
"""Remove all cases of non CCSDS headers which can occur in Europa-Clipper SDS inputs, mostly in test cases.
|
|
124
|
+
|
|
125
|
+
@param filename: input binary filename
|
|
126
|
+
@param is_bdsem: file coming from BDSEM, else RAW
|
|
127
|
+
@param has_pkt_header:
|
|
128
|
+
@param has_json_header:
|
|
129
|
+
@return: the file handler where the CCSDS packets start
|
|
130
|
+
"""
|
|
131
|
+
if has_json_header:
|
|
132
|
+
logger.info("Skip json header.")
|
|
133
|
+
file_handler.readline()
|
|
134
|
+
|
|
135
|
+
if is_bdsem:
|
|
136
|
+
if has_pkt_header:
|
|
137
|
+
return remove_bdsem_and_message_headers(file_handler)
|
|
138
|
+
else:
|
|
139
|
+
return remove_bdsem(file_handler)
|
|
140
|
+
else:
|
|
141
|
+
if has_pkt_header:
|
|
142
|
+
return remove_mise_and_headers(file_handler)
|
|
143
|
+
else:
|
|
144
|
+
return file_handler
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Utilities to test the packet parsing."""
|
|
2
|
+
import logging
|
|
3
|
+
import os
|
|
4
|
+
import pickle
|
|
5
|
+
|
|
6
|
+
import pandas as pd
|
|
7
|
+
from spac_kit.parser import parse_ccsds_file
|
|
8
|
+
from spac_kit.parser import strip_non_ccsds_headers
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def compare(
|
|
14
|
+
local_dir: str,
|
|
15
|
+
is_bdsem: bool,
|
|
16
|
+
has_pkt_header: bool,
|
|
17
|
+
has_json_header: bool,
|
|
18
|
+
create_output: bool = False,
|
|
19
|
+
):
|
|
20
|
+
"""Run paring and compare results with a reference.
|
|
21
|
+
|
|
22
|
+
@param local_dir:
|
|
23
|
+
@param is_bdsem:
|
|
24
|
+
@param has_pkt_header:
|
|
25
|
+
@param has_json_header:
|
|
26
|
+
@param create_output:
|
|
27
|
+
@return:
|
|
28
|
+
"""
|
|
29
|
+
input_file = os.path.join(local_dir, "in.bin")
|
|
30
|
+
|
|
31
|
+
with open(input_file, "rb") as f:
|
|
32
|
+
ccsds_file = strip_non_ccsds_headers(
|
|
33
|
+
f, is_bdsem, has_pkt_header, has_json_header
|
|
34
|
+
)
|
|
35
|
+
dfs = parse_ccsds_file(ccsds_file, do_calculate_crc=True)
|
|
36
|
+
|
|
37
|
+
output_file = os.path.join(local_dir, "out.pickle")
|
|
38
|
+
|
|
39
|
+
# save the result as needed
|
|
40
|
+
if create_output:
|
|
41
|
+
with open(output_file, "wb") as f:
|
|
42
|
+
f.write(pickle.dumps(dfs))
|
|
43
|
+
|
|
44
|
+
with open(output_file, "rb") as f:
|
|
45
|
+
dfs_expected = pickle.load(f)
|
|
46
|
+
|
|
47
|
+
recursive_compare(dfs, dfs_expected)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def recursive_compare(dfs, dfs_expected):
|
|
51
|
+
"""Compare embedded dictionary of dictionaries of panda dataframes. Compare the keys and the actual dataframes.
|
|
52
|
+
|
|
53
|
+
None should be missing and all should match.
|
|
54
|
+
@param dfs: dictionnary of dictionbaries of dataframe
|
|
55
|
+
@param dfs_expected: expected dictionnary of dictionnaries
|
|
56
|
+
@return: True is the pandas dataframe are identical at the same location as in the
|
|
57
|
+
"""
|
|
58
|
+
for k, df in dfs.items():
|
|
59
|
+
logger.info("Compare dataframe %s", k)
|
|
60
|
+
assert k in dfs_expected.keys()
|
|
61
|
+
if isinstance(dfs_expected[k], dict):
|
|
62
|
+
recursive_compare(df, dfs_expected[k])
|
|
63
|
+
else:
|
|
64
|
+
pd.testing.assert_frame_equal(df, dfs_expected[k], check_dtype=False)
|
|
65
|
+
del dfs_expected[k]
|
|
66
|
+
|
|
67
|
+
assert len(dfs_expected) == 0
|
spac_kit/parser/util.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Utilities shared."""
|
|
2
|
+
import ccsdspy
|
|
3
|
+
from ccsdspy.constants import BITS_PER_BYTE
|
|
4
|
+
|
|
5
|
+
default_pkt = ccsdspy.VariableLength(
|
|
6
|
+
[
|
|
7
|
+
ccsdspy.PacketArray(
|
|
8
|
+
name="data",
|
|
9
|
+
data_type="uint",
|
|
10
|
+
bit_length=BITS_PER_BYTE,
|
|
11
|
+
array_shape="expand",
|
|
12
|
+
)
|
|
13
|
+
]
|
|
14
|
+
)
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: spac_kit
|
|
3
|
+
Version: 0.1.0.dev0
|
|
4
|
+
Summary: Collection of Python tools for working with CCSDS Space Packets
|
|
5
|
+
Home-page: https://github.com/CCSDSPy/SPaC-Kit
|
|
6
|
+
Author: NASA/Caltech/JPL
|
|
7
|
+
License: Apache License
|
|
8
|
+
==============
|
|
9
|
+
|
|
10
|
+
_Version 2.0, January 2004_
|
|
11
|
+
_<<http://www.apache.org/licenses/>>_
|
|
12
|
+
|
|
13
|
+
### Terms and Conditions for use, reproduction, and distribution
|
|
14
|
+
|
|
15
|
+
#### 1. Definitions
|
|
16
|
+
|
|
17
|
+
“License” shall mean the terms and conditions for use, reproduction, and
|
|
18
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
19
|
+
|
|
20
|
+
“Licensor” shall mean the copyright owner or entity authorized by the copyright
|
|
21
|
+
owner that is granting the License.
|
|
22
|
+
|
|
23
|
+
“Legal Entity” shall mean the union of the acting entity and all other entities
|
|
24
|
+
that control, are controlled by, or are under common control with that entity.
|
|
25
|
+
For the purposes of this definition, “control” means **(i)** the power, direct or
|
|
26
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
27
|
+
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
|
|
28
|
+
outstanding shares, or **(iii)** beneficial ownership of such entity.
|
|
29
|
+
|
|
30
|
+
“You” (or “Your”) shall mean an individual or Legal Entity exercising
|
|
31
|
+
permissions granted by this License.
|
|
32
|
+
|
|
33
|
+
“Source” form shall mean the preferred form for making modifications, including
|
|
34
|
+
but not limited to software source code, documentation source, and configuration
|
|
35
|
+
files.
|
|
36
|
+
|
|
37
|
+
“Object” form shall mean any form resulting from mechanical transformation or
|
|
38
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
39
|
+
generated documentation, and conversions to other media types.
|
|
40
|
+
|
|
41
|
+
“Work” shall mean the work of authorship, whether in Source or Object form, made
|
|
42
|
+
available under the License, as indicated by a copyright notice that is included
|
|
43
|
+
in or attached to the work (an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
“Derivative Works” shall mean any work, whether in Source or Object form, that
|
|
46
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
47
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
48
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
49
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
50
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
“Contribution” shall mean any work of authorship, including the original version
|
|
53
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
54
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
55
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
56
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
57
|
+
“submitted” means any form of electronic, verbal, or written communication sent
|
|
58
|
+
to the Licensor or its representatives, including but not limited to
|
|
59
|
+
communication on electronic mailing lists, source code control systems, and
|
|
60
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
61
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
62
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
63
|
+
owner as “Not a Contribution.”
|
|
64
|
+
|
|
65
|
+
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
|
|
66
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
67
|
+
incorporated within the Work.
|
|
68
|
+
|
|
69
|
+
#### 2. Grant of Copyright License
|
|
70
|
+
|
|
71
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
72
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
73
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
74
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
75
|
+
Derivative Works in Source or Object form.
|
|
76
|
+
|
|
77
|
+
#### 3. Grant of Patent License
|
|
78
|
+
|
|
79
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
80
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
81
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
82
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
83
|
+
such license applies only to those patent claims licensable by such Contributor
|
|
84
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
85
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
86
|
+
submitted. If You institute patent litigation against any entity (including a
|
|
87
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
88
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
|
89
|
+
patent infringement, then any patent licenses granted to You under this License
|
|
90
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
91
|
+
|
|
92
|
+
#### 4. Redistribution
|
|
93
|
+
|
|
94
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
95
|
+
in any medium, with or without modifications, and in Source or Object form,
|
|
96
|
+
provided that You meet the following conditions:
|
|
97
|
+
|
|
98
|
+
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
|
|
99
|
+
this License; and
|
|
100
|
+
* **(b)** You must cause any modified files to carry prominent notices stating that You
|
|
101
|
+
changed the files; and
|
|
102
|
+
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
|
|
103
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
|
104
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
|
105
|
+
Derivative Works; and
|
|
106
|
+
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
|
107
|
+
Derivative Works that You distribute must include a readable copy of the
|
|
108
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
109
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
110
|
+
following places: within a NOTICE text file distributed as part of the
|
|
111
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
112
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
113
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
114
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
115
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
116
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
117
|
+
provided that such additional attribution notices cannot be construed as
|
|
118
|
+
modifying the License.
|
|
119
|
+
|
|
120
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
121
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
122
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
123
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
124
|
+
with the conditions stated in this License.
|
|
125
|
+
|
|
126
|
+
#### 5. Submission of Contributions
|
|
127
|
+
|
|
128
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
129
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
130
|
+
conditions of this License, without any additional terms or conditions.
|
|
131
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
132
|
+
any separate license agreement you may have executed with Licensor regarding
|
|
133
|
+
such Contributions.
|
|
134
|
+
|
|
135
|
+
#### 6. Trademarks
|
|
136
|
+
|
|
137
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
138
|
+
service marks, or product names of the Licensor, except as required for
|
|
139
|
+
reasonable and customary use in describing the origin of the Work and
|
|
140
|
+
reproducing the content of the NOTICE file.
|
|
141
|
+
|
|
142
|
+
#### 7. Disclaimer of Warranty
|
|
143
|
+
|
|
144
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
145
|
+
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
147
|
+
including, without limitation, any warranties or conditions of TITLE,
|
|
148
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
149
|
+
solely responsible for determining the appropriateness of using or
|
|
150
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
|
151
|
+
permissions under this License.
|
|
152
|
+
|
|
153
|
+
#### 8. Limitation of Liability
|
|
154
|
+
|
|
155
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
|
156
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
157
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
|
159
|
+
or consequential damages of any character arising as a result of this License or
|
|
160
|
+
out of the use or inability to use the Work (including but not limited to
|
|
161
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
162
|
+
any and all other commercial damages or losses), even if such Contributor has
|
|
163
|
+
been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
#### 9. Accepting Warranty or Additional Liability
|
|
166
|
+
|
|
167
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
168
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
169
|
+
other liability obligations and/or rights consistent with this License. However,
|
|
170
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
171
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
172
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
_END OF TERMS AND CONDITIONS_
|
|
177
|
+
|
|
178
|
+
### APPENDIX: How to apply the Apache License to your work
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
181
|
+
notice, with the fields enclosed by brackets `[]` replaced with your own
|
|
182
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
183
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
184
|
+
recommend that a file or class name and description of purpose be included on
|
|
185
|
+
the same “printed page” as the copyright notice for easier identification within
|
|
186
|
+
third-party archives.
|
|
187
|
+
|
|
188
|
+
Copyright [yyyy] [name of copyright owner]
|
|
189
|
+
|
|
190
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
191
|
+
you may not use this file except in compliance with the License.
|
|
192
|
+
You may obtain a copy of the License at
|
|
193
|
+
|
|
194
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
195
|
+
|
|
196
|
+
Unless required by applicable law or agreed to in writing, software
|
|
197
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
198
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
199
|
+
See the License for the specific language governing permissions and
|
|
200
|
+
limitations under the License.
|
|
201
|
+
|
|
202
|
+
Project-URL: Homepage, https://github.com/CCSDSPy/SPaC-Kit
|
|
203
|
+
Keywords: CCSDS,Space Packets,Downlink,Parser,Documentation
|
|
204
|
+
Classifier: Development Status :: 4 - Beta
|
|
205
|
+
Classifier: Environment :: Console
|
|
206
|
+
Classifier: Intended Audience :: Science/Research
|
|
207
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
208
|
+
Classifier: Natural Language :: English
|
|
209
|
+
Classifier: Operating System :: OS Independent
|
|
210
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
211
|
+
Classifier: Topic :: Scientific/Engineering
|
|
212
|
+
Requires-Python: <3.10,>=3.9
|
|
213
|
+
Description-Content-Type: text/markdown
|
|
214
|
+
License-File: LICENSE.md
|
|
215
|
+
Requires-Dist: ccsdspy~=1.3.0
|
|
216
|
+
Requires-Dist: crccheck~=1.3.0
|
|
217
|
+
Dynamic: license-file
|
|
218
|
+
|
|
219
|
+
[](CODE_OF_CONDUCT.md)
|
|
220
|
+
|
|
221
|
+
# SPaC-Kit
|
|
222
|
+
|
|
223
|
+
## ✨ Introduction
|
|
224
|
+
|
|
225
|
+
**SpaC-Kit** is a collection of Python tools for working with **CCSDS Space Packet**. It can generically:
|
|
226
|
+
|
|
227
|
+
- Parse data files into **Pandas DataFrames** or **Excel spreadsheets**
|
|
228
|
+
- **(Scheduled Feb 2026)** – Generate documentation in multiple formats (**HTML**, **Markdown**, **reStructuredText**, **PDF**)
|
|
229
|
+
- **(Scheduled Apr 2026)** – Generate simulated packets
|
|
230
|
+
|
|
231
|
+
SpaC-Kit supports mission- or instrument-specific CCSDS packet structures via plugin packages built on the [**CCSDSPy** library](https://docs.ccsdspy.org/).
|
|
232
|
+
|
|
233
|
+
### 🔌 Available Plugins
|
|
234
|
+
|
|
235
|
+
- [Europa Clipper CCSDS packet definitions](https://github.com/joshgarde/europa-cliper-ccsds-plugin)
|
|
236
|
+
- Want to define your own CCSDS packets? [Open a ticket](https://github.com/CCSDSPy/SPaC-Kit/issues) to start the discussion.
|
|
237
|
+
|
|
238
|
+
## Users
|
|
239
|
+
|
|
240
|
+
### Requirement
|
|
241
|
+
|
|
242
|
+
Tested with `python 3.9`.
|
|
243
|
+
|
|
244
|
+
Optionnally, but recommended, create a virtual environment:
|
|
245
|
+
|
|
246
|
+
python3 -m venv my_virtual_env
|
|
247
|
+
sournce my_virtual_env/bin/activate
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
### Install
|
|
251
|
+
|
|
252
|
+
Install you plugin library first, for example Europa-Clipper CCSDS packets definitions:
|
|
253
|
+
|
|
254
|
+
git clone https://github.com/joshgarde/europa-cliper-ccsds-plugin.git
|
|
255
|
+
cd europa-cliper-ccsds-plugin
|
|
256
|
+
pip install .
|
|
257
|
+
|
|
258
|
+
Install the SPaC-Kit package:
|
|
259
|
+
|
|
260
|
+
pip install spac_kit
|
|
261
|
+
|
|
262
|
+
### Use
|
|
263
|
+
|
|
264
|
+
parse-downlink --file {your ccsds file}
|
|
265
|
+
|
|
266
|
+
See more options with:
|
|
267
|
+
|
|
268
|
+
parse-downlink --help
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
## Developers
|
|
272
|
+
|
|
273
|
+
### Requirements
|
|
274
|
+
|
|
275
|
+
#### Python 3.9
|
|
276
|
+
|
|
277
|
+
#### Create a virtual environment
|
|
278
|
+
|
|
279
|
+
For example in command line:
|
|
280
|
+
|
|
281
|
+
python3 -m venv venv
|
|
282
|
+
source venv/bin/activate
|
|
283
|
+
|
|
284
|
+
#### Install CCSDSPy
|
|
285
|
+
|
|
286
|
+
To install the latest version of CCSDSPy:
|
|
287
|
+
|
|
288
|
+
pip install git+https://github.com/CCSDSPy/ccsdspy.git
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
#### Deploy the project, for developers
|
|
292
|
+
|
|
293
|
+
Clone the repository
|
|
294
|
+
|
|
295
|
+
Install the package
|
|
296
|
+
|
|
297
|
+
pip install -e '.[dev]'
|
|
298
|
+
pre-commit install && pre-commit install -t pre-push
|
|
299
|
+
|
|
300
|
+
Run an example:
|
|
301
|
+
|
|
302
|
+
python src/spa_kit/parse/downlink_to_excel.py
|
|
303
|
+
|
|
304
|
+
or
|
|
305
|
+
|
|
306
|
+
spac-parse --help
|
|
307
|
+
|
|
308
|
+
or
|
|
309
|
+
|
|
310
|
+
spac-parse --file ./data/ecm_mag_testcase6_cmds_split_out.log --bdsem --header
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
#### Build and publish the package
|
|
314
|
+
|
|
315
|
+
Update the version number in file `setup.cfg`
|
|
316
|
+
|
|
317
|
+
Create a tag in the repository
|
|
318
|
+
|
|
319
|
+
Build the project:
|
|
320
|
+
|
|
321
|
+
python3 -m pip install --upgrade build
|
|
322
|
+
rm -rf dist/
|
|
323
|
+
python3 -m build
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
Publish the project:
|
|
327
|
+
|
|
328
|
+
twine upload dist/*
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
## Acknowledgment
|
|
333
|
+
|
|
334
|
+
This package heavily relies on `ccsdspy` library (see https://github.com/CCSDSPy/ccsdspy).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
spac_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
spac_kit/parser/Packets.py,sha256=2Gd7UB5Fy_0EQwHALsp3IBaTrTkIqIu-I0T6RbVot2Q,1346
|
|
3
|
+
spac_kit/parser/__init__.py,sha256=Gs8mG_m3uu1eqepPfbfKYfhLVjXT3GijNWZWPwNywOM,405
|
|
4
|
+
spac_kit/parser/downlink_to_excel.py,sha256=_LDNvTqtFWIe9k3u1NXDqiq3RnAg2IAFn9MyMzJzkys,3116
|
|
5
|
+
spac_kit/parser/logger.conf,sha256=5SsIQtMVp4oDQS5Wm7fQLsHM2ris158RSUn-8JJoTFg,436
|
|
6
|
+
spac_kit/parser/parse_ccsds_downlink.py,sha256=dWvKDapP9sMy6hWjxAVmddpQDfy7zlrtiC-KLym7wuM,13850
|
|
7
|
+
spac_kit/parser/remove_non_ccsds_headers.py,sha256=YGHGUx8noMbvHGXEysomRNJW39e8qHV4tzmEhbSZaKY,4506
|
|
8
|
+
spac_kit/parser/test_utils.py,sha256=TmtsrAPbIZjOcCFd14giSR5vr5F9unsftfv4S8DurNw,1967
|
|
9
|
+
spac_kit/parser/util.py,sha256=g78PVA2I1aYEneLJaKGbr6PqylrdtefYIkagZZ8vBpM,302
|
|
10
|
+
spac_kit-0.1.0.dev0.dist-info/licenses/LICENSE.md,sha256=Lh-qBbuRV0-jiCIBhfV7NgdwFxQFOXH3BKOzK865hRs,10480
|
|
11
|
+
spac_kit-0.1.0.dev0.dist-info/METADATA,sha256=VXoG02YQIBZuNYl4aD4RSBxCO-wFW1GaIbwNKwZcngw,15471
|
|
12
|
+
spac_kit-0.1.0.dev0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
+
spac_kit-0.1.0.dev0.dist-info/namespace_packages.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
14
|
+
spac_kit-0.1.0.dev0.dist-info/top_level.txt,sha256=2stGqiUpUjZ9xtRmkyA6ry8MGbHJIJrEeXH_kTutr7s,9
|
|
15
|
+
spac_kit-0.1.0.dev0.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
16
|
+
spac_kit-0.1.0.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
==============
|
|
3
|
+
|
|
4
|
+
_Version 2.0, January 2004_
|
|
5
|
+
_<<http://www.apache.org/licenses/>>_
|
|
6
|
+
|
|
7
|
+
### Terms and Conditions for use, reproduction, and distribution
|
|
8
|
+
|
|
9
|
+
#### 1. Definitions
|
|
10
|
+
|
|
11
|
+
“License” shall mean the terms and conditions for use, reproduction, and
|
|
12
|
+
distribution as defined by Sections 1 through 9 of this document.
|
|
13
|
+
|
|
14
|
+
“Licensor” shall mean the copyright owner or entity authorized by the copyright
|
|
15
|
+
owner that is granting the License.
|
|
16
|
+
|
|
17
|
+
“Legal Entity” shall mean the union of the acting entity and all other entities
|
|
18
|
+
that control, are controlled by, or are under common control with that entity.
|
|
19
|
+
For the purposes of this definition, “control” means **(i)** the power, direct or
|
|
20
|
+
indirect, to cause the direction or management of such entity, whether by
|
|
21
|
+
contract or otherwise, or **(ii)** ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or **(iii)** beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
“You” (or “Your”) shall mean an individual or Legal Entity exercising
|
|
25
|
+
permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
“Source” form shall mean the preferred form for making modifications, including
|
|
28
|
+
but not limited to software source code, documentation source, and configuration
|
|
29
|
+
files.
|
|
30
|
+
|
|
31
|
+
“Object” form shall mean any form resulting from mechanical transformation or
|
|
32
|
+
translation of a Source form, including but not limited to compiled object code,
|
|
33
|
+
generated documentation, and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
“Work” shall mean the work of authorship, whether in Source or Object form, made
|
|
36
|
+
available under the License, as indicated by a copyright notice that is included
|
|
37
|
+
in or attached to the work (an example is provided in the Appendix below).
|
|
38
|
+
|
|
39
|
+
“Derivative Works” shall mean any work, whether in Source or Object form, that
|
|
40
|
+
is based on (or derived from) the Work and for which the editorial revisions,
|
|
41
|
+
annotations, elaborations, or other modifications represent, as a whole, an
|
|
42
|
+
original work of authorship. For the purposes of this License, Derivative Works
|
|
43
|
+
shall not include works that remain separable from, or merely link (or bind by
|
|
44
|
+
name) to the interfaces of, the Work and Derivative Works thereof.
|
|
45
|
+
|
|
46
|
+
“Contribution” shall mean any work of authorship, including the original version
|
|
47
|
+
of the Work and any modifications or additions to that Work or Derivative Works
|
|
48
|
+
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
|
49
|
+
by the copyright owner or by an individual or Legal Entity authorized to submit
|
|
50
|
+
on behalf of the copyright owner. For the purposes of this definition,
|
|
51
|
+
“submitted” means any form of electronic, verbal, or written communication sent
|
|
52
|
+
to the Licensor or its representatives, including but not limited to
|
|
53
|
+
communication on electronic mailing lists, source code control systems, and
|
|
54
|
+
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
|
55
|
+
the purpose of discussing and improving the Work, but excluding communication
|
|
56
|
+
that is conspicuously marked or otherwise designated in writing by the copyright
|
|
57
|
+
owner as “Not a Contribution.”
|
|
58
|
+
|
|
59
|
+
“Contributor” shall mean Licensor and any individual or Legal Entity on behalf
|
|
60
|
+
of whom a Contribution has been received by Licensor and subsequently
|
|
61
|
+
incorporated within the Work.
|
|
62
|
+
|
|
63
|
+
#### 2. Grant of Copyright License
|
|
64
|
+
|
|
65
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
66
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
67
|
+
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
|
68
|
+
publicly display, publicly perform, sublicense, and distribute the Work and such
|
|
69
|
+
Derivative Works in Source or Object form.
|
|
70
|
+
|
|
71
|
+
#### 3. Grant of Patent License
|
|
72
|
+
|
|
73
|
+
Subject to the terms and conditions of this License, each Contributor hereby
|
|
74
|
+
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
|
75
|
+
irrevocable (except as stated in this section) patent license to make, have
|
|
76
|
+
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
|
77
|
+
such license applies only to those patent claims licensable by such Contributor
|
|
78
|
+
that are necessarily infringed by their Contribution(s) alone or by combination
|
|
79
|
+
of their Contribution(s) with the Work to which such Contribution(s) was
|
|
80
|
+
submitted. If You institute patent litigation against any entity (including a
|
|
81
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
|
82
|
+
Contribution incorporated within the Work constitutes direct or contributory
|
|
83
|
+
patent infringement, then any patent licenses granted to You under this License
|
|
84
|
+
for that Work shall terminate as of the date such litigation is filed.
|
|
85
|
+
|
|
86
|
+
#### 4. Redistribution
|
|
87
|
+
|
|
88
|
+
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
|
89
|
+
in any medium, with or without modifications, and in Source or Object form,
|
|
90
|
+
provided that You meet the following conditions:
|
|
91
|
+
|
|
92
|
+
* **(a)** You must give any other recipients of the Work or Derivative Works a copy of
|
|
93
|
+
this License; and
|
|
94
|
+
* **(b)** You must cause any modified files to carry prominent notices stating that You
|
|
95
|
+
changed the files; and
|
|
96
|
+
* **(c)** You must retain, in the Source form of any Derivative Works that You distribute,
|
|
97
|
+
all copyright, patent, trademark, and attribution notices from the Source form
|
|
98
|
+
of the Work, excluding those notices that do not pertain to any part of the
|
|
99
|
+
Derivative Works; and
|
|
100
|
+
* **(d)** If the Work includes a “NOTICE” text file as part of its distribution, then any
|
|
101
|
+
Derivative Works that You distribute must include a readable copy of the
|
|
102
|
+
attribution notices contained within such NOTICE file, excluding those notices
|
|
103
|
+
that do not pertain to any part of the Derivative Works, in at least one of the
|
|
104
|
+
following places: within a NOTICE text file distributed as part of the
|
|
105
|
+
Derivative Works; within the Source form or documentation, if provided along
|
|
106
|
+
with the Derivative Works; or, within a display generated by the Derivative
|
|
107
|
+
Works, if and wherever such third-party notices normally appear. The contents of
|
|
108
|
+
the NOTICE file are for informational purposes only and do not modify the
|
|
109
|
+
License. You may add Your own attribution notices within Derivative Works that
|
|
110
|
+
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
|
111
|
+
provided that such additional attribution notices cannot be construed as
|
|
112
|
+
modifying the License.
|
|
113
|
+
|
|
114
|
+
You may add Your own copyright statement to Your modifications and may provide
|
|
115
|
+
additional or different license terms and conditions for use, reproduction, or
|
|
116
|
+
distribution of Your modifications, or for any such Derivative Works as a whole,
|
|
117
|
+
provided Your use, reproduction, and distribution of the Work otherwise complies
|
|
118
|
+
with the conditions stated in this License.
|
|
119
|
+
|
|
120
|
+
#### 5. Submission of Contributions
|
|
121
|
+
|
|
122
|
+
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
|
123
|
+
for inclusion in the Work by You to the Licensor shall be under the terms and
|
|
124
|
+
conditions of this License, without any additional terms or conditions.
|
|
125
|
+
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
|
126
|
+
any separate license agreement you may have executed with Licensor regarding
|
|
127
|
+
such Contributions.
|
|
128
|
+
|
|
129
|
+
#### 6. Trademarks
|
|
130
|
+
|
|
131
|
+
This License does not grant permission to use the trade names, trademarks,
|
|
132
|
+
service marks, or product names of the Licensor, except as required for
|
|
133
|
+
reasonable and customary use in describing the origin of the Work and
|
|
134
|
+
reproducing the content of the NOTICE file.
|
|
135
|
+
|
|
136
|
+
#### 7. Disclaimer of Warranty
|
|
137
|
+
|
|
138
|
+
Unless required by applicable law or agreed to in writing, Licensor provides the
|
|
139
|
+
Work (and each Contributor provides its Contributions) on an “AS IS” BASIS,
|
|
140
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
141
|
+
including, without limitation, any warranties or conditions of TITLE,
|
|
142
|
+
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
|
143
|
+
solely responsible for determining the appropriateness of using or
|
|
144
|
+
redistributing the Work and assume any risks associated with Your exercise of
|
|
145
|
+
permissions under this License.
|
|
146
|
+
|
|
147
|
+
#### 8. Limitation of Liability
|
|
148
|
+
|
|
149
|
+
In no event and under no legal theory, whether in tort (including negligence),
|
|
150
|
+
contract, or otherwise, unless required by applicable law (such as deliberate
|
|
151
|
+
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
|
152
|
+
liable to You for damages, including any direct, indirect, special, incidental,
|
|
153
|
+
or consequential damages of any character arising as a result of this License or
|
|
154
|
+
out of the use or inability to use the Work (including but not limited to
|
|
155
|
+
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
|
156
|
+
any and all other commercial damages or losses), even if such Contributor has
|
|
157
|
+
been advised of the possibility of such damages.
|
|
158
|
+
|
|
159
|
+
#### 9. Accepting Warranty or Additional Liability
|
|
160
|
+
|
|
161
|
+
While redistributing the Work or Derivative Works thereof, You may choose to
|
|
162
|
+
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
|
163
|
+
other liability obligations and/or rights consistent with this License. However,
|
|
164
|
+
in accepting such obligations, You may act only on Your own behalf and on Your
|
|
165
|
+
sole responsibility, not on behalf of any other Contributor, and only if You
|
|
166
|
+
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
|
167
|
+
incurred by, or claims asserted against, such Contributor by reason of your
|
|
168
|
+
accepting any such warranty or additional liability.
|
|
169
|
+
|
|
170
|
+
_END OF TERMS AND CONDITIONS_
|
|
171
|
+
|
|
172
|
+
### APPENDIX: How to apply the Apache License to your work
|
|
173
|
+
|
|
174
|
+
To apply the Apache License to your work, attach the following boilerplate
|
|
175
|
+
notice, with the fields enclosed by brackets `[]` replaced with your own
|
|
176
|
+
identifying information. (Don't include the brackets!) The text should be
|
|
177
|
+
enclosed in the appropriate comment syntax for the file format. We also
|
|
178
|
+
recommend that a file or class name and description of purpose be included on
|
|
179
|
+
the same “printed page” as the copyright notice for easier identification within
|
|
180
|
+
third-party archives.
|
|
181
|
+
|
|
182
|
+
Copyright [yyyy] [name of copyright owner]
|
|
183
|
+
|
|
184
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
185
|
+
you may not use this file except in compliance with the License.
|
|
186
|
+
You may obtain a copy of the License at
|
|
187
|
+
|
|
188
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
189
|
+
|
|
190
|
+
Unless required by applicable law or agreed to in writing, software
|
|
191
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
192
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
193
|
+
See the License for the specific language governing permissions and
|
|
194
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
spac_kit
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|