def set_hypotheses(head, config): # Formulate a VEP hypothesis manually hyp_builder = HypothesisBuilder(head.connectivity.number_of_regions, config) # .set_normalize(0.99) # Regions of Pathological Excitability hypothesis: x0_indices = [2, 24] x0_values = [0.01, 0.01] hyp_builder.set_x0_hypothesis(x0_indices, x0_values) # Regions of Model Epileptogenicity hypothesis: e_indices = [1, 26] # e_indices = list(range(head.connectivity.number_of_regions)) # e_indices.remove(2) # e_indices.remove(25) # e_values = np.zeros((head.connectivity.number_of_regions,)) + 0.01 # e_values[[1, 26]] = 0.99 # e_values = np.delete(e_values, [2, 25]).tolist() e_values = np.array([1.5, 1.25]) # np.array([0.99] * 2) hyp_builder.set_e_hypothesis(e_indices, e_values) # Regions of Connectivity hypothesis: # w_indices = [] # [(0, 1), (0, 2)] # w_values = [] # [0.5, 2.0] # hypo_builder.set_w_indices(w_indices).set_w_values(w_values) hypothesis1 = hyp_builder.build_hypothesis() e_indices = [1, 26] # [1, 2, 25, 26] hypothesis2 = hyp_builder.build_hypothesis_from_file( "clinical_hypothesis_postseeg", e_indices) # Change something manually if necessary # hypothesis2.x0_values = [0.01, 0.01] return (hypothesis1, hypothesis2)
def test_build_empty_hypothesis(self): hypo_builder = HypothesisBuilder(config=self.config) hypo = hypo_builder.build_hypothesis() assert hypo.name == "Hypothesis" assert hypo.number_of_regions == 0 assert len(hypo.x0_indices) == 0 assert len(hypo.x0_values) == 0 assert len(hypo.e_indices) == 0 assert len(hypo.e_values) == 0 assert len(hypo.w_indices) == 0 assert len(hypo.w_values) == 0 assert len(hypo.lsa_propagation_indices) == 0 assert len(hypo.lsa_propagation_strengths) == 0
def test_build_hypothesis_by_user_preferences(self): hypo_builder = HypothesisBuilder(76, self.config).set_x0_hypothesis( [1, 2, 3], [1, 1, 1]).set_e_hypothesis([10, 11], [1, 1]).set_normalize(0.90) hypo = hypo_builder.build_hypothesis() assert hypo.name == "e_x0_Hypothesis" assert hypo.number_of_regions == 76 assert len(hypo.x0_indices) == 3 assert len(hypo.x0_values) == 3 assert len(hypo.e_indices) == 2 assert len(hypo.e_values) == 2 assert len(hypo.w_indices) == 0 assert len(hypo.w_values) == 0 assert len(hypo.lsa_propagation_indices) == 0 assert len(hypo.lsa_propagation_strengths) == 0
def test_build_lsa_hypothesis(self): hypo_builder = HypothesisBuilder(76, self.config).set_x0_hypothesis([1, 2], [1, 1]) hypo = hypo_builder.build_hypothesis() lsa_hypo = hypo_builder.set_attributes_based_on_hypothesis( hypo).set_lsa_propagation([3, 4], [0.5, 1]).build_lsa_hypothesis() assert lsa_hypo.name == "LSA_x0_Hypothesis" assert lsa_hypo.number_of_regions == 76 assert len(lsa_hypo.x0_indices) == 2 assert len(lsa_hypo.x0_values) == 2 assert len(lsa_hypo.e_indices) == 0 assert len(lsa_hypo.e_values) == 0 assert len(lsa_hypo.w_indices) == 0 assert len(lsa_hypo.w_values) == 0 assert len(lsa_hypo.lsa_propagation_indices) == 2 assert len(lsa_hypo.lsa_propagation_strengths) == 2