Code Document

IncomFlow

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

Inventory

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

Project

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

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)

MC

class PFAS_SAT.MC(input_dict)
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)

Creates MCRandomNumberGenerator and store it in MC.rand attribute

Parameters

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

gen_MC()

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)

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)

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

Parameters

NewData ('pandas.DataFrame') –

setup_MC(seed=None)

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()

CommonData

class PFAS_SAT.CommonData(input_data_path=None)

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)
abstract property ProductsType
abstract calc()
abstract setup_MC(seed=None)
abstract MC_Next()
abstract report()
plot_sankey(**kwargs)
_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 64
_abc_registry = <_weakrefset.WeakSet object>
plot_sankey_report(**kwargs)
SA(inputflow, stream, n, figsize)

Flow

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

Sub-Processes

Created on Thu Jul 23 19:18:05 2020

@author: msmsa

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