Skip to content

Commit 3f8c7e3

Browse files
committed
removed k from temp
1 parent 4328247 commit 3f8c7e3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/openmc_data_to_json/transport.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,22 +97,22 @@ def extract_cross_section_data(h5_filename, json_filename):
9797
result['mass_number'] = isotope_object.mass_number
9898
result['metastable'] = isotope_object.metastable
9999
result['nuclide'] = isotope_object.name
100-
result['temperatures'] = isotope_object.temperatures
100+
result['temperatures'] = [str(temp).replace('K', '') for temp in isotope_object.temperatures]
101101

102102
result['reactions'] = {}
103103

104104
# Collect all unique temperatures first
105105
all_temperatures = set()
106106
for reaction in isotope_object.reactions.values():
107-
all_temperatures.update(reaction.xs.keys())
108-
107+
all_temperatures.update(str(temp).replace('K', '') for temp in reaction.xs.keys())
108+
print(all_temperatures)
109109
# Initialize the nested structure once
110110
for temperature in all_temperatures:
111-
result['reactions'][temperature] = {}
111+
result['reactions'][temperature.replace('K', '')] = {}
112112

113113
result['energy'] = {}
114114
for temperature, energy in isotope_object.energy.items():
115-
result['energy'][temperature] = energy
115+
result['energy'][temperature.replace('K', '')] = energy
116116

117117
for reaction_mt, reaction in isotope_object.reactions.items():
118118
temperatures_and_tabulars=reaction.xs
@@ -124,7 +124,7 @@ def extract_cross_section_data(h5_filename, json_filename):
124124
reaction_at_temperature_dict['threshold_idx'] = tabular._threshold_idx
125125
reaction_at_temperature_dict['xs'] = tabular.y
126126

127-
result['reactions'][temperature][reaction_mt] = reaction_at_temperature_dict
127+
result['reactions'][temperature.replace('K', '')][reaction_mt] = reaction_at_temperature_dict
128128

129129
# print(f"Reaction MT: {reaction_mt}, Temperature: {temperature}, Interpolation: {tabular.interpolation}, Threshold Index: {tabular._threshold_idx}, len XS: {len(tabular.x)}")
130130

0 commit comments

Comments
 (0)