@@ -712,12 +712,17 @@ def _resolve_conditions(self):
712712 4. We set the `self._resolved` flag to True if all conditional
713713 priors were added in the right order
714714 """
715- self ._unconditional_keys = [
716- key for key in self .keys () if not hasattr (self [key ], "condition_func" )
717- ]
718- conditional_keys_unsorted = [
719- key for key in self .keys () if hasattr (self [key ], "condition_func" )
720- ]
715+ conditional_keys_unsorted = []
716+ self ._unconditional_keys = []
717+ joint_dists = {}
718+ for key in self .keys ():
719+ if not hasattr (self [key ], "condition_func" ):
720+ self ._unconditional_keys .append (key )
721+ else :
722+ conditional_keys_unsorted .append (key )
723+ if isinstance (self [key ], JointPrior ):
724+ joint_dists [self [key ].dist .distname ] = self [key ].dist .names
725+
721726 self ._conditional_keys = []
722727 for _ in range (len (self )):
723728 for key in conditional_keys_unsorted [:]:
@@ -729,6 +734,12 @@ def _resolve_conditions(self):
729734 if len (conditional_keys_unsorted ) != 0 :
730735 self ._resolved = False
731736
737+ # ensure that all joint dist names are resolved
738+ for names in joint_dists .values ():
739+ for name in names :
740+ if name not in self .sorted_keys :
741+ self ._resolved = False
742+
732743 def _check_conditions_resolved (self , key , sampled_keys ):
733744 """Checks if all required variables have already been sampled so we can sample this key"""
734745 conditions_resolved = True
0 commit comments