From 1845edb23365a49de30e2529123524bcfc70c5a5 Mon Sep 17 00:00:00 2001 From: Isaac Meyer Date: Thu, 5 Jul 2018 14:35:50 -0500 Subject: [PATCH] Fixed a lot of doc strings, jupyter example --- .../nuclear-data-resonance-covariance.ipynb | 278 ++++++++++++++++++ openmc/data/resonance_covariance.py | 218 +++++++------- 2 files changed, 383 insertions(+), 113 deletions(-) create mode 100644 examples/jupyter/nuclear-data-resonance-covariance.ipynb diff --git a/examples/jupyter/nuclear-data-resonance-covariance.ipynb b/examples/jupyter/nuclear-data-resonance-covariance.ipynb new file mode 100644 index 0000000000..d1def693c6 --- /dev/null +++ b/examples/jupyter/nuclear-data-resonance-covariance.ipynb @@ -0,0 +1,278 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "import os\n", + "from pprint import pprint\n", + "import shutil\n", + "import subprocess\n", + "import urllib.request\n", + "\n", + "import h5py\n", + "import numpy as np\n", + "import matplotlib.pyplot as plt\n", + "import matplotlib.cm\n", + "from matplotlib.patches import Rectangle\n", + "\n", + "import openmc.data" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "### ENDF: Resonance Covariance Data\n", + "\n", + "We can also load the resonance covariance data contined within File 32 of ENDF. Let's download the ENDF/B-VII.1 evaluation for $^{157}$Gd and load it in:" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Download ENDF file\n", + "url = 'https://t2.lanl.gov/nis/data/data/ENDFB-VII.1-neutron/Gd/157'\n", + "filename, headers = urllib.request.urlretrieve(url, 'gd157.endf')\n", + "\n", + "# Load into memory\n", + "gd157_endf = openmc.data.IncidentNeutron.from_endf(filename, get_covariance = True)\n", + "gd157_endf" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "We can access the parameters contained within File 32 in a similar manner to the File 2 parameters from before. " + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " energy J neutronWidth captureWidth fissionWidthA fissionWidthB L\n", + "0 0.0314 2.0 0.000474 0.1072 0.0 0.0 0\n", + "1 2.8250 2.0 0.000345 0.0970 0.0 0.0 0\n", + "2 16.2400 1.0 0.000400 0.0910 0.0 0.0 0\n", + "3 16.7700 2.0 0.012800 0.0805 0.0 0.0 0\n", + "4 20.5600 2.0 0.011360 0.0880 0.0 0.0 0\n" + ] + } + ], + "source": [ + "first_five = gd157_endf.res_covariance.ranges[0].parameters[:5]\n", + "print(first_five)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The newly created object will contain multiple resonance regions within 'gd157_endf.res_covariance.ranges'. We can access the full covariance matrix from File 32 for a given range by:" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "covariance = gd157_endf.res_covariance.ranges[0].covariance" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This covariance matrix currently only stores the upper triangular portion as covariance matrix are symmetric. Plotting the covariance matrix:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAUkAAAD8CAYAAAD6+lbaAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3X2wXHWd5/H3JzeEJ+UxghCySxyi\nu4GaVcxEVmstxwgEnTVulc6EXceU4mTXAccZZ0th3RUXlyqYcWW1RLYiZATH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5b77MeXy5o2yVve3EfhA6uU+\nD3ihUS0fdU1tq/+O7PsM2T2vknSkpEVknVb3z/T1WedmNVVaRByQdBlZAs0xYF1EbJ/NaxqQU4Fv\nppUt5wJ/ExHflrSVLIX8JcATwPtm8Rp7IulWskzR8yWNk61kdw3F97cJeCdZ58VLwAdn/IL7oMU9\nv03S68mq0j8D/iNARGyXtAF4GDgAXBoRg887Zj3zjBszszZmu7ptZjbUHCTNzNpwkDQza8NB0sys\nDQdJM7M2HCTNzNpwkDQza8NB0sysjf8PkgcWMPD86KAAAAAASUVORK5CYII=\n", + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "plt.imshow(covariance)\n", + "plt.colorbar()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Another capability of the covariance module is selecting a subset of the resonance parameters and the corresponding subset of the covariance matrix. We can do this by specifying the value we want to discriminate and the bounds within one energy region. Selecting only resonances with J=2:" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " energy J neutronWidth captureWidth fissionWidthA fissionWidthB L\n", + "0 0.0314 2.0 0.000474 0.1072 0.0 0.0 0\n", + "1 2.8250 2.0 0.000345 0.0970 0.0 0.0 0\n", + "3 16.7700 2.0 0.012800 0.0805 0.0 0.0 0\n", + "4 20.5600 2.0 0.011360 0.0880 0.0 0.0 0\n", + "5 21.6500 2.0 0.000376 0.1140 0.0 0.0 0\n" + ] + } + ], + "source": [ + "lower_bound = 2; #inclusive\n", + "upper_bound = 2; #inclusive\n", + "gd157_endf.res_covariance.ranges[0].res_subset('J',[lower_bound,upper_bound])\n", + "subset_first_five = gd157_endf.res_covariance.ranges[0].parameters_subset[:5]\n", + "print(subset_first_five)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The subset method will also store the corresponding subset of the covariance matrix" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[ 2.82609600e-06 5.89537500e-09 -4.78638600e-06 -5.73895500e-08\n", + " -1.48636900e-09]\n", + " [ 0.00000000e+00 1.36218000e-11 -9.61975600e-09 -1.15354000e-10\n", + " -2.87250000e-12]\n", + " [ 0.00000000e+00 0.00000000e+00 8.20814700e-06 9.83537100e-08\n", + " 2.58111200e-09]\n", + " [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 6.54205000e-06\n", + " -4.31977000e-10]\n", + " [ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00\n", + " 1.76975000e-10]]\n" + ] + } + ], + "source": [ + "cov_subset = gd157_endf.res_covariance.ranges[0].cov_subset\n", + "print(cov_subset[:5,:5])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The final function of the covariance module is the ability to sample a new set of parameters using the covariance matrix. Currently the sampling uses np.multivariate_normal(). Because parameters are assumed to have a multivariate normal distribution this method doesn't not currently guarantee that sampled parameters will be positive. " + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sample 1\n", + " energy J neutronWidth captureWidth fissionWidthA fissionWidthB\n", + "0 0.031860 2.0 0.000475 0.106353 0.0 0.0\n", + "1 2.823805 2.0 0.000326 0.103970 0.0 0.0\n", + "2 16.242208 1.0 0.000430 0.110773 0.0 0.0\n", + "3 16.770072 2.0 0.012445 0.083466 0.0 0.0\n", + "4 20.559242 2.0 0.011852 0.082108 0.0 0.0\n", + "Sample 2\n", + " energy J neutronWidth captureWidth fissionWidthA fissionWidthB\n", + "0 0.032548 2.0 0.000476 0.105254 0.0 0.0\n", + "1 2.829121 2.0 0.000375 0.086731 0.0 0.0\n", + "2 16.234402 1.0 0.000438 0.144065 0.0 0.0\n", + "3 16.771254 2.0 0.012171 0.088258 0.0 0.0\n", + "4 20.571634 2.0 0.011214 0.094332 0.0 0.0\n" + ] + } + ], + "source": [ + "n_samples = 5\n", + "gd157_endf.res_covariance.ranges[0].sample_resonance_parameters(n_samples)\n", + "samples = gd157_endf.res_covariance.ranges[0].samples\n", + "first_five_sample_1 = samples[0][:5]\n", + "first_five_sample_2 = samples[1][:5]\n", + "print('Sample 1')\n", + "print(first_five_sample_1)\n", + "print('Sample 2')\n", + "print(first_five_sample_2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.6.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/openmc/data/resonance_covariance.py b/openmc/data/resonance_covariance.py index a84e7aa537..e761a3756e 100644 --- a/openmc/data/resonance_covariance.py +++ b/openmc/data/resonance_covariance.py @@ -14,7 +14,7 @@ from .resonance import Resonances def file2contributions(file32params, file2params): """Function for aiding in adding resonance parameters from File 2 that are - not always present in file 32. + not always present in File 32. Uses already imported resonance data. Paramateers ----------- @@ -25,7 +25,7 @@ def file2contributions(file32params, file2params): Returns ------- - parameters: pandas.Dataframs + parameters: pandas.Dataframe Complete set of parameters ordered by L-values and then energy """ #Use l-values and competitiveWidth from File 2 data @@ -56,8 +56,6 @@ class ResonanceCovariances(Resonances): ---------- ranges : list of openmc.data.ResonanceCovarianceRange Distinct energy ranges for resonance data - resolved : openmc.data.ResonanceCovariance or None - Resolved resonance range """ def __init__(self, ranges): @@ -85,7 +83,7 @@ class ResonanceCovariances(Resonances): ---------- ev : openmc.data.endf.Evaluation ENDF evaluation - resonances : Resonance object + resonances : openmc.data.Resonance object Returns ------- @@ -133,35 +131,53 @@ class ResonanceCovariances(Resonances): class ResonanceCovarianceRange(object): - """Resonace covariance range + """Resonace covariance range. Base class for different formalisms. + Parameters + ---------- + energy_min : float + Minimum energy of the resolved resonance range in eV + energy_max : float + Maximum energy of the resolved resonance range in eV Attributes ---------- - cov_parameters: list - The parameters that are included in the covariance matrix - covariance_matrix : array + energy_min : float + Minimum energy of the resolved resonance range in eV + energy_max : float + Maximum energy of the resolved resonance range in eV + parameters: pandas.DataFrame + Resonance parameters + covariance : numpy.array The covariance matrix contained within the ENDF evaluation lcomp : int - Flag indicating the format of the covariance matrix + Flag indicating the format of the covariance matrix within the ENDF file mpar : int Number of parameters in covariance matrix for each individual resonance + formalism : str + String descriptor of formalism """ + def __init__(self, energy_min, energy_max): + self.energy_min = energy_min + self.energy_max = energy_max def res_subset(self, parameter_str, bounds): - """Produce a subset of resonance parameters and the covariance matrix - to an IncidentNeutron object. + """Produce a subset of resonance parameters and the corresponding + covariance matrix to an IncidentNeutron object. Parameters ---------- - parameter_str: parameter to be discriminated - (i.e. 'energy','captureWidth','fissionWidthA'...) - bounds: np.array [low numerical bound, high numerical bound] + parameter_str: str + parameter to be discriminated + (i.e. 'energy','captureWidth','fissionWidthA'...) + bounds: np.array + [low numerical bound, high numerical bound] Returns ------- - parameters_subset : Dataframe of a subset of parameters - (maintains indexing) - cov_subset: subset of covariance matrix (upper triangular) + parameters_subset : pandas.Dataframe + Subset of parameters (maintains indexing of original) + cov_subset: np.array + Subset of covariance matrix (upper triangular) """ parameters = self.parameters @@ -173,17 +189,17 @@ class ResonanceCovarianceRange(object): parameters_subset=parameters[mask] indices = parameters_subset.index.values sub_cov_dim = len(indices)*mpar - oldvalues = [] + cov_subset_vals = [] for index1 in indices: for i in range(mpar): for index2 in indices: for j in range(mpar): if index2*mpar+j >= index1*mpar+i: - oldvalues.append(cov[index1*mpar+i,index2*mpar+j]) + cov_subset_vals.append(cov[index1*mpar+i,index2*mpar+j]) cov_subset = np.zeros([sub_cov_dim,sub_cov_dim]) tri_indices = np.triu_indices(sub_cov_dim) - cov_subset[tri_indices] = oldvalues + cov_subset[tri_indices] = cov_subset_vals self.parameters_subset = parameters_subset self.cov_subset = cov_subset @@ -193,13 +209,15 @@ class ResonanceCovarianceRange(object): Parameters ---------- - n_samples: int + n_samples : int The number of samples to produce - use_subset: bool, optional + use_subset : bool, optional Flag on whether to sample from an already produced subset Returns ------- + samples : list of openmc.data.ResonanceCovarianceRange objects + List of samples size [n_samples] """ if use_subset==False: @@ -219,7 +237,7 @@ class ResonanceCovarianceRange(object): samples = [] - ### Handling MLBW Sampling ### + # Handling MLBW Sampling if formalism == 'mlbw' or formalism == 'slbw': if mpar == 3: param_list = ['energy','neutronWidth','captureWidth'] @@ -263,29 +281,30 @@ class ResonanceCovarianceRange(object): sample_params = pd.DataFrame.from_records(records, columns=columns) samples.append(sample_params) - ###FIXME doesn't look any different from mpar == 4 elif mpar == 5: - param_list = ['energy','neutronWidth','captureWidth','fissionWidth'] + param_list = ['energy','neutronWidth','captureWidth', + 'fissionWidth', 'competitiveWidth'] mean_array = pd.DataFrame.as_matrix(parameters[param_list]) spin = pd.DataFrame.as_matrix(parameters['J']) mean = mean_array.flatten() for i in range(n_samples): sample = np.random.multivariate_normal(mean,cov) - energy = sample[0::4] - gn = sample[1::4] - gg = sample[2::4] - gf = sample[3::4] + energy = sample[0::5] + gn = sample[1::5] + gg = sample[2::5] + gf = sample[3::5] + gx = sample[4::5] gt = gn + gg + gf records = [] for j, E in enumerate(energy): records.append([energy[j], spin[j], gt[j], gn[j], - gg[j], gf[j]]) + gg[j], gf[j], gx[j]]) columns = ['energy', 'J', 'totalWidth', 'neutronWidth', - 'captureWidth', 'fissionWidth'] + 'captureWidth', 'fissionWidth', 'competitveWidth'] sample_params = pd.DataFrame.from_records(records, columns=columns) samples.append(sample_params) - ### Handling RM Sampling ### + # Handling RM Sampling if formalism == 'rm': if mpar == 3: param_list = ['energy','neutronWidth','captureWidth'] @@ -333,29 +352,37 @@ class ResonanceCovarianceRange(object): class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): """Multi-level Breit-Wigner resolved resonance formalism covariance data. - - Multi-level Breit-Wigner resolved resonance data is identified by LRF=2 in - the ENDF-6 format. + Parameters + ---------- + energy_min : float + Minimum energy of the resolved resonance range in eV + energy_max : float + Maximum energy of the resolved resonance range in eV Attributes ---------- - cov_parameters: list - The parameters that are included in the covariance matrix - covariance_matrix : array + energy_min : float + Minimum energy of the resolved resonance range in eV + energy_max : float + Maximum energy of the resolved resonance range in eV + parameters: pandas.DataFrame + Resonance parameters + covariance : numpy.array The covariance matrix contained within the ENDF evaluation lcomp : int - Flag indicating the format of the covariance matrix + Flag indicating the format of the covariance matrix within the ENDF file mpar : int Number of parameters in covariance matrix for each individual resonance - + formalism : str + String descriptor of formalism """ def __init__(self, energy_min, energy_max): + super().__init__(energy_min, energy_max) self.parameters = None self.covariance = None self.mpar = None self.lcomp = None - self.num_parameters = None self.formalism = 'mlbw' @classmethod @@ -372,7 +399,7 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): items : list Items from the CONT record at the start of the resonance range subsection - resonances : openmc.data.IncidentNeutron.Resonance + resonances : openmc.data.IncidentNeutron.Resonance object Returns ------- @@ -406,7 +433,7 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): records = [] for i in range(num_short_range): items, values = get_list_record(file_obj) - num_parameters = items[2] + mpar = items[2] num_res = items[5] num_par_vals = num_res*6 res_values = values[:num_par_vals] @@ -424,7 +451,7 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): gg[i], gf[i]]) #Build the upper-triangular covariance matrix - cov_dim = num_parameters*num_res + cov_dim = mpar*num_res cov = np.zeros([cov_dim,cov_dim]) indices = np.triu_indices(cov_dim) cov[indices] = cov_values @@ -435,12 +462,6 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): 'captureWidth', 'fissionWidth'] parameters = pd.DataFrame.from_records(records, columns=columns) - #Determine mpar (number of parameters for each resonance in - #covariance matrix) - nparams,params = parameters.shape - covsize = cov.shape[0] - mpar = int(covsize/nparams) - #Add parameters from File 2 parameters = file2contributions(parameters, file2params) @@ -450,7 +471,6 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): mlbw.covariance = cov mlbw.mpar = mpar mlbw.lcomp = LCOMP - mlbw.num_parameters = num_parameters return mlbw @@ -498,7 +518,7 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): mpar = int(covsize/nparams) #Add parameters from File 2 - parameters = file2contributions(parameter, file2params) + parameters = file2contributions(parameters, file2params) # Create instance of MultiLevelBreitWignerCovariance mlbw = cls(energy_min, energy_max) @@ -557,7 +577,7 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): mpar = int(covsize/nparams) #Add parameters from File 2 - parameters = file2contributions(parameter, file2params) + parameters = file2contributions(parameters, file2params) # Create instance of class mlbw = cls(energy_min, energy_max) @@ -571,53 +591,36 @@ class MultiLevelBreitWignerCovariance(ResonanceCovarianceRange): class SingleLevelBreitWignerCovariance(MultiLevelBreitWignerCovariance): """Single-level Breit-Wigner resolved resonance formalism covariance data. - Single-level Breit-Wigner resolved resonance data is is identified by LRF=1 in the ENDF-6 format. Parameters ---------- - target_spin : float - Intrinsic spin, :math:`I`, of the target nuclide energy_min : float Minimum energy of the resolved resonance range in eV energy_max : float Maximum energy of the resolved resonance range in eV - channel : dict - Dictionary whose keys are l-values and values are channel radii as a - function of energy - scattering : dict - Dictionary whose keys are l-values and values are scattering radii as a - function of energy Attributes ---------- - atomic_weight_ratio : float - Atomic weight ratio of the target nuclide given as a function of - l-value. Note that this may be different than the value for the - evaluation as a whole. - channel_radius : dict - Dictionary whose keys are l-values and values are channel radii as a - function of energy - energy_max : float - Maximum energy of the resolved resonance range in eV energy_min : float Minimum energy of the resolved resonance range in eV - parameters : pandas.DataFrame - Energies, spins, and resonances widths for each resonance - q_value : dict - Q-value to be added to incident particle's center-of-mass energy to - determine the channel energy for use in the penetrability factor. The - keys of the dictionary are l-values. - scattering_radius : dict - Dictionary whose keys are l-values and values are scattering radii as a - function of energy - target_spin : float - Intrinsic spin, :math:`I`, of the target nuclide - + energy_max : float + Maximum energy of the resolved resonance range in eV + parameters: pandas.DataFrame + Resonance parameters + covariance : numpy.array + The covariance matrix contained within the ENDF evaluation + lcomp : int + Flag indicating the format of the covariance matrix within the ENDF file + mpar : int + Number of parameters in covariance matrix for each individual resonance + formalism : str + String descriptor of formalism """ def __init__(self, energy_min, energy_max): + super().__init__(energy_min,energy_max) self.formalism = 'slbw' class ReichMooreCovariance(ResonanceCovarianceRange): @@ -626,39 +629,35 @@ class ReichMooreCovariance(ResonanceCovarianceRange): Reich-Moore resolved resonance data is identified by LRF=3 in the ENDF-6 format. - Parameters ---------- - target_spin : float - Intrinsic spin, :math:`I`, of the target nuclide energy_min : float Minimum energy of the resolved resonance range in eV energy_max : float Maximum energy of the resolved resonance range in eV - channel : dict - Dictionary whose keys are l-values and values are channel radii as a - function of energy - scattering : dict - Dictionary whose keys are l-values and values are scattering radii as a - function of energy Attributes ---------- - num_parameters: list - Number of parameters used in each subsection - cov_parameters: list - The parameters that are included in the covariance matrix - covariance_matrix : array + energy_min : float + Minimum energy of the resolved resonance range in eV + energy_max : float + Maximum energy of the resolved resonance range in eV + parameters: pandas.DataFrame + Resonance parameters + covariance : numpy.array The covariance matrix contained within the ENDF evaluation - - + lcomp : int + Flag indicating the format of the covariance matrix within the ENDF file + mpar : int + Number of parameters in covariance matrix for each individual resonance + formalism : str + String descriptor of formalism """ def __init__(self, energy_min, energy_max): - self.num_parameters = None + super().__init__(energy_min, energy_max) self.parameters = None self.covariance = None - self.num_parameters = None self.formalism = 'rm' @classmethod @@ -711,7 +710,7 @@ class ReichMooreCovariance(ResonanceCovarianceRange): records = [] for i in range(num_short_range): items, values = get_list_record(file_obj) - num_parameters = items[2] + mpar = items[2] num_res = items[5] num_par_vals = num_res*6 res_values = values[:num_par_vals] @@ -729,7 +728,7 @@ class ReichMooreCovariance(ResonanceCovarianceRange): gfa[i], gfb[i]]) #Build the upper-triangular covariance matrix - cov_dim = num_parameters*num_res + cov_dim = mpar*num_res cov = np.zeros([cov_dim,cov_dim]) indices = np.triu_indices(cov_dim) cov[indices] = cov_values @@ -739,14 +738,8 @@ class ReichMooreCovariance(ResonanceCovarianceRange): 'fissionWidthA', 'fissionWidthB'] parameters = pd.DataFrame.from_records(records, columns=columns) - #Determine mpar (number of parameters for each resonance in - #covariance matrix) - nparams,params = parameters.shape - covsize = cov.shape[0] - mpar = int(covsize/nparams) - #Add parameters from File 2 - parameters = file2contributions(parameter, file2params) + parameters = file2contributions(parameters, file2params) # Create instance of ReichMooreCovariance rmc = cls(energy_min, energy_max) @@ -754,7 +747,6 @@ class ReichMooreCovariance(ResonanceCovarianceRange): rmc.covariance = cov rmc.mpar = mpar rmc.lcomp = LCOMP - rmc.num_parameters = num_parameters return rmc @@ -795,7 +787,7 @@ class ReichMooreCovariance(ResonanceCovarianceRange): mpar = int(covsize/nparams) #Add parameters from File 2 - parameters = file2contributions(parameter, file2params) + parameters = file2contributions(parameters, file2params) # Create instance of ReichMooreCovariance rmc = cls(energy_min, energy_max)