quantum-debugger 0.2.2__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. {quantum_debugger-0.2.2/quantum_debugger.egg-info → quantum_debugger-0.3.0}/PKG-INFO +56 -25
  2. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/README.md +52 -21
  3. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/core/circuit.py +121 -3
  4. quantum_debugger-0.3.0/quantum_debugger/noise/__init__.py +47 -0
  5. quantum_debugger-0.3.0/quantum_debugger/noise/composite_noise.py +54 -0
  6. quantum_debugger-0.3.0/quantum_debugger/noise/hardware_profiles.py +249 -0
  7. quantum_debugger-0.3.0/quantum_debugger/noise/noise_helpers.py +95 -0
  8. quantum_debugger-0.3.0/quantum_debugger/noise/noise_models.py +312 -0
  9. quantum_debugger-0.3.0/quantum_debugger/noise/stochastic_sampler.py +167 -0
  10. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0/quantum_debugger.egg-info}/PKG-INFO +56 -25
  11. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger.egg-info/SOURCES.txt +6 -0
  12. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/setup.py +6 -6
  13. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/CHANGELOG.md +0 -0
  14. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/LICENSE +0 -0
  15. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/MANIFEST.in +0 -0
  16. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/examples/bell_state_debug.py +0 -0
  17. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/examples/grover_profiling.py +0 -0
  18. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/examples/interactive_demo.py +0 -0
  19. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/examples/qiskit_integration_demo.py +0 -0
  20. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/__init__.py +0 -0
  21. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/core/__init__.py +0 -0
  22. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/core/gates.py +0 -0
  23. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/core/quantum_state.py +0 -0
  24. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/debugger/__init__.py +0 -0
  25. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/debugger/breakpoints.py +0 -0
  26. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/debugger/debugger.py +0 -0
  27. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/debugger/inspector.py +0 -0
  28. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/integrations/__init__.py +0 -0
  29. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/integrations/qiskit_adapter.py +0 -0
  30. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/profiler/__init__.py +0 -0
  31. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/profiler/metrics.py +0 -0
  32. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/profiler/profiler.py +0 -0
  33. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/visualization/__init__.py +0 -0
  34. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/visualization/bloch_sphere.py +0 -0
  35. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger/visualization/state_viz.py +0 -0
  36. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger.egg-info/dependency_links.txt +0 -0
  37. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger.egg-info/requires.txt +0 -0
  38. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/quantum_debugger.egg-info/top_level.txt +0 -0
  39. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/requirements.txt +0 -0
  40. {quantum_debugger-0.2.2 → quantum_debugger-0.3.0}/setup.cfg +0 -0
@@ -1,14 +1,14 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: quantum-debugger
3
- Version: 0.2.2
4
- Summary: Interactive debugger and profiler for quantum circuits
5
- Home-page: https://github.com/yourusername/quantum-debugger
3
+ Version: 0.3.0
4
+ Summary: Interactive debugger and profiler for quantum circuits with realistic noise simulation
5
+ Home-page: https://github.com/Raunakg2005/quantum-debugger
6
6
  Author: warlord9004
7
7
  Author-email: your.email@example.com
8
8
  Project-URL: Bug Reports, https://github.com/Raunakg2005/quantum-debugger/issues
9
9
  Project-URL: Source, https://github.com/Raunakg2005/quantum-debugger
10
10
  Project-URL: Documentation, https://quantum-debugger.readthedocs.io/
11
- Keywords: quantum computing debugging profiling quantum-circuit visualization
11
+ Keywords: quantum computing debugging profiling quantum-circuit visualization noise-simulation
12
12
  Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Intended Audience :: Science/Research
14
14
  Classifier: Intended Audience :: Developers
