FairShip
Loading...
Searching...
No Matches
split_provenance.Desplit Class Reference

Public Member Functions

 __init__ (self, prov, rng)
 keeps (self, i, t_obs=None)
 keeps_point (self, i, t)
 analog_weight (self, i)

Public Attributes

 prov = prov
dict choice = {}
 keeps_track = np.array([self.keeps(i) for i in range(len(prov))], dtype=bool)

Protected Member Functions

 _survives_to (self, s, branch_time, branch_weight)

Detailed Description

One analog-like realisation of a split event.

For every split set one outcome is drawn with probability proportional to
its weight: one of the stored decay alternatives, or "something else" (a
decay whose clones were pruned, or no decay at all). In the latter case a
second number decides how far along the survivor line the track got, so
that survivor-line tracks are kept consistently. A kept track stands for
the event with the weight of its primary, analog_weight(i).

Definition at line 223 of file split_provenance.py.

Constructor & Destructor Documentation

◆ __init__()

split_provenance.Desplit.__init__ ( self,
prov,
rng )

Definition at line 234 of file split_provenance.py.

234 def __init__(self, prov, rng):
235 self.prov = prov
236 self.choice = {}
237 for s, e in prov.sets.items():
238 u = rng.random() * e["W"]
239 chosen, cum = None, 0.0
240 for c in e["decays"]:
241 if u < cum + prov.weight[c]:
242 chosen = c
243 break
244 cum += prov.weight[c]
245 # Given no stored alternative, u - stored is uniform on [0, W - stored).
246 self.choice[s] = (chosen, u - e["stored"])
247 self.keeps_track = np.array([self.keeps(i) for i in range(len(prov))], dtype=bool)
248

Member Function Documentation

◆ _survives_to()

split_provenance.Desplit._survives_to ( self,
s,
branch_time,
branch_weight )
protected

Definition at line 249 of file split_provenance.py.

249 def _survives_to(self, s, branch_time, branch_weight):
250 prov = self.prov
251 chosen, v = self.choice[s]
252 if chosen is not None:
253 return branch_time < prov.start_t[chosen]
254 later = sum(prov.weight[c] for c in prov.sets[s]["decays"] if prov.start_t[c] > branch_time)
255 return v < branch_weight - later
256

◆ analog_weight()

split_provenance.Desplit.analog_weight ( self,
i )
Weight a kept track carries in the de-split event: that of its primary.

Definition at line 272 of file split_provenance.py.

272 def analog_weight(self, i):
273 """Weight a kept track carries in the de-split event: that of its primary."""
274 return self.prov.initial_weight(self.prov.lineage(i)[-1])

◆ keeps()

split_provenance.Desplit.keeps ( self,
i,
t_obs = None )
Whether track i exists, or for t_obs its observation at that time.

Definition at line 257 of file split_provenance.py.

257 def keeps(self, i, t_obs=None):
258 """Whether track i exists, or for t_obs its observation at that time."""
259 links = self.prov._links(i, math.inf, at_start=True) if t_obs is None else self.prov._links(i, t_obs)
260 for s, link in links.items():
261 if link.role == DECAY:
262 if self.choice[s][0] != link.member:
263 return False
264 elif not self._survives_to(s, link.branch_time, link.branch_weight):
265 return False
266 return True
267

◆ keeps_point()

split_provenance.Desplit.keeps_point ( self,
i,
t )
Whether a hit of track i at time t exists (matters for survivor-line tracks).

Definition at line 268 of file split_provenance.py.

268 def keeps_point(self, i, t):
269 """Whether a hit of track i at time t exists (matters for survivor-line tracks)."""
270 return self.keeps(i, t_obs=t)
271

Member Data Documentation

◆ choice

dict split_provenance.Desplit.choice = {}

Definition at line 236 of file split_provenance.py.

◆ keeps_track

split_provenance.Desplit.keeps_track = np.array([self.keeps(i) for i in range(len(prov))], dtype=bool)

Definition at line 247 of file split_provenance.py.

◆ prov

split_provenance.Desplit.prov = prov

Definition at line 235 of file split_provenance.py.


The documentation for this class was generated from the following file: