wepy.analysis.rates module

Compute rates for warping events.

wepy.analysis.rates.calc_warp_rate(warping_records, total_sampling_time)[source]

Calculate the warping rates for each target in these records.

Takes a set of warping records which are named tuples that have the fields set in the Abstract Base Class for boundary conditions (wepy.boundary_conditions.boundary.Boundary).

Namely these are: weight, target_idx, cycle_idx

Parameters
  • warping_records (list of namedtuples implementing the warping interface) – The list of warping records for which events will be used to calculate the rates.

  • total_sampling_time (float) – The total amount of sampling time that was run to generate these warping records.

Returns

target_weights_rates – A dictionary where each key is for a target present in the warping records and each value is a tuple giving the total accumulated weight in that target boundary, the total flux of probability across the boundary (rate), and the total sampling time it was calculated with,respectively.

Return type

dict of int : tuple of (float, float, float)

See also

wepy.boundary_conditions.boundary.Boundary

for specs on fields necessary for warping_records

wepy.analysis.rates.contig_warp_rates(contig, cycle_time, time_points=None)[source]

Calculate the warping rates for a contig.

Automatically figures out the total sampling time for two options which is set by the ‘time_points’ kwarg.

If ‘time_points’ is None then a rate will only be computed for the end of the simulation.

If ‘time_points’ is Ellipsis then a rate will be computed for each cycle in the entire run.

Will work with runs that used boundary conditions deriving from and preserving the warping record fields from the abstract base class (wepy.boundary_conditions.boundary.Boundary).

Parameters
  • contig (analysis.contig_tree.Contig) – Underlying WepyHDF5 must be open for reading.

  • cycle_time (float) – The sampling time for each cycle.

  • time_points (None or Ellipsis) – Determines how many and which time points are computed for the rates of each run. None, only the end; Ellipsis, all cycles.

Returns

run_target_weights_rates – List where each value of a run is a list of outputs from calc_warping_rate. The number and meaning of the elements of the list depend on the value of the ‘time_points’ kwarg.

Return type

list of dict of int : tuple of (float, float, float)

See also

wepy.analysis.rates.calc_warp_rate

wepy.boundary_conditions.boundary.Boundary

for specs on fields necessary for warping_records