@@ -61,18 +61,42 @@ Dynamic: summary
61
61
  [![Documentation](https://img.shields.io/badge/docs-readthedocs-blue)](https://quantum-debugger.readthedocs.io/)
62
62
 
63
63
 
64
- A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
64
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **realistic noise simulation** and **production-grade Qiskit integration**!
65
65
 
66
- ## Features
66
+ ## Features
67
67
 
68
- - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
69
- - 🔍 **State Inspection** - Analyze quantum states at any point
70
- - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
71
- - 🎨 **Visualization** - State vectors, Bloch spheres, and more
72
- - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
73
- - **100% Tested** - 88 comprehensive tests, production-ready
68
+ - Step-through Debugging - Execute circuits gate-by-gate with breakpoints
69
+ - State Inspection - Analyze quantum states at any point
70
+ - Circuit Profiling - Depth analysis, gate statistics, optimization suggestions
71
+ - Visualization - State vectors, Bloch spheres, and more
72
+ - **Noise Simulation** - Realistic hardware noise models (NEW in v0.3.0!)
73
+ - Qiskit Integration - Import/export circuits from Qiskit
74
+ - 100% Tested - 177 comprehensive tests, production-ready
74
75
 
75
- ## 🚀 Quick Start
76
+ ##What's New in v0.3.0
77
+
78
+ **Realistic Quantum Noise Simulation**
79
+
80
+ ```python
81
+ from quantum_debugger import QuantumCircuit
82
+ from quantum_debugger.noise import IBM_PERTH_2025
83
+
84
+ # Simulate on IBM hardware
85
+ qc = QuantumCircuit(2, noise_model=IBM_PERTH_2025.noise_model)
86
+ qc.h(0).cnot(0, 1)
87
+ results = qc.run(shots=1000)
88
+ print(f"Fidelity: {results['fidelity']:.4f}") # ~0.995
89
+ ```
90
+
91
+ **Features:**
92
+ - 4 noise models (Depolarizing, Amplitude/Phase Damping, Thermal Relaxation)
93
+ - 4 hardware profiles (IBM, Google, IonQ, Rigetti with 2025 specs)
94
+ - Automatic fidelity tracking
95
+ - Validated against Qiskit Aer
96
+
97
+ See [NOISE_TUTORIAL.md](NOISE_TUTORIAL.md) and [DOCUMENTATION.md](DOCUMENTATION.md).
98
+
99
+ ## Quick Start
76
100
 
77
101
  ### Installation
78
102
 
@@ -183,12 +207,12 @@ for suggestion in profiler.get_optimization_suggestions():
183
207
  print(f" • {suggestion}")
184
208
  ```
185
209
 
186
- ## 📊 Testing & Quality
210
+ ## Testing & Quality
187
211
 
188
- - **88/88 tests passing** (100%)
212
+ - **177/177 tests passing** (100%)
189
213
  - Validated up to **12 qubits** (4,096-D state space)
190
214
  - **100+ gate circuits** tested
191
- - Perfect Qiskit integration fidelity
215
+ - Qiskit Aer validation complete
192
216
  - Numerical precision < 1e-10
193
217
 
194
218
  See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
@@ -216,17 +240,23 @@ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
216
240
 
217
241
  MIT License - see [LICENSE](LICENSE) file.
218
242
 
219
- ## 🌟 What's New in v0.2.0
243
+ ## What's New
244
+
245
+ **v0.3.0** (December 2024)
246
+ - Realistic noise simulation (4 models)
247
+ - Hardware profiles (IBM, Google, IonQ, Rigetti)
248
+ - Qiskit Aer validation
249
+ - 89 new tests
220
250
 
221
- - ✨ **Qiskit Integration** - Bidirectional circuit conversion
222
- - **CP Gate** - Controlled-phase gate support
223
- - **19 New Tests** - Qiskit integration fully validated
224
- - **12-Qubit Support** - Tested on extreme-scale circuits
225
- - 🐛 **Bug Fixes** - Improved debugger API compatibility
251
+ **v0.2.0**
252
+ - Qiskit Integration - Bidirectional circuit conversion
253
+ - CP Gate - Controlled-phase gate support
254
+ - 19 New Tests - Qiskit integration fully validated
255
+ - 12-Qubit Support - Tested on extreme-scale circuits
226
256
 
227
- ## 🚀 Roadmap
257
+ ## Roadmap
228
258
 
229
- - [ ] Noise simulation
259
+ - [x] Noise simulation (v0.3.0)
230
260
  - [ ] Web-based debugger UI
231
261
  - [ ] Cirq integration
232
262
  - [ ] Hardware backend support
@@ -235,5 +265,6 @@ MIT License - see [LICENSE](LICENSE) file.
235
265
  ---
236
266
 
237
267
  **PyPI**: https://pypi.org/project/quantum-debugger/
268
+ **Documentation**: [DOCUMENTATION.md](DOCUMENTATION.md)
238
269
  **Author**: warlord9004
239
- **Version**: 0.2.0
270
+ **Version**: 0.3.0
@@ -9,18 +9,42 @@
9
9
  [![Documentation](https://img.shields.io/badge/docs-readthedocs-blue)](https://quantum-debugger.readthedocs.io/)
10
10
 
11
11
 
12
- A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **production-grade Qiskit integration**!
12
+ A powerful Python library for step-through debugging, state inspection, and performance analysis of quantum circuits. Now with **realistic noise simulation** and **production-grade Qiskit integration**!
13
13
 
14
- ## Features
14
+ ## Features
15
15
 
16
- - 🐛 **Step-through Debugging** - Execute circuits gate-by-gate with breakpoints
17
- - 🔍 **State Inspection** - Analyze quantum states at any point
18
- - 📊 **Circuit Profiling** - Depth analysis, gate statistics, optimization suggestions
19
- - 🎨 **Visualization** - State vectors, Bloch spheres, and more
20
- - 🔗 **Qiskit Integration** - Import/export circuits from Qiskit (NEW in v0.2.0!)
21
- - **100% Tested** - 88 comprehensive tests, production-ready
16
+ - Step-through Debugging - Execute circuits gate-by-gate with breakpoints
17
+ - State Inspection - Analyze quantum states at any point
18
+ - Circuit Profiling - Depth analysis, gate statistics, optimization suggestions
19
+ - Visualization - State vectors, Bloch spheres, and more
20
+ - **Noise Simulation** - Realistic hardware noise models (NEW in v0.3.0!)
21
+ - Qiskit Integration - Import/export circuits from Qiskit
22
+ - 100% Tested - 177 comprehensive tests, production-ready
22
23
 
23
- ## 🚀 Quick Start
24
+ ##What's New in v0.3.0
25
+
26
+ **Realistic Quantum Noise Simulation**
27
+
28
+ ```python
29
+ from quantum_debugger import QuantumCircuit
30
+ from quantum_debugger.noise import IBM_PERTH_2025
31
+
32
+ # Simulate on IBM hardware
33
+ qc = QuantumCircuit(2, noise_model=IBM_PERTH_2025.noise_model)
34
+ qc.h(0).cnot(0, 1)
35
+ results = qc.run(shots=1000)
36
+ print(f"Fidelity: {results['fidelity']:.4f}") # ~0.995
37
+ ```
38
+
39
+ **Features:**
40
+ - 4 noise models (Depolarizing, Amplitude/Phase Damping, Thermal Relaxation)
41
+ - 4 hardware profiles (IBM, Google, IonQ, Rigetti with 2025 specs)
42
+ - Automatic fidelity tracking
43
+ - Validated against Qiskit Aer
44
+
45
+ See [NOISE_TUTORIAL.md](NOISE_TUTORIAL.md) and [DOCUMENTATION.md](DOCUMENTATION.md).
46
+
47
+ ## Quick Start
24
48
 
25
49
  ### Installation
26
50
 
@@ -131,12 +155,12 @@ for suggestion in profiler.get_optimization_suggestions():
131
155
  print(f" • {suggestion}")
132
156
  ```
133
157
 
134
- ## 📊 Testing & Quality
158
+ ## Testing & Quality
135
159
 
136
- - **88/88 tests passing** (100%)
160
+ - **177/177 tests passing** (100%)
137
161
  - Validated up to **12 qubits** (4,096-D state space)
138
162
  - **100+ gate circuits** tested
139
- - Perfect Qiskit integration fidelity
163
+ - Qiskit Aer validation complete
140
164
  - Numerical precision < 1e-10
141
165
 
142
166
  See [TEST_SUMMARY.md](TEST_SUMMARY.md) for details.
@@ -164,17 +188,23 @@ Contributions welcome! See [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).
164
188
 
165
189
  MIT License - see [LICENSE](LICENSE) file.
166
190
 
167
- ## 🌟 What's New in v0.2.0
191
+ ## What's New
192
+
193
+ **v0.3.0** (December 2024)
194
+ - Realistic noise simulation (4 models)
195
+ - Hardware profiles (IBM, Google, IonQ, Rigetti)
196
+ - Qiskit Aer validation
197
+ - 89 new tests
168
198
 
169
- - ✨ **Qiskit Integration** - Bidirectional circuit conversion
170
- - **CP Gate** - Controlled-phase gate support
171
- - **19 New Tests** - Qiskit integration fully validated
172
- - **12-Qubit Support** - Tested on extreme-scale circuits
173
- - 🐛 **Bug Fixes** - Improved debugger API compatibility
199
+ **v0.2.0**
200
+ - Qiskit Integration - Bidirectional circuit conversion
201
+ - CP Gate - Controlled-phase gate support
202
+ - 19 New Tests - Qiskit integration fully validated
203
+ - 12-Qubit Support - Tested on extreme-scale circuits
174
204
 
175
- ## 🚀 Roadmap
205
+ ## Roadmap
176
206
 
177
- - [ ] Noise simulation
207
+ - [x] Noise simulation (v0.3.0)
178
208
  - [ ] Web-based debugger UI
179
209
  - [ ] Cirq integration
180
210
  - [ ] Hardware backend support
@@ -183,5 +213,6 @@ MIT License - see [LICENSE](LICENSE) file.
183
213
  ---
184
214
 
185
215
  **PyPI**: https://pypi.org/project/quantum-debugger/
216
+ **Documentation**: [DOCUMENTATION.md](DOCUMENTATION.md)
186
217
  **Author**: warlord9004
187
- **Version**: 0.2.0
218
+ **Version**: 0.3.0
@@ -3,7 +3,8 @@ Quantum circuit representation and execution
3
3
  """
4
4
 
5
5
  import numpy as np
6
- from typing import List, Optional, Union
6
+ import warnings
7
+ from typing import List, Optional, Union, Any
7
8
  from quantum_debugger.core.quantum_state import QuantumState
8
9
  from quantum_debugger.core.gates import GateLibrary, Gate
9
10
 
@@ -11,19 +12,61 @@ from quantum_debugger.core.gates import GateLibrary, Gate
11
12
  class QuantumCircuit:
12
13
  """Quantum circuit with gate operations"""
13
14
 
14
- def __init__(self, num_qubits: int, num_classical: int = 0):
15
+ def __init__(self, num_qubits: int, num_classical: int = 0,
16
+ noise_model: Optional[Any] = None,
17
+ noise_simulation_method: str = 'density_matrix'):
15
18
  """
16
19
  Initialize a quantum circuit
17
20
 
18
21
  Args:
19
22
  num_qubits: Number of quantum bits
20
23
  num_classical: Number of classical bits for measurements
24
+ noise_model: Optional noise model (NoiseModel or HardwareProfile)
25
+ noise_simulation_method: 'density_matrix', 'stochastic', or 'approximate'
21
26
  """
22
27
  self.num_qubits = num_qubits
23
28
  self.num_classical = num_classical if num_classical > 0 else num_qubits
24
29
  self.gates: List[Gate] = []
25
30
  self.measurements: List[tuple] = []
26
31
  self._initial_state = QuantumState(num_qubits)
32
+
33
+ # Noise configuration
34
+ self.noise_model = noise_model
35
+ self.noise_simulation_method = noise_simulation_method
36
+ self.apply_noise = noise_model is not None
37
+
38
+ # Memory warning for large circuits with density matrices
39
+ if self.apply_noise and num_qubits > 10 and noise_simulation_method == 'density_matrix':
40
+ memory_mb = (2**num_qubits)**2 * 16 / (1024**2) # complex128 = 16 bytes
41
+ warnings.warn(
42
+ f"Density matrix for {num_qubits} qubits requires ~{memory_mb:.1f}MB memory. "
43
+ f"Consider noise_simulation_method='stochastic' for circuits with >10 qubits.",
44
+ ResourceWarning,
45
+ stacklevel=2
46
+ )
47
+
48
+ def set_noise_model(self, noise_model: Optional[Any],
49
+ noise_simulation_method: str = 'density_matrix'):
50
+ """
51
+ Set or update noise model for the circuit
52
+
53
+ Args:
54
+ noise_model: NoiseModel instance, HardwareProfile, or None to disable
55
+ noise_simulation_method: 'density_matrix', 'stochastic', or 'approximate'
56
+ """
57
+ self.noise_model = noise_model
58
+ self.noise_simulation_method = noise_simulation_method
59
+ self.apply_noise = noise_model is not None
60
+
61
+ # Update memory warning if needed
62
+ if self.apply_noise and self.num_qubits > 10 and noise_simulation_method == 'density_matrix':
63
+ memory_mb = (2**self.num_qubits)**2 * 16 / (1024**2)
64
+ warnings.warn(
65
+ f"Density matrix for {self.num_qubits} qubits requires ~{memory_mb:.1f}MB memory. "
66
+ f"Consider noise_simulation_method='stochastic' for circuits with >10 qubits.",
67
+ ResourceWarning,
68
+ stacklevel=2
69
+ )
27
70
 
28
71
  def _add_gate(self, name: str, matrix: np.ndarray, qubits: Union[int, List[int]], params: dict = None):
29
72
  """Add a gate to the circuit"""
@@ -166,11 +209,16 @@ class QuantumCircuit:
166
209
 
167
210
  Args:
168
211
  shots: Number of times to run the circuit
169
- initial_state: Optional initial state (defaults to |0...0>)
212
+ initial_state: Optional initial state (defaults to |0...0)
170
213
 
171
214
  Returns:
172
215
  Dictionary with measurement results and statistics
173
216
  """
217
+ # Route to noisy execution if noise model is enabled
218
+ if self.apply_noise:
219
+ return self._run_with_noise(shots, initial_state)
220
+
221
+ # Standard noiseless execution
174
222
  results = []
175
223
 
176
224
  for _ in range(shots):
@@ -199,6 +247,76 @@ class QuantumCircuit:
199
247
  'shots': shots
200
248
  }
201
249
 
250
+ def _run_with_noise(self, shots: int, initial_state: Optional[QuantumState]) -> dict:
251
+ """
252
+ Execute circuit with noise simulation
253
+
254
+ Args:
255
+ shots: Number of times to run the circuit
256
+ initial_state: Optional initial state
257
+
258
+ Returns:
259
+ Dictionary with measurement results, statistics, and fidelity
260
+ """
261
+ from quantum_debugger.noise import QuantumState as NoisyQuantumState
262
+
263
+ results = []
264
+ fidelities = []
265
+
266
+ for _ in range(shots):
267
+ # Initialize with density matrix
268
+ if initial_state:
269
+ # Convert existing state to density matrix if needed
270
+ if hasattr(initial_state, 'density_matrix') and initial_state.density_matrix is not None:
271
+ state = initial_state.copy()
272
+ else:
273
+ state = NoisyQuantumState(self.num_qubits,
274
+ state_vector=initial_state.state_vector,
275
+ use_density_matrix=True)
276
+ else:
277
+ state = NoisyQuantumState(self.num_qubits, use_density_matrix=True)
278
+
279
+ # Store reference state for fidelity calculation
280
+ reference_state = NoisyQuantumState(self.num_qubits, use_density_matrix=True)
281
+ for gate in self.gates:
282
+ reference_state.apply_gate(gate.matrix, gate.qubits)
283
+
284
+ # Apply gates with noise
285
+ for gate in self.gates:
286
+ # Apply the gate
287
+ state.apply_gate(gate.matrix, gate.qubits)
288
+
289
+ # Apply noise after the gate
290
+ if self.noise_model:
291
+ self.noise_model.apply(state, qubits=gate.qubits)
292
+
293
+ # Calculate fidelity
294
+ if hasattr(state, 'density_matrix') and state.density_matrix is not None:
295
+ # Fidelity = Tr(ρ_ideal * ρ_noisy)
296
+ fidelity = np.trace(reference_state.density_matrix @ state.density_matrix).real
297
+ fidelities.append(fidelity)
298
+
299
+ # Perform measurements
300
+ classical_bits = [0] * self.num_classical
301
+ for qubit, classical_bit in self.measurements:
302
+ classical_bits[classical_bit] = state.measure(qubit)
303
+
304
+ results.append(classical_bits)
305
+
306
+ # Analyze results
307
+ counts = {}
308
+ for result in results:
309
+ key = ''.join(map(str, result))
310
+ counts[key] = counts.get(key, 0) + 1
311
+
312
+ return {
313
+ 'counts': counts,
314
+ 'results': results,
315
+ 'shots': shots,
316
+ 'fidelity': np.mean(fidelities) if fidelities else 1.0,
317
+ 'fidelity_std': np.std(fidelities) if fidelities else 0.0
318
+ }
319
+
202
320
  def get_statevector(self, initial_state: Optional[QuantumState] = None) -> QuantumState:
203
321
  """
204
322
  Get final state vector without measurements
@@ -0,0 +1,47 @@
1
+ """
2
+ Quantum noise simulation module
3
+ """
4
+
5
+ from quantum_debugger.noise.noise_models import (
6
+ NoiseModel,
7
+ DepolarizingNoise,
8
+ AmplitudeDamping,
9
+ PhaseDamping,
10
+ ThermalRelaxation
11
+ )
12
+
13
+ from quantum_debugger.noise.noise_helpers import QuantumState
14
+
15
+ from quantum_debugger.noise.composite_noise import CompositeNoise
16
+
17
+ from quantum_debugger.noise.hardware_profiles import (
18
+ HardwareProfile,
19
+ IBM_PERTH_2025,
20
+ GOOGLE_SYCAMORE_2025,
21
+ IONQ_ARIA_2025,
22
+ RIGETTI_ASPEN_2025,
23
+ HARDWARE_PROFILES,
24
+ get_hardware_profile,
25
+ list_hardware_profiles
26
+ )
27
+
28
+ __all__ = [
29
+ # Noise models
30
+ 'NoiseModel',
31
+ 'DepolarizingNoise',
32
+ 'AmplitudeDamping',
33
+ 'PhaseDamping',
34
+ 'ThermalRelaxation',
35
+ 'CompositeNoise',
36
+ # State wrapper
37
+ 'QuantumState',
38
+ # Hardware profiles
39
+ 'HardwareProfile',
40
+ 'IBM_PERTH_2025',
41
+ 'GOOGLE_SYCAMORE_2025',
42
+ 'IONQ_ARIA_2025',
43
+ 'RIGETTI_ASPEN_2025',
44
+ 'HARDWARE_PROFILES',
45
+ 'get_hardware_profile',
46
+ 'list_hardware_profiles',
47
+ ]
@@ -0,0 +1,54 @@
1
+ """
2
+ Composite noise model for combining multiple noise sources
3
+ """
4
+
5
+ import numpy as np
6
+ from typing import List, Optional
7
+ from quantum_debugger.noise.noise_models import NoiseModel
8
+
9
+
10
+ class CompositeNoise(NoiseModel):
11
+ """
12
+ Composite noise model that applies multiple noise sources sequentially
13
+
14
+ Allows realistic simulation by combining different noise types:
15
+ - Thermal relaxation (T1/T2)
16
+ - Depolarizing errors
17
+ - Readout errors
18
+ - etc.
19
+
20
+ Example:
21
+ >>> thermal = ThermalRelaxation(t1=100e-6, t2=80e-6, gate_time=50e-9)
22
+ >>> depol = DepolarizingNoise(0.001)
23
+ >>> composite = CompositeNoise([thermal, depol])
24
+ """
25
+
26
+ def __init__(self, noise_models: List[NoiseModel]):
27
+ """
28
+ Initialize composite noise model
29
+
30
+ Args:
31
+ noise_models: List of NoiseModel instances to apply sequentially
32
+ """
33
+ if not noise_models:
34
+ raise ValueError("CompositeNoise requires at least one noise model")
35
+
36
+ self.noise_models = noise_models
37
+
38
+ def apply(self, state, qubits: Optional[list] = None):
39
+ """
40
+ Apply all noise models sequentially
41
+
42
+ Args:
43
+ state: QuantumState to apply noise to
44
+ qubits: Optional list of qubits (None = all qubits)
45
+ """
46
+ for noise_model in self.noise_models:
47
+ noise_model.apply(state, qubits)
48
+
49
+ def __repr__(self):
50
+ models_str = ", ".join(repr(m) for m in self.noise_models)
51
+ return f"CompositeNoise([{models_str}])"
52
+
53
+ def __str__(self):
54
+ return f"CompositeNoise with {len(self.noise_models)} noise sources"