dsfb-robotics 0.1.0

DSFB Structural Semiotics Engine for Robotics Health Monitoring — a deterministic, non-intrusive observer layer that reads the residuals existing robot control, kinematic identification, and whole-body balance observers already compute, and structures them into a human-readable grammar of typed episodes. Read-only augmentation, not replacement, of incumbent PHM / FDD / MPC / observer pipelines.
Documentation
+

��iK��x�Rt^RIHt^RIHt^RIt]!RR44tRRltRR	lt	R
Rlt
RR
ltR#)arParametric DSFB FSM replica.

Mirrors the Rust `dsfb_robotics::engine::DsfbRoboticsEngine<W, K>` and
`figures_real.run_dsfb`, but with W, K, beta, delta_s, and per-component
disable flags exposed as runtime parameters. Used by `sensitivity_grid.py`
and `ablation.py`. Validated against the Rust binary for the canonical
parameter set (W=8, K=4, beta=0.5, delta_s=0.05).
)�annotations)�	dataclassNc�z�]tRt^t$^tR]R&^tR]R&RtR]R&RtR]R&R	t	R
]R&R	t
R
]R&R	tR
]R
&RtR#)�	FsmParams�int�W�Kg�?�float�
boundary_fracg�������?�delta_sF�bool�
disable_drift�disable_slew�disable_hysteresis�N)
�__name__�
__module__�__qualname__�__firstlineno__r�__annotations__rr
rr
rr�__static_attributes__r��B/home/one/dsfb/crates/dsfb-robotics/scripts/dsfb_fsm_parametric.pyrrsG��
�A�s�J�
�A�s�J��M�5���G�U���M�4���L�$��$���$rrc�(�V^8�dQhRRRRRRRR/#)��hitsz
list[bool]�	hit_countrr�return�strr)�formats"r�__annotate__r s(�����������rc�6�W8�d\V4V8�dR#R#)�Boundary�
Admissible)�sum)rrrs&&&r�_check_grazingr%s���~�#�d�)�q�.��rc� �V^8�dQhRRRR/#)r�	residuals�
np.ndarrayrr	r)rs"rr r #s����:��%�rc���\V4pV^8Xd\R4#\^V^,4pVRVpV\P!V4,pVP
^8Xd\R4#\\P!\P!V444p\\P!\P!V444pVRV,,#)��infNg@)	�lenr	�max�np�isfinite�size�mean�abs�std)r'�n�cal_n�cal�finite�mu�sigmas&      r�_calibrate_enveloper:#s����I��A��A�v��U�|����1��6�N�E�
�F�U�
�C�
����S�!�
"�F�
�{�{�a���U�|��	�r�w�w�r�v�v�f�~�&�	'�B��"�&�&������(�)�E�
��e���rc�$�V^8�dQhRRRRRR/#)rr'r(�paramsrr�dictr)rs"rr r 1s&��q�q�z�q�9�q��qrc�^�\V4pVPpR.V,p^p^pRpRp^p	Rp
R.VP,p^p^p
^;p;ppRpVEF�p\P!V4'*p\P!V4'd\V4MRpVV,pVV8�dTpVWE&V^,V,pWc8d
V^,
pV'gV^8dRpRpRpM�\
Wc4pRp^p^pVV8dtWS,^,
V^,
,
V,pWS,^,
V,
V,pVVV,VV,,
,
pV^,
pV^,
pKzV^8�d
VV,MRpVV,
pTpVP'dRpVP'dRpVV8�dRpMlVVPV,8�d?V^8�dRpMJ\V4VP8�dRpM-\W�VP4pM\W�VP4pVVPV,8�;'dVV8*pVW�&V^,VP,pW�P8d
V
^,
p
VP'dTp
M%VV8XdV	^8d
V	^,
p	V	^8�dTp
MTp^p	V
R8Xd
V^,
pEK�V
R8Xd
V^,
pEK�V
R8XgEK�V^,
pEK�	\V4p VV,p!V ^8�d
V!V ,MRp"RV RVRVR	VR
V"RV/#)z�Run the parametric FSM, return aggregate census.

Drift/slew accumulation follows the Rust `sign::SignWindow::push`
summation order exactly so the Python census matches the Rust binary
bit-for-bit on canonical-parameter runs.
gr#F�	Violationr"�
total_samples�
admissible�boundary�	violation�compression_ratio�max_residual_norm_sq)r:rrr.r/r2�minr
rr
rr%rr,)#r'r<�rhor�norms�head�count�
prev_drift�pending�confirms�	committed�
boundary_hits�hit_headrrArBrC�max_norm_sq�r�below_floor�norm�norm_sq�drift�slew�filled�sum_diff�n_diffs�i�cur�prev�raw�is_approachr4�reviewed�compressions#&&                                 r�run_fsmrb1s"���i�
(�C����A�
�E�A�I�E��D�
�E��J��G��H��I��G�f�h�h�&�M��H��I�()�)�J�)��I��K�
���+�+�a�.�(�����Q���s�1�v�S����+���[� �!�K�����q��A�~���9��Q�J�E��%�!�)��E��D��J���]�F��H��G��A��f�*��x�!�|�q�1�u�-��2����1��q�(�A�-���E�#�J��t��4�4���1����Q���*1�A�+�H�w�&�3�E��:�%�D��J������E������D��#�:��C�
�F�(�(�3�.�
.��q�y� ���T��V�^�^�+� ��$�]�v�x�x�H�� ��6�8�8�D�C��f�2�2�S�8�8�H�H�T�S�[��"-�
���q�L�F�H�H�,���x�x����N�I��$�$�$��I��g�~��a�<���M�H��q�=� #�I��������$��!�O�J�
�*�
$���M�H�
�+�
%���N�I�[�^	�I��A��)�#�H�$%��E�8�a�<�s�K����j��H��Y��[���
�rc� �V^8�dQhRRRR/#)r�pathrrr(r)rs"rr r �s��.�.�s�.�z�.rc
�<�.p\V4;_uu_4pVP4P4pVP\	VPR4R,44VFNpVP4pV'gKVP\	VPR4R,44KP	RRR4\P!V\PR7# \dL�i;i \dK�i;i +'giLY;i)�,N)�dtype�����)
�open�readline�strip�appendr	�split�
ValueErrorr.�asarray�float64)rd�rows�fh�header�lines&    r�load_residual_streamru�s����D�	
�d���r�����$�$�&��	��K�K��f�l�l�3�/��3�4�5��D��:�:�<�D���
����E�$�*�*�S�/�"�"5�6�7��

��:�:�d�"�*�*�-�-���	��	���
��
��
��sR�D�0C(�&D�0C9�6D�(C6�3D�5C6�6D�9D	�D�D	�D�D	)�__doc__�
__future__r�dataclassesr�numpyr.rr%r:rbrurrr�<module>rzsD���#�!���%�%��%���q�h.r