seu-injection-framework 1.1.7__py3-none-any.whl

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.
@@ -0,0 +1,65 @@
1
+ """
2
+ SEU Injection Framework
3
+ ======================
4
+
5
+ A comprehensive framework for Single Event Upset (SEU) injection in neural networks
6
+ for studying fault tolerance in harsh environments.
7
+
8
+ # TODO PRODUCTION READINESS: Public API improvements per PRODUCTION_READINESS_PLAN.md
9
+ # ISSUE: Current API requires deep understanding (IEEE 754, layer names, device management)
10
+ # NEEDED: High-level convenience functions for common scenarios:
11
+ # - quick_robustness_check(model, test_data) -> simple robustness score
12
+ # - compare_architectures(models_dict, test_data) -> comparative analysis
13
+ # - space_mission_simulation(model, radiation_level) -> space-specific testing
14
+ # TYPE SAFETY: Add comprehensive type stubs for better IDE support
15
+ # ERROR MESSAGES: Custom exception types with helpful guidance for beginners
16
+ # EXAMPLES: In-docstring examples need to be more comprehensive and tested
17
+ # COMPATIBILITY: Ensure consistent device handling across all functions
18
+ # PRIORITY: MEDIUM - Improve user onboarding experience
19
+
20
+ This package provides tools for:
21
+ - Systematic SEU injection in PyTorch models
22
+ - Performance evaluation under radiation-induced bit flips
23
+ - Analysis of neural network robustness in space and nuclear environments
24
+
25
+ Basic Usage:
26
+ >>> from seu_injection import SEUInjector
27
+ >>> from seu_injection.metrics import classification_accuracy
28
+ >>> injector = SEUInjector(trained_model=model, criterion=classification_accuracy, x=X, y=y)
29
+ >>> results = injector.run_stochastic_seu(bit_i=15, p=0.01)
30
+
31
+ For detailed examples, see the documentation at:
32
+ https://seu-injection-framework.readthedocs.io
33
+ """
34
+
35
+ try: # Prefer dynamic version from installed metadata
36
+ from importlib.metadata import version as _pkg_version
37
+
38
+ __version__ = _pkg_version("seu-injection-framework")
39
+ except Exception: # Fallback for editable/source checkouts prior to build
40
+ __version__ = "1.1.7"
41
+ __author__ = "William Dennis"
42
+ __email__ = "william.dennis@bristol.ac.uk"
43
+
44
+ # Core public API
45
+ from .bitops.float32 import bitflip_float32
46
+ from .core.injector import SEUInjector
47
+
48
+ # Convenience imports for common use cases
49
+ from .core.injector import SEUInjector as Injector # Short alias
50
+ from .metrics.accuracy import classification_accuracy, classification_accuracy_loader
51
+
52
+ __all__ = [
53
+ # Core classes
54
+ "SEUInjector",
55
+ "Injector", # Short alias
56
+ # Metrics functions
57
+ "classification_accuracy",
58
+ "classification_accuracy_loader",
59
+ # Bitflip operations
60
+ "bitflip_float32",
61
+ # Package metadata
62
+ "__version__",
63
+ "__author__",
64
+ "__email__",
65
+ ]
@@ -0,0 +1,22 @@
1
+ """
2
+ Bit manipulation operations for SEU injection.
3
+
4
+ This module provides efficient bit-level operations for different precision formats
5
+ used in neural network fault tolerance research.
6
+ """
7
+
8
+ from .float32 import (
9
+ binary_to_float32,
10
+ bitflip_float32,
11
+ bitflip_float32_fast,
12
+ bitflip_float32_optimized,
13
+ float32_to_binary,
14
+ )
15
+
16
+ __all__ = [
17
+ "bitflip_float32",
18
+ "bitflip_float32_fast",
19
+ "bitflip_float32_optimized",
20
+ "float32_to_binary",
21
+ "binary_to_float32",
22
+ ]