Repository: CORE-GATECH-GROUP/serpent-tools

Issue:
[BUG] ResultsReader fails when only group constants are requested
## Summary of issue
When restricting the scope of the variables extracted from the results file to only group constants, the reader fails. 

It is also worth noting that, when non-group constant data are requested as well, 'ABS_KEFF' and 'INF_FLX', for example, the reader will not fail, but the universes produced will not have group constant data

## Code for reproducing the issue
```
import serpentTools
serpentTools.settings.rc['xs.variableExtras'] = ['INF_FLX', ] 
serpentTools.readDataFile('pwr_res.m')
```
Alternative case
```
import serpentTools
serpentTools.settings.rc['xs.variableExtras'] = ['INF_FLX', 'ABS_KEFF'] 
r = serpentTools.readDataFile('pwr_res.m')
u = r.getUniv('0', index=1)
u.infExp
# returns {}
```
## Actual outcome including console output and error traceback if applicable
```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/data/__init__.py", line 70, in readDataFile
    return read(filePath, **kwargs)
  File "/home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/parsers/__init__.py", line 149, in read
    returnedFromLoader.read()
  File "/home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/parsers/base.py", line 49, in read
    self._postcheck()
  File "/home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/parsers/results.py", line 345, in _postcheck
    self._inspectData()
  File "/home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/parsers/results.py", line 342, in _inspectData
    .format(self.filePath))
serpentTools.messages.SerpentToolsException: metadata, resdata and universes are all empty from /home/ajohnson400/.local/lib/python3.6/site-packages/serpentTools-0.5.4-py3.6.egg/serpentTools/data/pwr_res.m and <results.expectGcu> is True
```
## Expected outcome
The parser should respect the settings passed, and properly store all the requested data on the homogenized universes
## Versions

* Version  from ``serpentTools.__version__`` `0.5.4`

* Python version - ``python --version`` `3.6`

Discussion:

Patch:
diff --git a/serpentTools/parsers/results.py b/serpentTools/parsers/results.py
index d46a7fd..095cb6c 100644
--- a/serpentTools/parsers/results.py
+++ b/serpentTools/parsers/results.py
@@ -183,9 +183,10 @@ class ResultsReader(XSReader):
         """Process universes' data"""
         brState = self._getBUstate()  # obtain the branching tuple
         values = str2vec(varVals)  # convert the string to float numbers
-        if not self.universes or brState not in self.universes.keys():
+        if brState not in self.universes:
             self.universes[brState] = \
                 HomogUniv(brState[0], brState[1], brState[2], brState[3])
+        if varNameSer == self._keysVersion['univ']:
             return
         if varNameSer not in self._keysVersion['varsUnc']:
             vals, uncs = splitValsUncs(values)


Test patch:
diff --git a/serpentTools/tests/test_ResultsReader.py b/serpentTools/tests/test_ResultsReader.py
index 03e9d28..1384c4d 100644
--- a/serpentTools/tests/test_ResultsReader.py
+++ b/serpentTools/tests/test_ResultsReader.py
@@ -8,7 +8,7 @@ from numpy.testing import assert_equal
 from six import iteritems
 
 from serpentTools.settings import rc
-from serpentTools.data import getFile
+from serpentTools.data import getFile, readDataFile
 from serpentTools.parsers import ResultsReader
 from serpentTools.messages import SerpentToolsException
 
@@ -597,6 +597,40 @@ class TestResultsNoBurnNoGcu(TestFilterResultsNoBurnup):
             self.reader.read()
 
 
+class RestrictedResultsReader(unittest.TestCase):
+    """Class that restricts the variables read from the results file"""
+
+    expectedInfFlux_bu0 = TestReadAllResults.expectedInfVals
+    expectedAbsKeff = TestReadAllResults.expectedKeff
+    dataFile = "pwr_res.m"
+
+    def _testUnivFlux(self, reader):
+        univ = reader.getUniv('0', index=1)
+        assert_equal(self.expectedInfFlux_bu0, univ.get("infFlx"))
+
+    def test_justFlux(self):
+        """Restrict the variables to gcu inf flux and verify their values"""
+        with rc:
+            rc['xs.variableExtras'] = ["INF_FLX", ]
+            r = readDataFile(self.dataFile)
+        self._testUnivFlux(r)
+
+    def test_xsGroups(self):
+        """Restrict the variables groups to gc-meta to obtain flux and test."""
+        with rc:
+            rc['xs.variableGroups'] = ['gc-meta', ]
+            r = readDataFile(self.dataFile)
+        self._testUnivFlux(r)
+
+    def test_fluxAndKeff(self):
+        """Restrict to two unique parameters and verify their contents."""
+        with rc:
+            rc['xs.variableExtras'] = ['ABS_KEFF', 'INF_FLX']
+            r = readDataFile(self.dataFile)
+        self._testUnivFlux(r)
+        assert_equal(self.expectedAbsKeff, r.resdata['absKeff'])
+
+
 del TesterCommonResultsReader
 
 if __name__ == '__main__':