Skip to content

Commit f64b3cf

Browse files
authored
Apply suggestions from code review on input checking
1 parent 7e99c9f commit f64b3cf

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

openmc/deplete/microxs.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -284,17 +284,16 @@ def get_microxs_from_multigroup(
284284
multigroup_flux = np.array(multigroup_flux)
285285
multigroup_flux /= multigroup_flux.sum()
286286

287-
# check_type("temperature", temperature, (int, float))
287+
cv.check_type("temperature", temperature, (int, float))
288+
if temperature < 0.:
289+
raise ValueError(f"Temperature must be a positive number, not {temperature}")
288290
# if energy is string then use group structure of that name
289291
if isinstance(energy, str):
290292
energy = GROUP_STRUCTURES[energy]
291293
else:
292294
# if user inputs energy check they are ascending (low to high) as
293295
# some depletion codes use high energy to low energy.
294-
if not np.all(np.diff(energy) > 0):
295-
raise ValueError(
296-
"Energy group boundaries must be in ascending order"
297-
)
296+
cv.check_increasing(name="energy", value=energy)
298297

299298
# check dimension consistency
300299
if len(multigroup_flux) != len(energy) - 1:

0 commit comments

Comments
 (0)