Code Document

IncomFlow

class PFAS_SAT.IncomFlow(input_data_path=None)[source]
set_flow(flow_name, mass_flow)[source]
calc()[source]
setup_MC(seed=None)[source]
MC_Next()[source]
report()[source]

Inventory

class PFAS_SAT.Inventory[source]
add(Flow_name, Source, Target, flow)[source]
report_Water()[source]
report_Soil()[source]
report_Air()[source]
report_Destroyed()[source]
report_Stored()[source]
report_InjectionWell()[source]
report_ReactivatedGAC()[source]
clear()[source]
report(TypeOfPFAS='All')[source]
check_PFAS_balance(Start_flow, pop_up=None)[source]

Project

class PFAS_SAT.Project(Inventory, CommonData, ProcessModels=None, pop_up=None)[source]
_find_destination(product)[source]
get_process_set(InputFlow)[source]
set_process_set(ProcessSet)[source]
get_flow_params(normalize=True)[source]
set_flow_params(FlowParams)[source]
setup_network(Cut_Off=0.001)[source]
static calc(product, source, processmodel, FlowParams, Inventory, CuttOff, ProcessNameRef, Treatment_options, pop_up=None)[source]
setup_MC(InputFlow_object, seed=None)[source]
MC_Next()[source]
MC_Run(n, TypeOfPFAS='All', signal=None)[source]
Reset_static_Data()[source]
Result_to_DF(results)[source]
setup_SA(InputFlow_object)[source]
SensitivityAnalysis(Model, Category, Paramter, Start, Stop, Nstep, TypeOfPFAS='All')[source]
plot_network(view=True, show_vals=True, all_flow=True)[source]

To render the generated DOT source code, you also need to install Graphviz.

..note:: Make sure that the directory containing the dot executable is on your systems path.

plot_sankey(view=True, filename=None)[source]

MC

class PFAS_SAT.MC(input_dict)[source]
Parameters

input_dict (list) – list of dictionaries that include input data (see the example)

This class generates random number for Monte-Carlo simulations. This class is the interface to stats_arrays package.

The example below is showing the usage of stats_arrays.

Example

>>> from stats_arrays import *
>>> my_variables = UncertaintyBase.from_dicts(
...     {'loc': 2, 'scale': 0.5, 'uncertainty_type': NormalUncertainty.id},
...     {'loc': 1.5, 'minimum': 0, 'maximum': 10, 'uncertainty_type': TriangularUncertainty.id}
... )
>>> my_variables
array([(2.0, 0.5, nan, nan, nan, False, 3),
       (1.5, nan, nan, 0.0, 10.0, False, 5)],
    dtype=[('loc', '<f8'), ('scale', '<f8'), ('shape', '<f8'),
           ('minimum', '<f8'), ('maximum', '<f8'), ('negative', '?'),
           ('uncertainty_type', 'u1')])
>>> my_rng = MCRandomNumberGenerator(my_variables)
>>> my_rng.next()
array([ 2.74414022,  3.54748507])
>>> from PFAS_SAT import MC
>>> input_dict={'Cat1': {'Par1': {'Name': 'Name1','amount': 1.0,'unit': 'Unit1',
...                                 'uncertainty_type': 3,'loc': 1,'scale':0.2 ,'shape': None,
...                                 'minimum': None,'maximum': None,
...                                 'Reference': None,'Comment': None},
...                     'Par2': {'Name': 'Name2','amount': 1.5,'unit': 'Unit2',
...                                 'uncertainty_type': 3,'loc': 1.5,'scale': 0.4,'shape': None,
...                                 'minimum': None,'maximum': None,
...                                 'Reference': None,'Comment': None}}}
>>> test_MC = MC(input_dict)
>>> test_MC.setup_MC()
>>> test_MC.gen_MC()
[(('Cat1', 'Par1'), 1.0554408376879747),
 (('Cat1', 'Par2'), 1.9366617123732333)]
setup_MC(seed=None)[source]

Creates MCRandomNumberGenerator and store it in MC.rand attribute

Parameters

seed (int, optional) – seed for random number generation

gen_MC()[source]

Generate random numbers and update data. It also returns a list of tuples include the name of parameter and generted number.

Returns

