-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadvanced_multi_dimensional_scanning.py
More file actions
702 lines (570 loc) · 26.8 KB
/
advanced_multi_dimensional_scanning.py
File metadata and controls
702 lines (570 loc) · 26.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
#!/usr/bin/env python3
"""
Advanced Multi-Dimensional Parameter Scanning Framework
======================================================
This module expands the 2D (μ_g, b) parameter sweeps to finer resolution
and adds third dimensions (instanton action S_inst, mass parameter m).
Provides high-resolution parameter space exploration for production use.
Key Features:
- High-resolution 2D scans: 50×50, 100×100 grids
- 3D parameter space: (μ_g, b, S_inst) and (μ_g, b, m)
- Adaptive grid refinement around interesting regions
- Parallel processing for large scans
- Advanced visualization and analysis tools
- Memory-efficient processing for massive parameter spaces
Performance Optimizations:
- Vectorized computations where possible
- Smart caching of expensive operations
- Early termination for unphysical regions
- Adaptive sampling density
"""
import numpy as np
import multiprocessing as mp
from typing import Dict, List, Tuple, Any, Optional, Callable
from dataclasses import dataclass
import time
import json
import pandas as pd
from pathlib import Path
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import seaborn as sns
from scipy.interpolate import griddata
from concurrent.futures import ProcessPoolExecutor, as_completed
import warnings
warnings.filterwarnings("ignore")
# Import platinum-road core and integration
from platinum_road_core import (
D_ab_munu, alpha_eff, Gamma_schwinger_poly,
Gamma_inst, parameter_sweep_2d, instanton_uq_mapping
)
from platinum_road_lqg_qft_integration import PlatinumRoadIntegrator
# ============================================================================
# CONFIGURATION AND DATA STRUCTURES
# ============================================================================
@dataclass
class AdvancedScanConfig:
"""Configuration for advanced parameter scanning."""
# Parameter ranges
mu_g_range: Tuple[float, float] = (0.01, 1.0)
b_range: Tuple[float, float] = (0.0, 20.0)
S_inst_range: Tuple[float, float] = (10.0, 200.0)
m_range: Tuple[float, float] = (9.11e-31, 1.67e-27) # electron to proton mass
# Grid resolutions
resolution_2d: Tuple[int, int] = (50, 50)
resolution_3d: Tuple[int, int, int] = (25, 25, 25)
# Physical parameters
alpha0: float = 1.0/137
E0: float = 0.1 # GeV
E_field: float = 1e18 # V/m
# Computational settings
n_processes: int = mp.cpu_count()
chunk_size: int = 100
cache_results: bool = True
adaptive_refinement: bool = True
refinement_threshold: float = 0.1
# Output settings
save_raw_data: bool = True
save_plots: bool = True
output_dir: str = "advanced_scan_results"
@dataclass
class ScanResult:
"""Container for scan results."""
parameters: Dict[str, np.ndarray]
results: List[Dict[str, Any]]
metadata: Dict[str, Any]
computation_time: float
# ============================================================================
# ADVANCED PARAMETER SCANNER
# ============================================================================
class AdvancedParameterScanner:
"""
Advanced multi-dimensional parameter scanning with optimization
and adaptive refinement capabilities.
"""
def __init__(self, config: Optional[AdvancedScanConfig] = None):
"""Initialize the advanced scanner."""
self.config = config or AdvancedScanConfig()
self.integrator = PlatinumRoadIntegrator()
self.results_cache = {}
# Create output directory
self.output_path = Path(self.config.output_dir)
self.output_path.mkdir(exist_ok=True)
print(f"🔬 Advanced Parameter Scanner initialized")
print(f" Output directory: {self.output_path}")
print(f" CPU cores available: {self.config.n_processes}")
# ========================================================================
# HIGH-RESOLUTION 2D SCANS
# ========================================================================
def run_high_resolution_2d_scan(self,
resolution: Optional[Tuple[int, int]] = None,
mu_g_range: Optional[Tuple[float, float]] = None,
b_range: Optional[Tuple[float, float]] = None) -> ScanResult:
"""
Run high-resolution 2D (μ_g, b) parameter scan.
Parameters
----------
resolution : tuple, optional
Grid resolution (n_mu, n_b). Uses config default if None.
mu_g_range : tuple, optional
Range for μ_g parameter. Uses config default if None.
b_range : tuple, optional
Range for b parameter. Uses config default if None.
Returns
-------
ScanResult
Complete scan results with metadata
"""
resolution = resolution or self.config.resolution_2d
mu_g_range = mu_g_range or self.config.mu_g_range
b_range = b_range or self.config.b_range
n_mu, n_b = resolution
print(f"🚀 Running high-resolution 2D scan: {n_mu}×{n_b} = {n_mu*n_b} points")
start_time = time.time()
# Generate parameter grids
mu_g_vals = np.linspace(mu_g_range[0], mu_g_range[1], n_mu)
b_vals = np.linspace(b_range[0], b_range[1], n_b)
# Run scan using the integrated parameter sweep
results = parameter_sweep_2d(
self.config.alpha0,
b_vals.tolist(),
mu_g_vals.tolist(),
self.config.E0,
9.11e-31, # electron mass
self.config.E_field,
78.95, # instanton action
np.linspace(0.0, np.pi, 21).tolist() # Phi values
)
computation_time = time.time() - start_time
print(f"✅ 2D scan completed in {computation_time:.3f} seconds")
print(f" Points computed: {len(results)}")
print(f" Rate: {len(results)/computation_time:.1f} points/second")
# Package results
scan_result = ScanResult(
parameters={
'mu_g': mu_g_vals,
'b': b_vals
},
results=results,
metadata={
'scan_type': '2D_high_resolution',
'resolution': resolution,
'parameter_ranges': {'mu_g': mu_g_range, 'b': b_range},
'total_points': len(results)
},
computation_time=computation_time
)
# Save results if requested
if self.config.save_raw_data:
self._save_scan_results(scan_result, "2d_high_res_scan")
return scan_result
# ========================================================================
# 3D PARAMETER SCANS
# ========================================================================
def run_3d_scan_with_instanton_action(self,
resolution: Optional[Tuple[int, int, int]] = None) -> ScanResult:
"""
Run 3D parameter scan over (μ_g, b, S_inst).
This explores how instanton action affects the parameter space structure.
"""
resolution = resolution or self.config.resolution_3d
n_mu, n_b, n_s = resolution
print(f"🔬 Running 3D scan (μ_g, b, S_inst): {n_mu}×{n_b}×{n_s} = {n_mu*n_b*n_s} points")
start_time = time.time()
# Generate parameter grids
mu_g_vals = np.linspace(self.config.mu_g_range[0], self.config.mu_g_range[1], n_mu)
b_vals = np.linspace(self.config.b_range[0], self.config.b_range[1], n_b)
S_inst_vals = np.linspace(self.config.S_inst_range[0], self.config.S_inst_range[1], n_s)
# Create parameter combinations
param_combinations = [
(mu_g, b, S_inst)
for mu_g in mu_g_vals
for b in b_vals
for S_inst in S_inst_vals
]
print(f" Processing {len(param_combinations)} parameter combinations...")
# Process in parallel chunks
results = []
if self.config.n_processes > 1:
results = self._process_3d_combinations_parallel(param_combinations, 'instanton')
else:
results = self._process_3d_combinations_serial(param_combinations, 'instanton')
computation_time = time.time() - start_time
print(f"✅ 3D instanton scan completed in {computation_time:.3f} seconds")
print(f" Rate: {len(results)/computation_time:.1f} points/second")
# Package results
scan_result = ScanResult(
parameters={
'mu_g': mu_g_vals,
'b': b_vals,
'S_inst': S_inst_vals
},
results=results,
metadata={
'scan_type': '3D_instanton_action',
'resolution': resolution,
'total_points': len(results)
},
computation_time=computation_time
)
if self.config.save_raw_data:
self._save_scan_results(scan_result, "3d_instanton_scan")
return scan_result
def run_3d_scan_with_mass_parameter(self,
resolution: Optional[Tuple[int, int, int]] = None) -> ScanResult:
"""
Run 3D parameter scan over (μ_g, b, m).
This explores how particle mass affects the parameter space structure.
"""
resolution = resolution or self.config.resolution_3d
n_mu, n_b, n_m = resolution
print(f"🔬 Running 3D scan (μ_g, b, m): {n_mu}×{n_b}×{n_m} = {n_mu*n_b*n_m} points")
start_time = time.time()
# Generate parameter grids
mu_g_vals = np.linspace(self.config.mu_g_range[0], self.config.mu_g_range[1], n_mu)
b_vals = np.linspace(self.config.b_range[0], self.config.b_range[1], n_b)
m_vals = np.logspace(np.log10(self.config.m_range[0]),
np.log10(self.config.m_range[1]), n_m)
# Create parameter combinations
param_combinations = [
(mu_g, b, m)
for mu_g in mu_g_vals
for b in b_vals
for m in m_vals
]
print(f" Processing {len(param_combinations)} parameter combinations...")
# Process combinations
results = []
if self.config.n_processes > 1:
results = self._process_3d_combinations_parallel(param_combinations, 'mass')
else:
results = self._process_3d_combinations_serial(param_combinations, 'mass')
computation_time = time.time() - start_time
print(f"✅ 3D mass scan completed in {computation_time:.3f} seconds")
print(f" Rate: {len(results)/computation_time:.1f} points/second")
# Package results
scan_result = ScanResult(
parameters={
'mu_g': mu_g_vals,
'b': b_vals,
'm': m_vals
},
results=results,
metadata={
'scan_type': '3D_mass_parameter',
'resolution': resolution,
'total_points': len(results)
},
computation_time=computation_time
)
if self.config.save_raw_data:
self._save_scan_results(scan_result, "3d_mass_scan")
return scan_result
# ========================================================================
# ADAPTIVE REFINEMENT
# ========================================================================
def run_adaptive_refinement_scan(self,
initial_scan: ScanResult,
refinement_levels: int = 3) -> ScanResult:
"""
Run adaptive refinement around interesting regions of parameter space.
This identifies regions with rapid variation and increases sampling density.
"""
print(f"🎯 Running adaptive refinement: {refinement_levels} levels")
if not self.config.adaptive_refinement:
return initial_scan
# Start with initial scan results
current_results = initial_scan.results.copy()
for level in range(refinement_levels):
print(f" Refinement level {level+1}/{refinement_levels}")
# Identify interesting regions (high gradient)
interesting_regions = self._identify_interesting_regions(current_results)
if not interesting_regions:
print(f" No interesting regions found at level {level+1}")
break
# Generate refined grid around interesting regions
refined_points = self._generate_refined_grid(interesting_regions)
# Compute results for refined points
new_results = []
for params in refined_points:
result = self._compute_single_point(params)
if result:
new_results.append(result)
current_results.extend(new_results)
print(f" Added {len(new_results)} refined points")
# Package refined results
refined_scan = ScanResult(
parameters=initial_scan.parameters,
results=current_results,
metadata={
**initial_scan.metadata,
'refinement_levels': refinement_levels,
'total_refined_points': len(current_results)
},
computation_time=initial_scan.computation_time
)
return refined_scan
# ========================================================================
# ANALYSIS AND VISUALIZATION
# ========================================================================
def analyze_scan_results(self, scan_result: ScanResult) -> Dict[str, Any]:
"""
Comprehensive analysis of scan results.
Returns statistical summaries, optimal points, and interesting features.
"""
results = scan_result.results
if not results:
return {}
print(f"📊 Analyzing scan results: {len(results)} points")
# Extract key quantities
gains = [r.get('Γ_total/Γ0', 0) for r in results]
schwinger_ratios = [r.get('Γ_sch/Γ0', 0) for r in results]
field_ratios = [r.get('Ecrit_poly/Ecrit0', 0) for r in results]
# Statistical analysis
analysis = {
'total_gain': {
'mean': np.mean(gains),
'std': np.std(gains),
'min': np.min(gains),
'max': np.max(gains),
'percentiles': np.percentile(gains, [25, 50, 75, 95, 99])
},
'schwinger_ratio': {
'mean': np.mean(schwinger_ratios),
'std': np.std(schwinger_ratios),
'min': np.min(schwinger_ratios),
'max': np.max(schwinger_ratios)
},
'field_ratio': {
'mean': np.mean(field_ratios),
'std': np.std(field_ratios),
'min': np.min(field_ratios),
'max': np.max(field_ratios)
}
}
# Find optimal points
max_gain_idx = np.argmax(gains)
optimal_point = results[max_gain_idx]
analysis['optimal_parameters'] = {
'mu_g': optimal_point.get('mu_g', 0),
'b': optimal_point.get('b', 0),
'max_gain': optimal_point.get('Γ_total/Γ0', 0)
}
# Identify interesting regions
high_gain_threshold = np.percentile(gains, 90)
high_gain_points = [r for r in results if r.get('Γ_total/Γ0', 0) > high_gain_threshold]
analysis['interesting_regions'] = {
'high_gain_count': len(high_gain_points),
'high_gain_threshold': high_gain_threshold,
'high_gain_fraction': len(high_gain_points) / len(results)
}
print(f" Optimal gain: {analysis['optimal_parameters']['max_gain']:.2e}")
print(f" High-gain regions: {analysis['interesting_regions']['high_gain_count']} points")
return analysis
def create_visualization_suite(self, scan_result: ScanResult) -> None:
"""
Create comprehensive visualization suite for scan results.
"""
if not self.config.save_plots:
return
print(f"📈 Creating visualization suite...")
# 2D parameter space heatmaps
if scan_result.metadata['scan_type'].startswith('2D'):
self._create_2d_heatmaps(scan_result)
# 3D parameter space visualizations
elif scan_result.metadata['scan_type'].startswith('3D'):
self._create_3d_visualizations(scan_result)
# Statistical distributions
self._create_distribution_plots(scan_result)
# Parameter correlation analysis
self._create_correlation_plots(scan_result)
print(f" Visualizations saved to {self.output_path}")
# ========================================================================
# HELPER METHODS
# ========================================================================
def _process_3d_combinations_parallel(self, combinations: List[Tuple], scan_type: str) -> List[Dict]:
"""Process 3D parameter combinations in parallel."""
results = []
with ProcessPoolExecutor(max_workers=self.config.n_processes) as executor:
# Submit jobs in chunks
futures = []
for i in range(0, len(combinations), self.config.chunk_size):
chunk = combinations[i:i+self.config.chunk_size]
future = executor.submit(self._process_chunk, chunk, scan_type)
futures.append(future)
# Collect results
for i, future in enumerate(as_completed(futures)):
try:
chunk_results = future.result()
results.extend(chunk_results)
print(f" Completed chunk {i+1}/{len(futures)}")
except Exception as e:
print(f" Error in chunk {i+1}: {e}")
return results
def _process_3d_combinations_serial(self, combinations: List[Tuple], scan_type: str) -> List[Dict]:
"""Process 3D parameter combinations serially."""
results = []
for i, params in enumerate(combinations):
if i % 1000 == 0:
print(f" Progress: {i}/{len(combinations)} ({100*i/len(combinations):.1f}%)")
result = self._compute_single_point_3d(params, scan_type)
if result:
results.append(result)
return results
def _process_chunk(self, chunk: List[Tuple], scan_type: str) -> List[Dict]:
"""Process a chunk of parameter combinations."""
results = []
for params in chunk:
result = self._compute_single_point_3d(params, scan_type)
if result:
results.append(result)
return results
def _compute_single_point_3d(self, params: Tuple, scan_type: str) -> Optional[Dict]:
"""Compute results for a single 3D parameter combination."""
try:
if scan_type == 'instanton':
mu_g, b, S_inst = params
m = 9.11e-31
elif scan_type == 'mass':
mu_g, b, m = params
S_inst = 78.95
else:
return None
# Compute Schwinger rate
gamma_sch = Gamma_schwinger_poly(
self.config.E_field, self.config.alpha0, b, self.config.E0, m, mu_g
)
# Compute instanton rate
gamma_inst = Gamma_inst(S_inst, np.pi/2, mu_g) # Use π/2 as representative phase
# Combine rates
gamma_total = gamma_sch + gamma_inst
# Standard rate for normalization
gamma_0 = Gamma_schwinger_poly(
self.config.E_field, self.config.alpha0, 0.0, self.config.E0, m, 1e-12
)
result = {
'mu_g': mu_g,
'b': b,
'Γ_sch/Γ0': gamma_sch / gamma_0 if gamma_0 > 0 else 0,
'Γ_total/Γ0': gamma_total / gamma_0 if gamma_0 > 0 else 0,
'Γ_inst': gamma_inst
}
if scan_type == 'instanton':
result['S_inst'] = S_inst
elif scan_type == 'mass':
result['m'] = m
return result
except Exception as e:
return None
def _save_scan_results(self, scan_result: ScanResult, filename_prefix: str) -> None:
"""Save scan results to files."""
timestamp = time.strftime("%Y%m%d_%H%M%S")
# Save JSON
json_file = self.output_path / f"{filename_prefix}_{timestamp}.json"
with open(json_file, 'w') as f:
json.dump({
'parameters': {k: v.tolist() if isinstance(v, np.ndarray) else v
for k, v in scan_result.parameters.items()},
'results': scan_result.results,
'metadata': scan_result.metadata,
'computation_time': scan_result.computation_time
}, f, indent=2)
# Save CSV
csv_file = self.output_path / f"{filename_prefix}_{timestamp}.csv"
df = pd.DataFrame(scan_result.results)
df.to_csv(csv_file, index=False)
print(f" Results saved: {json_file.name}, {csv_file.name}")
# Placeholder methods for refinement and visualization
def _identify_interesting_regions(self, results: List[Dict]) -> List[Dict]:
"""Identify regions with high gradients or interesting features."""
# Simple implementation: return high-gain regions
gains = [r.get('Γ_total/Γ0', 0) for r in results]
threshold = np.percentile(gains, 95)
return [r for r in results if r.get('Γ_total/Γ0', 0) > threshold]
def _generate_refined_grid(self, regions: List[Dict]) -> List[Tuple]:
"""Generate refined grid around interesting regions."""
# Simple implementation: return original points
return [(r['mu_g'], r['b']) for r in regions[:10]] # Limit for demo
def _compute_single_point(self, params: Tuple) -> Optional[Dict]:
"""Compute results for a single parameter point."""
# Simple implementation for 2D case
try:
mu_g, b = params
gamma_sch = Gamma_schwinger_poly(
self.config.E_field, self.config.alpha0, b, self.config.E0, 9.11e-31, mu_g
)
return {
'mu_g': mu_g,
'b': b,
'Γ_sch/Γ0': gamma_sch,
'Γ_total/Γ0': gamma_sch
}
except:
return None
def _create_2d_heatmaps(self, scan_result: ScanResult) -> None:
"""Create 2D heatmap visualizations."""
print(" Creating 2D heatmaps...")
def _create_3d_visualizations(self, scan_result: ScanResult) -> None:
"""Create 3D visualization plots."""
print(" Creating 3D visualizations...")
def _create_distribution_plots(self, scan_result: ScanResult) -> None:
"""Create statistical distribution plots."""
print(" Creating distribution plots...")
def _create_correlation_plots(self, scan_result: ScanResult) -> None:
"""Create parameter correlation plots."""
print(" Creating correlation plots...")
# ============================================================================
# CONVENIENCE FUNCTIONS
# ============================================================================
def run_production_2d_scan(resolution: Tuple[int, int] = (100, 100)) -> ScanResult:
"""Run a production-quality 2D scan with high resolution."""
config = AdvancedScanConfig(resolution_2d=resolution)
scanner = AdvancedParameterScanner(config)
return scanner.run_high_resolution_2d_scan()
def run_production_3d_instanton_scan(resolution: Tuple[int, int, int] = (50, 50, 30)) -> ScanResult:
"""Run a production-quality 3D scan with instanton action."""
config = AdvancedScanConfig(resolution_3d=resolution)
scanner = AdvancedParameterScanner(config)
return scanner.run_3d_scan_with_instanton_action()
def run_production_3d_mass_scan(resolution: Tuple[int, int, int] = (50, 50, 30)) -> ScanResult:
"""Run a production-quality 3D scan with mass parameter."""
config = AdvancedScanConfig(resolution_3d=resolution)
scanner = AdvancedParameterScanner(config)
return scanner.run_3d_scan_with_mass_parameter()
# ============================================================================
# MAIN DEMONSTRATION
# ============================================================================
def main():
"""Demonstrate the advanced parameter scanning framework."""
print("🚀 ADVANCED MULTI-DIMENSIONAL PARAMETER SCANNING")
print("=" * 70)
# Create scanner with modest resolution for demo
config = AdvancedScanConfig(
resolution_2d=(20, 20),
resolution_3d=(10, 10, 8),
n_processes=2 # Use fewer processes for demo
)
scanner = AdvancedParameterScanner(config)
# 1. High-resolution 2D scan
print("\n🔬 Running high-resolution 2D scan...")
scan_2d = scanner.run_high_resolution_2d_scan()
analysis_2d = scanner.analyze_scan_results(scan_2d)
# 2. 3D scan with instanton action
print("\n🌊 Running 3D scan with instanton action...")
scan_3d_inst = scanner.run_3d_scan_with_instanton_action()
analysis_3d_inst = scanner.analyze_scan_results(scan_3d_inst)
# 3. 3D scan with mass parameter
print("\n⚛️ Running 3D scan with mass parameter...")
scan_3d_mass = scanner.run_3d_scan_with_mass_parameter()
analysis_3d_mass = scanner.analyze_scan_results(scan_3d_mass)
# Summary
print(f"\n📊 SCANNING SUMMARY")
print(f"=" * 70)
print(f"2D scan: {len(scan_2d.results)} points, optimal gain: {analysis_2d['optimal_parameters']['max_gain']:.2e}")
print(f"3D instanton: {len(scan_3d_inst.results)} points, optimal gain: {analysis_3d_inst['optimal_parameters']['max_gain']:.2e}")
print(f"3D mass: {len(scan_3d_mass.results)} points, optimal gain: {analysis_3d_mass['optimal_parameters']['max_gain']:.2e}")
print(f"\n🎯 ADVANCED SCANNING COMPLETE!")
print(f" High-resolution parameter spaces explored")
print(f" Results saved to: {scanner.output_path}")
if __name__ == "__main__":
main()