@@ -175,17 +175,17 @@ def test_sia_standard_example_has_repertoires(self, s):
175175 # Check cause repertoire exists and has required attributes
176176 assert result .cause is not None , "SIA missing cause repertoire"
177177 assert hasattr (result .cause , "phi" ), "Cause RIA missing phi attribute"
178- assert hasattr (
179- result . cause , " mechanism"
180- ), "Cause RIA missing mechanism attribute"
178+ assert hasattr (result . cause , "mechanism" ), (
179+ "Cause RIA missing mechanism attribute "
180+ )
181181 assert hasattr (result .cause , "purview" ), "Cause RIA missing purview attribute"
182182
183183 # Check effect repertoire exists and has required attributes
184184 assert result .effect is not None , "SIA missing effect repertoire"
185185 assert hasattr (result .effect , "phi" ), "Effect RIA missing phi attribute"
186- assert hasattr (
187- result . effect , " mechanism"
188- ), "Effect RIA missing mechanism attribute"
186+ assert hasattr (result . effect , "mechanism" ), (
187+ "Effect RIA missing mechanism attribute "
188+ )
189189 assert hasattr (result .effect , "purview" ), "Effect RIA missing purview attribute"
190190
191191 def test_sia_standard_example_has_system_state (self , s ):
@@ -242,9 +242,9 @@ def test_sia_standard_example_partition_type(self, s):
242242
243243 # System has phi > 0, so should have non-null partition
244244 assert result .phi > 0 , "Standard example should have phi > 0"
245- assert not isinstance (
246- result . partition , NullCut
247- ), "Irreducible system has NullCut partition"
245+ assert not isinstance (result . partition , NullCut ), (
246+ "Irreducible system has NullCut partition"
247+ )
248248
249249 def test_reducible_system_has_null_partition (self , reducible ):
250250 """Reducible system should have null partition.
@@ -254,12 +254,12 @@ def test_reducible_system_has_null_partition(self, reducible):
254254 """
255255 result = reducible .sia ()
256256
257- assert isinstance (
258- result , NullSystemIrreducibilityAnalysis
259- ), "Reducible system should return NullSIA"
260- assert isinstance (
261- result . partition , NullCut
262- ), "Reducible system should have NullCut partition"
257+ assert isinstance (result , NullSystemIrreducibilityAnalysis ), (
258+ "Reducible system should return NullSIA"
259+ )
260+ assert isinstance (result . partition , NullCut ), (
261+ "Reducible system should have NullCut partition"
262+ )
263263 assert result .phi == 0.0 , "Reducible system should have phi=0"
264264
265265 def test_empty_subsystem_has_null_partition (self , s_empty ):
@@ -270,12 +270,12 @@ def test_empty_subsystem_has_null_partition(self, s_empty):
270270 """
271271 result = s_empty .sia ()
272272
273- assert isinstance (
274- result , NullSystemIrreducibilityAnalysis
275- ), "Empty subsystem should return NullSIA"
276- assert isinstance (
277- result . partition , NullCut
278- ), "Empty subsystem should have NullCut partition"
273+ assert isinstance (result , NullSystemIrreducibilityAnalysis ), (
274+ "Empty subsystem should return NullSIA"
275+ )
276+ assert isinstance (result . partition , NullCut ), (
277+ "Empty subsystem should have NullCut partition"
278+ )
279279 assert result .phi == 0.0 , "Empty subsystem should have phi=0"
280280
281281
@@ -419,14 +419,18 @@ def _noisy_copy_subsystem(p, state):
419419 Each node copies the other with probability p (LOLI state ordering).
420420 """
421421 import numpy as np
422- from pyphi import Network , Subsystem
423-
424- tpm = np .array ([
425- [1 - p , 1 - p ], # (0,0)
426- [1 - p , p ], # (1,0)
427- [p , 1 - p ], # (0,1)
428- [p , p ], # (1,1)
429- ])
422+
423+ from pyphi import Network
424+ from pyphi import Subsystem
425+
426+ tpm = np .array (
427+ [
428+ [1 - p , 1 - p ], # (0,0)
429+ [1 - p , p ], # (1,0)
430+ [p , 1 - p ], # (0,1)
431+ [p , p ], # (1,1)
432+ ]
433+ )
430434 cm = np .array ([[0 , 1 ], [1 , 0 ]])
431435 network = Network (tpm , cm = cm , node_labels = ["A" , "B" ])
432436 return Subsystem (network , state )
@@ -438,7 +442,8 @@ def test_phi_capped_by_ii(self):
438442 so ii(s) ≈ 0.644 caps phi below GID(MIP).
439443 """
440444 from pyphi .direction import Direction
441- from pyphi .new_big_phi import sia , system_intrinsic_information
445+ from pyphi .new_big_phi import sia
446+ from pyphi .new_big_phi import system_intrinsic_information
442447
443448 subsystem = self ._noisy_copy_subsystem (0.8 , (1 , 1 ))
444449 with config .override (** self .II_CONFIG ):
@@ -494,9 +499,7 @@ def test_gid_distance_unaffected(self, s):
494499
495500 # Default config uses GENERALIZED_INTRINSIC_DIFFERENCE
496501 result = sia (s )
497- assert float (result .phi ) == pytest .approx (
498- EXPECTED_PHI_VALUES ["s" ], abs = 1e-9
499- )
502+ assert float (result .phi ) == pytest .approx (EXPECTED_PHI_VALUES ["s" ], abs = 1e-9 )
500503
501504
502505# ============================================================================
@@ -522,7 +525,9 @@ class TestPaperExamples:
522525 def _monad_subsystem (p ):
523526 """Single-node system that stays in current state with probability p."""
524527 import numpy as np
525- from pyphi import Network , Subsystem
528+
529+ from pyphi import Network
530+ from pyphi import Subsystem
526531
527532 tpm = np .array ([[1 - p ], [p ]])
528533 cm = np .array ([[1 ]])
@@ -536,6 +541,7 @@ def test_monad_intrinsic_information(self):
536541 The paper reports φ_s = 0.427 (Figure 2C).
537542 """
538543 import numpy as np
544+
539545 from pyphi .new_big_phi import system_intrinsic_information
540546
541547 p = 0.744
@@ -557,17 +563,17 @@ def test_monad_intrinsic_information(self):
557563 "p,i_diff_expected,i_spec_expected" ,
558564 [
559565 (0.744 , 0.426625 , 0.426591 ), # crossover point (Figure 2C)
560- (0.9 , 0.152003 , 0.763197 ), # high determinism
561- (0.6 , 0.736966 , 0.157821 ), # high noise
566+ (0.9 , 0.152003 , 0.763197 ), # high determinism
567+ (0.6 , 0.736966 , 0.157821 ), # high noise
562568 ],
563569 )
564570 def test_monad_i_diff_i_spec_tradeoff (self , p , i_diff_expected , i_spec_expected ):
565571 """Verify i_diff and i_spec values across the tradeoff curve (Figure 2C).
566572
567573 i_diff = -log2(p), i_spec = p*log2(2p) for a monad in its ON state.
568574 """
569- import numpy as np
570- from pyphi import direction , metrics
575+ from pyphi import direction
576+ from pyphi import metrics
571577 from pyphi .new_big_phi import system_intrinsic_information
572578
573579 subsystem = self ._monad_subsystem (p )
0 commit comments