@@ -91,7 +91,7 @@ def expand_materials_to_elements(materials: openmc.Materials):
9191
9292
9393def download_cross_section_data (
94- self ,
94+ materials : openmc . Materials ,
9595 libraries : typing .Iterable [str ] = (
9696 "TENDL-2019" ,
9797 "ENDFB-7.1-NNDC" ,
@@ -103,7 +103,23 @@ def download_cross_section_data(
103103 set_OPENMC_CROSS_SECTIONS : bool = True ,
104104 overwrite : bool = False ,
105105) -> str :
106- """ """
106+ """Download cross section data for materials
107+
108+ Args:
109+ materials: Materials for which to download cross section data
110+ libraries: list of libraries from which to download cross section data.
111+ destination: Specifies a folder location to save the downloaded files. By
112+ default, the files are saved in the current working directory.
113+ particles: list of particles for which to download cross section data ("neutron", "photon")
114+ set_OPENMC_CROSS_SECTIONS: Set the OPENMC_CROSS_SECTIONS environment variable
115+ overwrite: if set to True will overwrite any existing files
116+
117+ Raises:
118+ ValueError: If the particle is not one of the following: "neutron", "photon"
119+
120+ Returns:
121+ Path to the cross sections xml file
122+ """
107123
108124 for entry in particles :
109125 if entry not in PARTICLE_OPTIONS :
@@ -114,7 +130,7 @@ def download_cross_section_data(
114130 dataframe = pd .DataFrame ()
115131
116132 if "neutron" in particles :
117- isotopes = expand_materials_to_isotopes (self )
133+ isotopes = expand_materials_to_isotopes (materials )
118134 # filters the large dataframe of all isotopes into just the ones you want
119135 dataframe_isotopes_xs = identify_isotopes_to_download (
120136 libraries = libraries ,
@@ -123,14 +139,14 @@ def download_cross_section_data(
123139 dataframe = pd .concat ([dataframe , dataframe_isotopes_xs ])
124140
125141 if "photon" in particles :
126- elements = expand_materials_to_elements (self )
142+ elements = expand_materials_to_elements (materials )
127143 dataframe_elements_xs = identify_elements_to_download (
128144 libraries = libraries ,
129145 elements = elements ,
130146 )
131147 dataframe = pd .concat ([dataframe , dataframe_elements_xs ])
132148
133- sabs = expand_materials_to_sabs (self )
149+ sabs = expand_materials_to_sabs (materials )
134150 if len (sabs ) > 0 :
135151 dataframe_sabs_xs = identify_sabs_to_download (
136152 libraries = libraries ,
@@ -148,7 +164,7 @@ def download_cross_section_data(
148164 cross_section_xml_path = create_cross_sections_xml (dataframe , destination )
149165
150166 if set_OPENMC_CROSS_SECTIONS is True :
151- self .cross_sections = cross_section_xml_path
167+ materials .cross_sections = cross_section_xml_path
152168 # making the cross section xml requires openmc and returns None if
153169 # openmc is not found.
154170 if cross_section_xml_path is not None :
0 commit comments