mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Address two @smharper comments in PyAPI. Restore ONLY option on 'use hdf5'
This commit is contained in:
parent
8a4d1fba4f
commit
462926ad44
4 changed files with 12 additions and 11 deletions
|
|
@ -16,7 +16,6 @@ generates ACE-format cross sections.
|
|||
"""
|
||||
|
||||
from __future__ import division, unicode_literals
|
||||
import io
|
||||
from os import SEEK_CUR
|
||||
import struct
|
||||
import sys
|
||||
|
|
@ -164,7 +163,7 @@ class Library(object):
|
|||
|
||||
# Determine whether file is ASCII or binary
|
||||
try:
|
||||
fh = io.open(filename, 'rb')
|
||||
fh = open(filename, 'rb')
|
||||
# Grab 10 lines of the library
|
||||
sb = b''.join([fh.readline() for i in range(10)])
|
||||
|
||||
|
|
@ -173,13 +172,13 @@ class Library(object):
|
|||
|
||||
# No exception so proceed with ASCII - reopen in non-binary
|
||||
fh.close()
|
||||
fh = io.open(filename, 'r')
|
||||
fh.seek(0)
|
||||
self._read_ascii(fh, table_names, verbose)
|
||||
with open(filename, 'r') as fh:
|
||||
fh.seek(0)
|
||||
self._read_ascii(fh, table_names, verbose)
|
||||
except UnicodeDecodeError:
|
||||
fh.close()
|
||||
fh = open(filename, 'rb')
|
||||
self._read_binary(fh, table_names, verbose)
|
||||
with open(filename, 'rb') as fh:
|
||||
self._read_binary(fh, table_names, verbose)
|
||||
|
||||
def _read_binary(self, ace_file, table_names, verbose=False,
|
||||
recl_length=4096, entries=512):
|
||||
|
|
|
|||
|
|
@ -456,7 +456,7 @@ class Reaction(object):
|
|||
# YIELD AND ANGLE-ENERGY DISTRIBUTION
|
||||
|
||||
# Determine multiplicity
|
||||
ty = ace.xss[ace.jxs[5] + i_reaction - 1]
|
||||
ty = int(ace.xss[ace.jxs[5] + i_reaction - 1])
|
||||
rx.center_of_mass = (ty < 0)
|
||||
if i_reaction < ace.nxs[5] + 1:
|
||||
if ty != 19:
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ module nuclide_header
|
|||
use, intrinsic :: ISO_FORTRAN_ENV
|
||||
use, intrinsic :: ISO_C_BINDING
|
||||
|
||||
use hdf5
|
||||
use h5lt, only: h5ltpath_valid_f
|
||||
use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5iget_name_f, h5gget_info_f, &
|
||||
h5lget_name_by_idx_f, H5_INDEX_NAME_F, H5_ITER_INC_F
|
||||
use h5lt, only: h5ltpath_valid_f
|
||||
|
||||
use constants
|
||||
use dict_header, only: DictIntInt
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
module reaction_header
|
||||
|
||||
use hdf5
|
||||
use hdf5, only: HID_T, HSIZE_T, SIZE_T, h5gget_info_f, h5lget_name_by_idx_f, &
|
||||
H5_INDEX_NAME_F, H5_ITER_INC_F
|
||||
|
||||
use constants, only: MAX_WORD_LEN
|
||||
use hdf5_interface, only: read_attribute, open_group, close_group, &
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue