-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] fixed dep matrix reader for serpent V 2.2.1 #512
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ class DepmtxReader(BaseReader, SparseReaderMixin): | |
---------- | ||
deltaT: float | ||
Length of depletion interval | ||
flx: float | ||
Homogenized flux | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a comment about this not existing for versions of Serpent less than 2.2.1 |
||
n0: :class:`numpy.ndarray` | ||
Vector of original isotopics | ||
zai: :class:`numpy.ndarray` | ||
|
@@ -60,6 +62,7 @@ def __init__(self, filePath, sparse=None): | |
BaseReader.__init__(self, filePath, 'depmtx') | ||
SparseReaderMixin.__init__(self, sparse) | ||
self.deltaT = None | ||
self.flx = None | ||
self.n0 = None | ||
self.n1 = None | ||
self.zai = None | ||
|
@@ -92,9 +95,16 @@ def _read(self): | |
with open(self.filePath) as stream: | ||
line = stream.readline() | ||
self.deltaT = float(line.split()[-1][:-1]) | ||
line = stream.readline() | ||
|
||
if "flx" in line: | ||
self.flx = float(line.split()[-1][:-1]) | ||
line = stream.readline() | ||
|
||
if "zeros" in line: | ||
line = stream.readline() | ||
Comment on lines
+104
to
+105
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the zero line added? If that's also new that's one thing but I'm pretty sure this line existed in earlier versions of Serpent. Related to the removal of the zero line down below? |
||
|
||
# process initial isotopics | ||
line = stream.readline() | ||
match = self._getMatch(line, NDENS_REGEX, 'n0 vector') | ||
line = _parseIsoBlock(stream, tempN0, match, line, NDENS_REGEX) | ||
numIso = len(tempN0) | ||
|
@@ -104,7 +114,9 @@ def _read(self): | |
|
||
self.n1 = empty_like(self.n0) | ||
self.zai = empty_like(self.n0, dtype=int) | ||
|
||
|
||
if "zeros" in line: | ||
line = stream.readline() | ||
Comment on lines
-107
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment on why removing the zeros line read |
||
match = self._getMatch(line, ZAI_REGEX, 'zai vector') | ||
line = _parseIsoBlock(stream, self.zai, match, line, ZAI_REGEX) | ||
|
||
|
@@ -115,7 +127,10 @@ def _read(self): | |
line = self.__processSparseMatrix(stream, matrixSize) | ||
else: | ||
line = self.__processDenseMatrix(stream, matrixSize) | ||
|
||
|
||
if "zeros" in line: | ||
line = stream.readline() | ||
|
||
Comment on lines
-118
to
+133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment on the removal of the zeros line read |
||
match = self._getMatch(line, NDENS_REGEX, 'n1 vector') | ||
_parseIsoBlock(stream, self.n1, match, line, NDENS_REGEX) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer to have the full variable name just to be more explicit. And it should be typed as optional float, right? Since for older versions of serpent that don't output this data, users should expect it to not always be a float.