List of tuples include the name of parameter and generted number: [((parameter_category,parameter),generated_number)]

Return type

list

InputData

class PFAS_SAT.InputData(input_data_path, eval_parameter=False)[source]

Bases: PFAS_SAT.MC.MC

InputData class reads the input data from the csv file and load them as class attributes. This class is inherited from the MC class.

Main functionalities include: loading data, updating data and generating random number for data based on the defined probabiliy distributions.

Parameters
  • input_data_path (str) – absolute path to the input data file

  • eval_parameter (bool, optional) – If the parameters are tuple instead of str, it will evalute their real value.

Update_input(NewData)[source]

Get a new DataFrame and update the data in InputData class.

Parameters

NewData ('pandas.DataFrame') –

setup_MC(seed=None)[source]

Initialize the parent class (MC) and create MCRandomNumberGenerator based on the data for uncertainty distributions via calling MC.setupMC() method.

Parameters

seed (int, optional) – seed for random number generation

See also

Class_MC

reset_static_vals()[source]

CommonData

class PFAS_SAT.CommonData(input_data_path=None)[source]

Bases: PFAS_SAT.InputData.InputData

WasteMaterials = ['FoodWaste', 'Compost', 'ADLiquids', 'ADSolids', 'MSW', 'CombustionResiduals', 'CompostResiduals', 'ContaminatedSoil', 'C_DWaste', 'AFFF', 'LFLeachate', 'ContaminatedWater', 'ContactWater', 'WWTEffluent', 'RawWWTSolids', 'DewateredWWTSolids', 'DriedWWTSolids', 'WWTScreenRejects', 'SCWOSteam', 'SCWOSlurry', 'SpentGAC', 'ROConcentrate', 'StabilizedSoil', 'SpentIER']
PFAS_Index = ['PFOA', 'PFOS', 'PFBA', 'PFPeA', 'PFHxA', 'PFHpA', 'PFNA', 'PFDA', 'PFBS', 'PFHxS']

Process Model

class PFAS_SAT.ProcessModel(CommonDataObjct, InventoryObject)[source]
abstract property ProductsType
abstract calc()[source]
abstract setup_MC(seed=None)[source]
abstract MC_Next()[source]
abstract report()[source]
plot_sankey(**kwargs)[source]
_abc_impl = <_abc_data object>
plot_sankey_report(**kwargs)[source]
SA(inputflow, stream, n, figsize)[source]

Flow

class PFAS_SAT.Flow(ZeroFlow=False, **kwargs)[source]
set_flow(mass_flow, ts_cont=None, C_cont=None, PFAS_cont=None, bulk_dens=None, **kwargs)[source]
get_Ccont()[source]
get_TScont()[source]
get_Moistcont()[source]
get_PFAScont()[source]
set_FlowType(FlowType)[source]
report()[source]

Sub-Processes

Created on Thu Jul 23 19:18:05 2020

@author: msmsa

PFAS_SAT.SubProcesses.mix(*args)[source]
PFAS_SAT.SubProcesses.split(InputFlow, **kwargs)[source]
PFAS_SAT.SubProcesses.solid_water_partition(mixture, water_vol, LogPartCoef_data)[source]
PFAS_SAT.SubProcesses.soil_sorption(mixture, LogPartCoef_data, Leachate_vol, Runoff_vol)[source]
PFAS_SAT.SubProcesses.aerobic_composting(mixture, ProcessData, LogPartCoef_data, PrecipitationData)[source]
PFAS_SAT.SubProcesses.curing(mixture, ProcessData, LogPartCoef_data, PrecipitationData)[source]
PFAS_SAT.SubProcesses.landfil_sorption(mixture, LogPartCoef_data, LF_Leachate_Vol, Leachate_Vol)[source]
PFAS_SAT.SubProcesses.dewatering(mixture, final_sol_cont, cont_PFAS_water, is_active=True)[source]
PFAS_SAT.SubProcesses.drying(mixture, dryer_param, cont_PFAS_water)[source]
PFAS_SAT.SubProcesses.stabilization(mixture, LogPartCoef_data, Additive_LogPartCoef, Additive_mass, Leachate_vol, Runoff_vol)[source]
PFAS_SAT.SubProcesses.AddWater(InputFlow, Final_Moist_Cont)[source]