27
29
30
31
32 input_file = "output_all_data_types.sdds"
33
34
35 sdds_obj.load(input_file)
36
37
38 if sdds_obj.mode == sdds.SDDS_BINARY:
39 print("SDDS file mode: SDDS_BINARY")
40 else:
41 print("SDDS file mode: SDDS_ASCII")
42
43
44 if sdds_obj.description[0]:
45 print(f"SDDS file description text: {sdds_obj.description[0]}")
46
47
48 if sdds_obj.description[1]:
49 print(f"SDDS file description contents: {sdds_obj.description[1]}")
50
51
52 if sdds_obj.parameterName:
53 print("\nParameters:")
54 for i, definition in enumerate(sdds_obj.parameterDefinition):
55 name = sdds_obj.parameterName[i]
57 units = definition[1]
58 description = definition[2]
59 print(f" {name}")
60 print(f" Datatype: {datatype}", end="")
61 if units:
62 print(f", Units: {units}", end="")
63 if description:
64 print(f", Description: {description}", end="")
65 print("")
66
67
68 if sdds_obj.arrayName:
69 print("\nArrays:")
70 for i, definition in enumerate(sdds_obj.arrayDefinition):
71 name = sdds_obj.arrayName[i]
73 units = definition[1]
74 description = definition[2]
75 dimensions = definition[7]
76 print(f" {name}")
77 print(f" Datatype: {datatype}, Dimensions: {dimensions}", end="")
78 if units:
79 print(f", Units: {units}", end="")
80 if description:
81 print(f", Description: {description}", end="")
82 print("")
83
84
85 if sdds_obj.columnName:
86 print("\nColumns:")
87 for i, definition in enumerate(sdds_obj.columnDefinition):
88 name = sdds_obj.columnName[i]
90 units = definition[1]
91 description = definition[2]
92 print(f" {name}")
93 print(f" Datatype: {datatype}", end="")
94 if units:
95 print(f", Units: {units}", end="")
96 if description:
97 print(f", Description: {description}", end="")
98 print("")
99
100
101 for page in range(sdds_obj.loaded_pages):
102 print(f"\nPage: {page + 1}")
103
104
105 for i, name in enumerate(sdds_obj.parameterName):
106 value = sdds_obj.parameterData[i][page]
107 print(f" Parameter '{name}': {value}")
108
109
110 for i, name in enumerate(sdds_obj.arrayName):
111 value = sdds_obj.arrayData[i][page]
112 print(f" Array '{name}': {value}")
113
114
115 for i, name in enumerate(sdds_obj.columnName):
116 value = sdds_obj.columnData[i][page]
117 print(f" Column '{name}': {value}")
118
A class to represent and manipulate SDDS datasets.
sdds_data_type_to_string(data_type_code)
Converts a numeric SDDS data type code to its string representation.
int main(int argc, char **argv)
Main function that processes the SDDS file.