swolfpy_inputdata¶
MC¶
- class swolfpy_inputdata.MC(input_dict, process_name)[source]¶
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])
- Parameters:
input_dict (list) – list of dictionaries that include input data (see the example)
>>> from swolfpy_inputdata 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)]
InputData¶
- class swolfpy_inputdata.InputData(input_data_path, process_name, eval_parameter=False)[source]¶
Bases:
MC
InputData
class reads the input data from the csv file and load them as class attributes. This class is inherited from theMC
class.Main functionalities include: loading data, updating data and generating random number for data based on the defined probability 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 evaluate their real value.
- Update_input(NewData)[source]¶
Get a new DataFrame and update the
data
inInputData
class.- Parameters:
NewData ('pandas.DataFrame') –
CommonData¶
- class swolfpy_inputdata.CommonData(input_data_path=None, process_name='CommonData')[source]¶
Bases:
InputData
- Reprocessing_Index = ['Al', 'Fe', 'OCC', 'Mixed_Paper', 'ONP', 'OFF', 'Fiber_Other', 'Brown_glass', 'Clear_glass', 'Green_glass', 'Mixed_Glass', 'PET', 'HDPE_P', 'HDPE_T', 'LDPE_Film']¶
- Collection_Index = ['RWC', 'SSR', 'DSR', 'MSR', 'LV', 'SSYW', 'SSO', 'SSO_AnF', 'SSO_HC', 'ORG', 'DryRes', 'REC', 'WetRes', 'MRDO', 'SSYWDO', 'MSRDO']¶
- Waste_Pr_Index = ['Bottom_Ash', 'Fly_Ash', 'Unreacted_Ash', 'Separated_Organics', 'Other_Residual', 'Separated_Recyclables', 'RDF']¶
- All_Waste_Pr_Index = ['Bottom_Ash', 'Fly_Ash', 'Unreacted_Ash', 'Separated_Organics', 'Other_Residual', 'Separated_Recyclables', 'RDF', 'RWC', 'SSR', 'DSR', 'MSR', 'LV', 'SSYW', 'SSO', 'SSO_AnF', 'SSO_HC', 'ORG', 'DryRes', 'REC', 'WetRes', 'MRDO', 'SSYWDO', 'MSRDO', 'Al', 'Fe', 'OCC', 'Mixed_Paper', 'ONP', 'OFF', 'Fiber_Other', 'Brown_glass', 'Clear_glass', 'Green_glass', 'Mixed_Glass', 'PET', 'HDPE_P', 'HDPE_T', 'LDPE_Film']¶
- Index = ['Yard_Trimmings_Leaves', 'Yard_Trimmings_Grass', 'Yard_Trimmings_Branches', 'Food_Waste_Vegetable', 'Food_Waste_Non_Vegetable', 'Wood', 'Wood_Other', 'Textiles', 'Rubber_Leather', 'Newsprint', 'Corr_Cardboard', 'Office_Paper', 'Magazines', 'Third_Class_Mail', 'Folding_Containers', 'Paper_Bags', 'Mixed_Paper', 'Paper_Non_recyclable', 'HDPE_Translucent_Containers', 'HDPE_Pigmented_Containers', 'PET_Containers', 'Plastic_Other_1_Polypropylene', 'Plastic_Other_2', 'Mixed_Plastic', 'Plastic_Film', 'Plastic_Non_Recyclable', 'Ferrous_Cans', 'Ferrous_Metal_Other', 'Aluminum_Cans', 'Aluminum_Foil', 'Aluminum_Other', 'Ferrous_Non_recyclable', 'Al_Non_recyclable', 'Glass_Brown', 'Glass_Green', 'Glass_Clear', 'Mixed_Glass', 'Glass_Non_recyclable', 'Misc_Organic', 'Misc_Inorganic', 'E_waste', 'Bottom_Ash', 'Fly_Ash', 'Diapers_and_sanitary_products']¶