tsnet.network package

Submodules

tsnet.network.control module

This file to define Fragility Curves

class tsnet.network.control.FragilityCurve[source]

Bases: object

Fragility Curve class.

add_state(name, priority=0, distribution={})[source]

Add a damage state distribution

Parameters:
  • name (string) – Name of the damage state
  • priority (int) – Damage state priority
  • distribution (dict, key = string, value = scipy.stats statistical function) – ‘Default’ can be used to specificy all location
states()[source]

A generator to iterate over all states, in order of priority :returns: :rtype: state_name, state

get_priority_map()[source]

Returns a dictonary of state name and priority number.

cdf_probability(x)[source]

Return the CDF probability for each state, based on the value of x

Parameters:x (pd.Series) – Control variable for each element
Returns:Pr – Probability of exceeding a damage state
Return type:pd.Dataframe
sample_damage_state(Pr)[source]

Sample the damage state using a uniform random variable

Parameters
Pr : pd.Dataframe
Probability of exceeding a damage state
Returns:damage_state – The damage state of each element
Return type:pd.Series
class tsnet.network.control.State(name, priority=0.0, distribution={})[source]

Bases: object

Parameters:
  • name (string) – Name of the damage state
  • priority (int) –
  • distribution (dict) –
tsnet.network.control.plot_fragility_curve(FC, fill=True, key='Default', title='Fragility curve', xmin=0, xmax=250, npoints=100, xlabel='x', ylabel='Prob. of exceedance', figsize=[10, 6])[source]

Plot fragility curve.

Parameters:
  • FC (FragilityCurve object) – Fragility curve
  • fill (bool (optional)) – If true, fill area under the curve (default = True)
  • key (string (optional)) – Fragility curve state distribution key (default = ‘Default’)
  • title (string (optional)) – Plot title
  • xmin (float (optional)) – X axis minimum (default = 0)
  • xmax (float (optional)) – X axis maximum (default = 1)
  • npoints (int (optional)) – Number of points (default = 100)
  • xlabel (string (optional)) – X axis label (default = ‘x’)
  • ylabel (string (optional)) – Y axis label (default = ‘Probability of exceedance’)
  • figsize (list (optional)) – Figure size (default = [10,5])

tsnet.network.discretize module

This file to for correction factor

tsnet.network.discretize.correction_factor(pipe_characteristics, M_type=None, soil_type=None, age=None)[source]

tsnet.network.model module

This file to define Fragility Curves

tsnet.network.model.plot_fragility_curve(FC, fill=True, key='Default', title='', xmin=0, xmax=250, npoints=100, xlabel='x', ylabel='Probability of exceedance', figsize=[10, 6])[source]

Plot fragility curve.

Parameters:
  • FC (FragilityCurve object) – Fragility curve
  • fill (bool (optional)) – If true, fill area under the curve (default = True)
  • key (string (optional)) – Fragility curve state distribution key (default = ‘Default’)
  • title (string (optional)) – Plot title
  • xmin (float (optional)) – X axis minimum (default = 0)
  • xmax (float (optional)) – X axis maximum (default = 1)
  • npoints (int (optional)) – Number of points (default = 100)
  • xlabel (string (optional)) – X axis label (default = ‘x’)
  • ylabel (string (optional)) – Y axis label (default = ‘Probability of exceedance’)
  • figsize (list (optional)) – Figure size (default = [10,5])

tsnet.network.topology module

Module contents

The tsnet.network package contains methods to define 1. a water network geometry, 2. network topology, 3. network control, and 4 .spatial and temporal discretization.