Skip to content
This repository has been archived by the owner on Feb 26, 2025. It is now read-only.

Commit

Permalink
fix IPC
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon committed Nov 21, 2024
1 parent 97eecd2 commit d318f82
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
11 changes: 3 additions & 8 deletions neurots/generate/orientations.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,26 +294,21 @@ def propose(_):

def prob(proposal):
"""Probability function to accept a trunk angle."""
val = nm.morphmath.angle_between_vectors(Y_DIRECTION, proposal)
val = nm.morphmath.angle_between_vectors(ref_dir, proposal)
_prob = get_probability_function(
form=self._parameters[tree_type]["orientation"]["values"]["form"],
with_density=False,
)
params = self._parameters[tree_type]["orientation"]["values"]["params"]
p = _prob(val, *params)

if self._context is not None and self._context.get(
"constraints", []
): # pragma: no cover
if self._context.get("constraints", []): # pragma: no cover
for constraint in self._context["constraints"]:
if "trunk_prob" in constraint:
p *= constraint["trunk_prob"](proposal, self._soma.center)
return p

res = accept_reject(propose, prob, self._rng, max_tries=max_tries)
if ref_dir is not None and res is not None:
res = rotation.rotation_matrix_from_vectors(Y_DIRECTION, ref_dir).dot(res)
return res
return accept_reject(propose, prob, self._rng, max_tries=max_tries)


def spherical_angles_to_orientations(phis, thetas):
Expand Down
3 changes: 0 additions & 3 deletions neurots/generate/section.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ def _propose(self, extra_randomness=0, add_random_component=True):

if add_random_component:
random_component = self.params.randomness * get_random_point(random_generator=self._rng)
# this is needed only to get 100% invariance under y_direction
# if self.context.get("y_rotation") is not None:
# random_component = self.context["y_rotation"].dot(random_component)
if extra_randomness > 0: # pragma: no cover
random_component *= extra_randomness
direction += random_component
Expand Down
2 changes: 1 addition & 1 deletion neurots/generate/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def add_section(
"""
SGrower = section_growers[self.params["metric"]]
context = copy.deepcopy(self.context)
if self.context is not None and "constraints" in self.context: # pragma: no cover
if "constraints" in self.context: # pragma: no cover
context["constraints"] = [
constraint
for constraint in self.context["constraints"]
Expand Down

0 comments on commit d318f82

Please sign in to comment.