def __init__(self, **keywordArgs): # Attributes self.indexValue = keywordArgs.get("indexValue") self.costEstimator = instantiateObject( keywordArgs.get("costEstimator"), **keywordArgs.get("costEstimatorInputDictionary")) # TODO 'qoiEstimator' should be renamed self.qoiEstimator = [] # qoi estimators qoi_estimator_module = keywordArgs.get("qoiEstimator") qoi_estimator_module_args = keywordArgs.get( "qoiEstimatorInputDictionary") for i, d in enumerate(qoi_estimator_module_args): self.qoiEstimator.append( instantiateObject(qoi_estimator_module[i], **d)) sampler_input_dict = keywordArgs.get("samplerInputDictionary") sampler_input_dict["solverWrapperIndices"] = self.solverIndices() self.sampler = instantiateObject(keywordArgs.get("sampler"), **sampler_input_dict) # TODO remove. Samples must be stored in self.data. self.samples = keywordArgs.get("samples", None) self.areSamplesStored = keywordArgs.get("areSamplesStored", False) self.areSamplesRecycled = keywordArgs.get("areSamplesRecycled", True) self.eventGroupSize = keywordArgs.get("eventGroupSize", None)
def __init__(self, **keywordArgs): # Attributes self.indexValue = keywordArgs.get('indexValue') self.costEstimator = instantiateObject( keywordArgs.get('costEstimator'), **keywordArgs.get('costEstimatorInputDict')) # TODO 'qoiEstimator' should be replaced with 'qoiEstimators'. # It should also become a list of lists also but this will break # things elsewhere in the code and should be done separately later self.qoiEstimator = [] # qoi estimators qoi_estimator_module = keywordArgs.get('qoiEstimator') qoi_estimator_module_args = keywordArgs.get('qoiEstimatorInputDict') for i in range(len(qoi_estimator_module)): self.qoiEstimator.append( instantiateObject(qoi_estimator_module[i], **qoi_estimator_module_args[i])) # combined estimators combined_estimator_module = keywordArgs.get('combinedEstimator') combined_estimator_module_args = keywordArgs.get( 'combinedEstimatorInputDict') for i in range(len(combined_estimator_module)): self.qoiEstimator.append( instantiateObject(combined_estimator_module[i], **combined_estimator_module_args[i])) sampler_input_dict = keywordArgs.get('samplerInputDict') sampler_input_dict['solverWrapperIndices'] = self.solverIndices() self.sampler = instantiateObject(keywordArgs.get('sampler'), **sampler_input_dict) self.samples = keywordArgs.get('samples', None) self.areSamplesStored = keywordArgs.get('areSamplesStored', False) self.areSamplesRecycled = keywordArgs.get('areSamplesRecycled', True) self.estimatorBatchSize = keywordArgs.get('estimatorBatchSize', 1)
def __init__(self, **keywordArgs): # Attributes self.indexValue = keywordArgs.get('indexValue') self.costEstimator = instantiateObject( keywordArgs.get('costEstimator'), **keywordArgs.get('costEstimatorInputDictionary')) # TODO 'qoiEstimator' should be renamed self.qoiEstimator = [] # qoi estimators qoi_estimator_module = keywordArgs.get('qoiEstimator') qoi_estimator_module_args = keywordArgs.get( 'qoiEstimatorInputDictionary') for i in range(len(qoi_estimator_module)): self.qoiEstimator.append( instantiateObject(qoi_estimator_module[i], **qoi_estimator_module_args[i])) # combined estimators # TODO to be removed (see issue #23) combined_estimator_module = keywordArgs.get('combinedEstimator', None) combined_estimator_module_args = keywordArgs.get( 'combinedEstimatorInputDictionary') if combined_estimator_module is not None: warnings.warn(( 'combinedEstimator and combinedEstimatorInputDictionary are ' 'deprecated. Use qoiEstimator and qoiEstimatorInputDictionary ' 'instead. Retro-compatibility is ensured only until 2020-08.'), FutureWarning) for i in range(len(combined_estimator_module)): self.qoiEstimator.append( instantiateObject(combined_estimator_module[i], **combined_estimator_module_args[i])) sampler_input_dict = keywordArgs.get('samplerInputDictionary') sampler_input_dict['solverWrapperIndices'] = self.solverIndices() self.sampler = instantiateObject(keywordArgs.get('sampler'), **sampler_input_dict) # TODO remove. Samples must be stored in self.data. self.samples = keywordArgs.get('samples', None) self.areSamplesStored = keywordArgs.get('areSamplesStored', False) self.areSamplesRecycled = keywordArgs.get('areSamplesRecycled', True) self.eventGroupSize = keywordArgs.get('eventGroupSize', None) # TODO To be removed after scripts have been updated. # Deprecated, left for compatibility. deprecatedGroupSize = keywordArgs.get('estimatorBatchSize', None) if self.eventGroupSize is None and deprecatedGroupSize is not None: self.eventGroupSize = deprecatedGroupSize warnings.warn(( 'estimatorBatchSize is deprecated. Use eventGroupSize instead.' 'Retro-compatibility is ensured only until 2020-08.'), FutureWarning)
def __init__(self, **keywordArgs): # Attributes self.randomGenerator = instantiateObject( keywordArgs.get('randomGenerator'), **keywordArgs.get('randomGeneratorInputDict')) self.qoiProcessor = dynamicImport( keywordArgs.get('qoiProcessor', 'xmc.tools.returnInput')) solver_wrapper_indices = keywordArgs.get('solverWrapperIndices') self.solvers = [] for sw_index in solver_wrapper_indices: keywordArgs['solverWrapperInputDict']['index'] = sw_index self.solvers.append( instantiateObject(keywordArgs.get('solverWrapper'), **keywordArgs.get('solverWrapperInputDict')))
def __init__(self, **keywordArgs): # Attributes self.randomGenerator = instantiateObject( keywordArgs.get("randomGenerator"), **keywordArgs.get("randomGeneratorInputDictionary"), ) self.qoiProcessor = dynamicImport( keywordArgs.get("qoiProcessor", "xmc.tools.returnInput")) solver_wrapper_indices = keywordArgs.get("solverWrapperIndices") self.solvers = [] for sw_index in solver_wrapper_indices: keywordArgs["solverWrapperInputDictionary"]["index"] = sw_index self.solvers.append( instantiateObject( keywordArgs.get("solverWrapper"), **keywordArgs.get("solverWrapperInputDictionary"), ))
def __init__(self, **keywordArgs): # Attributes self.indexValue = keywordArgs.get("indexValue") self.costEstimator = instantiateObject( keywordArgs.get("costEstimator"), **keywordArgs.get("costEstimatorInputDictionary")) # TODO 'qoiEstimator' should be renamed self.qoiEstimator = [] # qoi estimators qoi_estimator_module = keywordArgs.get("qoiEstimator") qoi_estimator_module_args = keywordArgs.get( "qoiEstimatorInputDictionary") for i in range(len(qoi_estimator_module)): self.qoiEstimator.append( instantiateObject(qoi_estimator_module[i], **qoi_estimator_module_args[i])) # combined estimators # TODO to be removed (see issue #23) combined_estimator_module = keywordArgs.get("combinedEstimator", None) combined_estimator_module_args = keywordArgs.get( "combinedEstimatorInputDictionary") if combined_estimator_module is not None: warnings.warn( ("combinedEstimator and combinedEstimatorInputDictionary are " "deprecated. Use qoiEstimator and qoiEstimatorInputDictionary " "instead. Retro-compatibility is ensured only until 2021-06." ), FutureWarning, ) for i in range(len(combined_estimator_module)): self.qoiEstimator.append( instantiateObject(combined_estimator_module[i], **combined_estimator_module_args[i])) sampler_input_dict = keywordArgs.get("samplerInputDictionary") sampler_input_dict["solverWrapperIndices"] = self.solverIndices() self.sampler = instantiateObject(keywordArgs.get("sampler"), **sampler_input_dict) # TODO remove. Samples must be stored in self.data. self.samples = keywordArgs.get("samples", None) self.areSamplesStored = keywordArgs.get("areSamplesStored", False) self.areSamplesRecycled = keywordArgs.get("areSamplesRecycled", True) self.eventGroupSize = keywordArgs.get("eventGroupSize", None)