def update_qobj_config( qobj: Qobj, backend_options: Optional[Dict] = None, noise_model: Any = None ) -> Qobj: """Update a Qobj configuration from options and noise model. Args: qobj (Qobj): description of job backend_options (dict): backend options noise_model (NoiseModel): noise model Returns: Qobj: qobj. """ config = qobj.config.to_dict() # Append backend options to configuration. if backend_options: for key, val in backend_options.items(): config[key] = val # Append noise model to configuration. Overwrites backend option if noise_model: config['noise_model'] = noise_model # Look for noise_models in the config, and try to transform them config = _serialize_noise_model(config) # Update the Qobj configuration. qobj.config = QobjHeader.from_dict(config) return qobj
def update_qobj_config(qobj: Qobj, backend_options: Optional[Dict] = None, noise_model: Any = None) -> Qobj: """Update a ``Qobj`` configuration from backend options and a noise model. Args: qobj: Description of the job. backend_options: Backend options. noise_model: Noise model. Returns: The updated ``Qobj``. """ config = qobj.config.to_dict() # Append backend options to configuration. if backend_options: for key, val in backend_options.items(): config[key] = val # Append noise model to configuration. Overwrites backend option if noise_model: config['noise_model'] = noise_model # Look for noise_models in the config, and try to transform them config = _serialize_noise_model(config) # Update the Qobj configuration. qobj.config = QobjHeader.from_dict(config) return qobj