Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

πŸ”– Checkpoint: Edit /workspaces/claude-code-flow/proposed_patch.py

rUv530b7c607822
diff --git a/.claude/checkpoints/task-1754583520.json b/.claude/checkpoints/task-1754583520.json
new file mode 100644
index 0000000000..9591a1b7ed
--- /dev/null
+++ b/.claude/checkpoints/task-1754583520.json
@@ -0,0 +1 @@
+{"checkpoint": "task-20250807-161839", "task": "🧠 HIVE MIND COLLECTIVE INTELLIGENCE SYSTEM ══════════════════", "timestamp": "2025-08-07T16:18:40Z", "commit": "7b8e183072981c738d97f06eed15cfb5507894a3", "github_release": "true"}
diff --git a/proposed_patch.py b/proposed_patch.py
new file mode 100644
index 0000000000..750ef439d4
--- /dev/null
+++ b/proposed_patch.py
@@ -0,0 +1,146 @@
+"""
+Proposed patch to add helper functions for converting between uncertainty types.
+This adds convenience methods to NDUncertainty classes to make conversion easier.
+"""
+
+# The patch would add these methods to the NDUncertainty class:
+
+def to_stddev(self):
+ """Convert this uncertainty to standard deviation uncertainty.
+
+ Returns
+ -------
+ stddev_uncertainty : `StdDevUncertainty`
+ The uncertainty converted to standard deviation.
+
+ Raises
+ ------
+ TypeError
+ If the conversion is not supported.
+
+ Examples
+ --------
+ >>> from astropy.nddata import VarianceUncertainty
+ >>> import numpy as np
+ >>> var = VarianceUncertainty(np.array([4, 9, 16]))
+ >>> std = var.to_stddev()
+ >>> std.array
+ array([2., 3., 4.])
+ """
+ from astropy.nddata import StdDevUncertainty
+ return self.represent_as(StdDevUncertainty)
+
+
+def to_variance(self):
+ """Convert this uncertainty to variance uncertainty.
+
+ Returns
+ -------
+ variance_uncertainty : `VarianceUncertainty`
+ The uncertainty converted to variance.
+
+ Raises
+ ------
+ TypeError
+ If the conversion is not supported.
+
+ Examples
+ --------
+ >>> from astropy.nddata import StdDevUncertainty
+ >>> import numpy as np
+ >>> std = StdDevUncertainty(np.array([2, 3, 4]))
+ >>> var = std.to_variance()
+ >>> var.array
+ array([4., 9., 16.])
+ """
+ from astropy.nddata import VarianceUncertainty
+ return self.represent_as(VarianceUncertainty)
+
+
+def to_inverse_variance(self):
+ """Convert this uncertainty to inverse variance uncertainty.
+
+ Returns
+ -------
+ ivar_uncertainty : `InverseVariance`
+ The uncertainty converted to inverse variance.
+
+ Raises
+ ------
+ TypeError
+ If the conversion is not supported.
+
+ Examples
+ --------
+ >>> from astropy.nddata import VarianceUncertainty
+ >>> import numpy as np
+ >>> var = VarianceUncertainty(np.array([4, 9, 16]))
+ >>> ivar = var.to_inverse_variance()
+ >>> ivar.array
+ array([0.25, 0.11111111, 0.0625])
+ """
+ from astropy.nddata import InverseVariance
+ return self.represent_as(InverseVariance)
+
+
+# Also add a standalone function for convenience:
+
+def convert_uncertainty(uncertainty, target_type):
+ """Convert an uncertainty to a different uncertainty type.
+
+ Parameters
+ ----------
+ uncertainty : `NDUncertainty` instance
+ The uncertainty to convert.
+ target_type : str or `NDUncertainty` subclass
+ The target uncertainty type. Can be:
+ - 'stddev' or 'std' for `StdDevUncertainty`
+ - 'variance' or 'var' for `VarianceUncertainty`
+ - 'inverse_variance' or 'ivar' for `InverseVariance`
+ - An `NDUncertainty` subclass
+
+ Returns
+ -------
+ converted_uncertainty : `NDUncertainty` instance
+ The uncertainty converted to the target type.
+
+ Raises
+ ------
+ TypeError
+ If the conversion is not supported.
+ ValueError
+ If the target_type string is not recognized.
+
+ Examples
+ --------
+ >>> from astropy.nddata import StdDevUncertainty, convert_uncertainty
+ >>> import numpy as np
+ >>> std = StdDevUncertainty(np.array([2, 3, 4]))
+ >>> var = convert_uncertainty(std, 'variance')
+ >>> var.array
+ array([4., 9., 16.])
+ """
+ from astropy.nddata import StdDevUncertainty, VarianceUncertainty, InverseVariance
+
+ # Map string names to classes
+ type_map = {
+ 'stddev': StdDevUncertainty,
+ 'std': StdDevUncertainty,
+ 'variance': VarianceUncertainty,
+ 'var': VarianceUncertainty,
+ 'inverse_variance': InverseVariance,
+ 'ivar': InverseVariance,
+ }
+
+ if isinstance(target_type, str):
+ target_type = target_type.lower()
+ if target_type not in type_map:
+ raise ValueError(
+ f"Unknown uncertainty type '{target_type}'. "
+ f"Valid options are: {', '.join(type_map.keys())}"
+ )
+ target_class = type_map[target_type]
+ else:
+ target_class = target_type
+
+ return uncertainty.represent_as(target_class)
\ No newline at end of file