@@ -287,14 +287,15 @@ def cross_section_h5_files_to_json_files(
287287 library : str = "" ,
288288 reaction : str = "all" ,
289289 index_filename : str = None ,
290- indent : Union [int , None ] = 2
290+ indent : Union [int , None ] = 2 ,
291+ temperature = None
291292):
292293 output_filenames = []
293294 index_dict = []
294295 Path (output_dir ).mkdir (parents = True , exist_ok = True )
295296 for filename in filenames :
296297 dict_of_reactions = cross_section_h5_to_json (
297- filename = str (filename ), library = library , reaction = reaction
298+ filename = str (filename ), library = library , reaction = reaction , temperature = temperature
298299 )
299300 # for key, value in dict_of_reactions.items():
300301 for entry in dict_of_reactions :
@@ -351,11 +352,12 @@ def cross_section_h5_file_to_json_files(
351352 library : str = "" ,
352353 index_filename : str = None ,
353354 reaction = "all" ,
354- indent : Union [int , None ] = 2
355+ indent : Union [int , None ] = 2 ,
356+ temperature = None
355357):
356358
357359 dict_of_reactions = cross_section_h5_to_json (
358- filename = filename , library = library , reaction = reaction
360+ filename = filename , library = library , reaction = reaction , temperature = temperature
359361 )
360362
361363 Path (output_dir ).mkdir (parents = True , exist_ok = True )
@@ -388,10 +390,11 @@ def cross_section_h5_file_to_json_file(
388390 output = "my_reactions.json" ,
389391 reaction = "all" ,
390392 library = "" ,
391- indent : Union [int , None ] = 2
393+ indent : Union [int , None ] = 2 ,
394+ temperature = None
392395):
393396 dict_of_reactions = cross_section_h5_to_json (
394- filename = filename , library = library , reaction = reaction
397+ filename = filename , library = library , reaction = reaction , temperature = temperature
395398 )
396399
397400 with open (output , "w" ) as fout :
@@ -426,6 +429,7 @@ def cross_section_h5_to_json(
426429 filename : str ,
427430 library = "" ,
428431 reaction = "all" ,
432+ temperature = None
429433) -> dict :
430434
431435 dict_of_reactions = [] # {}
@@ -459,8 +463,13 @@ def cross_section_h5_to_json(
459463
460464 if reaction not in [1 ] and reaction not in isotope_object .reactions :
461465 raise ValueError (reaction , " not in available reactions" )
462- temperatures = isotope_object [reaction ].xs .keys ()
463- for temperature in temperatures :
466+ avail_temperatures = isotope_object [reaction ].xs .keys ()
467+ if temperature is None :
468+ selected_temperatures = avail_temperatures
469+ else :
470+ selected_temperatures = [temperature ]
471+
472+ for temperature in selected_temperatures :
464473 energy = isotope_object .energy [temperature ]
465474 cross_section = isotope_object [reaction ].xs [temperature ](energy )
466475
0 commit comments