Example #1
0
    def readWrite(self):
        """
        Read from or write to the COMPXS file.

        See Also
        --------
        armi.nuclearDataIO.isotxs._IsotxsIO.readWrite : reading/writing ISOTXS files
        """

        runLog.info(
            "{} macroscopic cross library {}".format(
                "Reading" if self._isReading else "Writing", self
            )
        )
        unlockImmutableProperties(self._lib)
        try:
            regNames = self._rw1DRecord(self._lib.regionLabels)
            self._rw2DRecord()
            for regLabel in regNames:
                region = self._getRegion(regLabel)
                regionIO = _getRegionIO()(region, self, self._lib)
                regionIO.rwRegionData()
            self._rw5DRecord()
        except:
            raise CompxsError(
                "Failed to {} {} \n\n\n{}".format(
                    "read" if self._isReading else "write", self, format_exc()
                )
            )
        finally:
            lockImmutableProperties(self._lib)
Example #2
0
 def _mergeProperties(self, other):
     properties.unlockImmutableProperties(other)
     try:
         self.neutronDoseConversionFactors = other.neutronDoseConversionFactors
         self._mergeNeutronEnergies(other)
         self.gammaEnergyUpperBounds = other.gammaEnergyUpperBounds
         self.gammaDoseConversionFactors = other.gammaDoseConversionFactors
     finally:
         properties.lockImmutableProperties(other)
Example #3
0
 def readWrite(self):
     self._rwMessage()
     properties.unlockImmutableProperties(self._lib)
     try:
         numNucs = self._rwFileID()
         self._rwGroupStructure()
         self._rwDoseConversionFactor()
         self._rwIsotopes(numNucs)
     except:
         runLog.error(traceback.format_exc())
         raise exceptions.PmatrxError("Failed to read/write {}".format(self))
     finally:
         properties.lockImmutableProperties(self._lib)
Example #4
0
    def rwNuclide(self):
        """Read nuclide name, other global stuff from the ISOTXS library."""
        properties.unlockImmutableProperties(self._nuclide)
        try:
            self._rw4DRecord()
            self._nuclide.updateBaseNuclide()
            self._rw5DRecord()
            if self._metadata["chiFlag"] > 1:
                self._rw6DRecord()

            # get scatter matrix
            for blockNumIndex in range(self._maxScatteringBlocks):
                for subBlock in range(self._subblockingControl):
                    if self._metadata["ords"][blockNumIndex] > 0:
                        # ords flag == 1 implies this scatter type of scattering exists on this nuclide.
                        self._rw7DRecord(blockNumIndex, subBlock)
        finally:
            properties.lockImmutableProperties(self._nuclide)
Example #5
0
 def readWrite(self):
     self._rwMessage()
     properties.unlockImmutableProperties(self._lib)
     try:
         self._fileID()
         numNucs = self._rw1DRecord(len(self._lib))
         nucNames = self._rw2DRecord(numNucs, self._lib.nuclideLabels)
         if self._metadata["fileWideChiFlag"] > 1:
             self._rw3DRecord()
         for nucLabel in nucNames:
             # read nuclide name, other global stuff from the ISOTXS library
             nuc = self._getNuclide(nucLabel)
             if "r" in self._fileMode:
                 # on add nuclides when reading
                 self._lib[nucLabel] = nuc
             nuclideIO = self._getNuclideIO()(nuc, self, self._lib)
             nuclideIO.rwNuclide()
     except:
         raise OSError("Failed to read/write {} \n\n\n{}".format(
             self, traceback.format_exc()))
     finally:
         properties.lockImmutableProperties(self._lib)
Example #6
0
 def _mergeProperties(self, other):
     properties.unlockImmutableProperties(other)
     try:
         self._mergeNeutronEnergies(other)
     finally:
         properties.lockImmutableProperties(other)
Example #7
0
 def initialize(self, val):
     properties.unlockImmutableProperties(self)
     try:
         self.myNum = val
     finally:
         properties.lockImmutableProperties(self)