flodym

Getting Started

  • flodym
  • Thanks
  • Installation
  • Why choose flodym?

HOWTOs

  • About the HOWTOs
    • Scope
    • flodym Design: Different levels of integration
  • Primer: pydantic
  • Primer: The MFA system parts
    • Flows
    • Processes
    • Parameters
    • Stocks
    • DimensionSet
  • Dimensions and DimensionSets
    • Dimensions
    • DimensionSets
  • Working with FlodymArrays
    • Initializing arrays
    • Math operations
      • With scalars
      • Using just the values array
    • Computing values of existing arrays, such as flows
    • Slicing
    • Operation rules summary
      • Caveat
  • Work with an MFA System
    • Write your own subclass
      • Initialize an MFA System
    • Processes
      • Work with the system
      • Generate attributes from Definition objects
  • Stocks
    • Input requirements
    • Simple, from constructor
    • Dynamic Stock Models (DSM)
    • StockDefinition objects
  • Data input
    • From DataFrame
    • From file: CSV & Excel
    • MFASystem from_excel() and from_csv
    • Write your own customized subclasses
      • of DimensionReader and ParameterReader
      • of DataReader
      • Using CompoundDataReader
  • Export and Plotting
    • Export
      • Array to data frame
      • MFA system to dictionary and pickle file
    • To CSV
    • Sankey plotting
    • Plotting yourself
    • Array plotting using ArrayPlotter

Examples

  • About the examples
  • Example 1. System with two processes, two parameters, one material.
    • 1. Load flodym and other useful packages
    • 2. Load data
    • 3. Define flows and initialise them with zero values.
    • 4. Define the MFA System equations
  • Example 2. Alloying elements in recycling.
    • 1. Load flodym and other useful packages
    • 2. Define the data requirements, flows, stocks and MFA system equations
    • 4. Initialize the MFA system, load data and compute
    • 5. Results
  • Example 3. Dynamic Stock modelling
    • 1. Load flodym and useful packages
    • 2. Define system dimensions and load data
    • 3. Perform dynamic stock modelling
    • 4. Take a look at the results
  • Example 5. Estimating the material content of the global vehicle fleet
    • 1. Load flodym and other useful packages
    • 2. Define the data requirements, flows, stocks and MFA system equations
    • 3. Define our data reader
    • 4. Put everything together
    • 5. Improve the model
    • 6. Answer research questions

API Reference

  • MFA System
    • MFASystem
      • MFASystem.dims
      • MFASystem.flows
      • MFASystem.parameters
      • MFASystem.processes
      • MFASystem.stocks
      • MFASystem.check_mass_balance()
      • MFASystem.compute()
      • MFASystem.from_csv()
      • MFASystem.from_data_reader()
      • MFASystem.from_excel()
      • MFASystem.get_new_array()
    • make_empty_flows()
    • make_empty_stocks()
    • make_processes()
  • Definition Objects
    • MFADefinition
      • MFADefinition.dimensions
      • MFADefinition.flows
      • MFADefinition.parameters
      • MFADefinition.processes
      • MFADefinition.stocks
      • MFADefinition.check_dimension_letters
    • FlowDefinition
      • FlowDefinition.dim_letters
      • FlowDefinition.from_process_name
      • FlowDefinition.name_override
      • FlowDefinition.to_process_name
      • FlowDefinition.check_dimensions
    • StockDefinition
      • StockDefinition.dim_letters
      • StockDefinition.lifetime_model_class
      • StockDefinition.name
      • StockDefinition.process_name
      • StockDefinition.subclass
      • StockDefinition.time_letter
      • StockDefinition.check_dimensions
      • StockDefinition.check_lifetime_model
    • ParameterDefinition
      • ParameterDefinition.dim_letters
      • ParameterDefinition.name
      • ParameterDefinition.check_dimensions
    • DimensionDefinition
      • DimensionDefinition.dtype
      • DimensionDefinition.letter
      • DimensionDefinition.name
  • Data Readers
    • DataReader
    • CompoundDataReader
    • DimensionReader
    • ParameterReader
    • CSVDimensionReader
    • CSVParameterReader
    • ExcelDimensionReader
    • ExcelParameterReader
  • Dimension and DimensionSet
    • Dimension
      • Dimension.dtype
      • Dimension.items
      • Dimension.letter
      • Dimension.name
      • Dimension.from_df()
      • Dimension.from_np()
      • Dimension.index()
      • Dimension.is_subset()
      • Dimension.is_superset()
      • Dimension.items_have_datatype
      • Dimension.len
    • DimensionSet
      • DimensionSet.dim_list
      • DimensionSet.difference_with()
      • DimensionSet.drop()
      • DimensionSet.expand_by()
      • DimensionSet.get_subset()
      • DimensionSet.index()
      • DimensionSet.intersect_with()
      • DimensionSet.no_repeated_dimensions
      • DimensionSet.replace()
      • DimensionSet.shape()
      • DimensionSet.size()
      • DimensionSet.union_with()
      • DimensionSet.letters
      • DimensionSet.names
      • DimensionSet.ndim
      • DimensionSet.string
  • FlodymArrays
    • FlodymArray
      • FlodymArray.dims
      • FlodymArray.name
      • FlodymArray.values
      • FlodymArray.abs()
      • FlodymArray.apply()
      • FlodymArray.cast_to()
      • FlodymArray.cast_values_to()
      • FlodymArray.cumsum()
      • FlodymArray.from_df()
      • FlodymArray.from_dims_superset()
      • FlodymArray.get_shares_over()
      • FlodymArray.maximum()
      • FlodymArray.minimum()
      • FlodymArray.set_values()
      • FlodymArray.set_values_from_df()
      • FlodymArray.sign()
      • FlodymArray.split()
      • FlodymArray.sum_over()
      • FlodymArray.sum_to()
      • FlodymArray.sum_values()
      • FlodymArray.sum_values_over()
      • FlodymArray.sum_values_to()
      • FlodymArray.to_df()
      • FlodymArray.validate_values
      • FlodymArray.shape
    • Flow
      • Flow.dims
      • Flow.from_process
      • Flow.name
      • Flow.to_process
      • Flow.values
      • Flow.abs()
      • Flow.apply()
      • Flow.cast_to()
      • Flow.cast_values_to()
      • Flow.cumsum()
      • Flow.from_df()
      • Flow.from_dims_superset()
      • Flow.get_shares_over()
      • Flow.maximum()
      • Flow.minimum()
      • Flow.set_values()
      • Flow.set_values_from_df()
      • Flow.sign()
      • Flow.split()
      • Flow.sum_over()
      • Flow.sum_to()
      • Flow.sum_values()
      • Flow.sum_values_over()
      • Flow.sum_values_to()
      • Flow.to_df()
      • Flow.validate_values
      • Flow.from_process_id
      • Flow.shape
      • Flow.to_process_id
    • StockArray
      • StockArray.dims
      • StockArray.name
      • StockArray.values
      • StockArray.abs()
      • StockArray.apply()
      • StockArray.cast_to()
      • StockArray.cast_values_to()
      • StockArray.cumsum()
      • StockArray.from_df()
      • StockArray.from_dims_superset()
      • StockArray.get_shares_over()
      • StockArray.maximum()
      • StockArray.minimum()
      • StockArray.set_values()
      • StockArray.set_values_from_df()
      • StockArray.sign()
      • StockArray.split()
      • StockArray.sum_over()
      • StockArray.sum_to()
      • StockArray.sum_values()
      • StockArray.sum_values_over()
      • StockArray.sum_values_to()
      • StockArray.to_df()
      • StockArray.validate_values
      • StockArray.shape
    • Parameter
      • Parameter.dims
      • Parameter.name
      • Parameter.values
      • Parameter.abs()
      • Parameter.apply()
      • Parameter.cast_to()
      • Parameter.cast_values_to()
      • Parameter.cumsum()
      • Parameter.from_df()
      • Parameter.from_dims_superset()
      • Parameter.get_shares_over()
      • Parameter.maximum()
      • Parameter.minimum()
      • Parameter.set_values()
      • Parameter.set_values_from_df()
      • Parameter.sign()
      • Parameter.split()
      • Parameter.sum_over()
      • Parameter.sum_to()
      • Parameter.sum_values()
      • Parameter.sum_values_over()
      • Parameter.sum_values_to()
      • Parameter.to_df()
      • Parameter.validate_values
      • Parameter.shape
    • process_names_with_arrow()
    • process_names_no_spaces()
    • process_ids()
    • make_empty_flows()
  • Stocks and Lifetime Models
    • Stock
      • Stock.dims
      • Stock.inflow
      • Stock.name
      • Stock.outflow
      • Stock.process
      • Stock.stock
      • Stock.time_letter
      • Stock.check_stock_balance()
      • Stock.compute()
      • Stock.get_stock_balance()
      • Stock.to_stock_type()
      • Stock.validate_stock_arrays
      • Stock.validate_time_first_dim
      • Stock.process_id
      • Stock.shape
    • SimpleFlowDrivenStock
      • SimpleFlowDrivenStock.dims
      • SimpleFlowDrivenStock.inflow
      • SimpleFlowDrivenStock.name
      • SimpleFlowDrivenStock.outflow
      • SimpleFlowDrivenStock.process
      • SimpleFlowDrivenStock.stock
      • SimpleFlowDrivenStock.time_letter
      • SimpleFlowDrivenStock.check_stock_balance()
      • SimpleFlowDrivenStock.compute()
      • SimpleFlowDrivenStock.get_stock_balance()
      • SimpleFlowDrivenStock.to_stock_type()
      • SimpleFlowDrivenStock.validate_stock_arrays
      • SimpleFlowDrivenStock.validate_time_first_dim
      • SimpleFlowDrivenStock.process_id
      • SimpleFlowDrivenStock.shape
    • InflowDrivenDSM
      • InflowDrivenDSM.dims
      • InflowDrivenDSM.inflow
      • InflowDrivenDSM.lifetime_model
      • InflowDrivenDSM.name
      • InflowDrivenDSM.outflow
      • InflowDrivenDSM.process
      • InflowDrivenDSM.stock
      • InflowDrivenDSM.time_letter
      • InflowDrivenDSM.check_stock_balance()
      • InflowDrivenDSM.compute()
      • InflowDrivenDSM.compute_outflow_by_cohort()
      • InflowDrivenDSM.compute_stock_by_cohort()
      • InflowDrivenDSM.get_stock_balance()
      • InflowDrivenDSM.init_cohort_arrays
      • InflowDrivenDSM.init_lifetime_model
      • InflowDrivenDSM.to_stock_type()
      • InflowDrivenDSM.validate_stock_arrays
      • InflowDrivenDSM.validate_time_first_dim
      • InflowDrivenDSM.process_id
      • InflowDrivenDSM.shape
    • StockDrivenDSM
      • StockDrivenDSM.dims
      • StockDrivenDSM.inflow
      • StockDrivenDSM.lifetime_model
      • StockDrivenDSM.name
      • StockDrivenDSM.outflow
      • StockDrivenDSM.process
      • StockDrivenDSM.stock
      • StockDrivenDSM.time_letter
      • StockDrivenDSM.check_stock_balance()
      • StockDrivenDSM.compute()
      • StockDrivenDSM.compute_inflow_and_outflow()
      • StockDrivenDSM.get_stock_balance()
      • StockDrivenDSM.inflow_from_balance()
      • StockDrivenDSM.init_cohort_arrays
      • StockDrivenDSM.init_lifetime_model
      • StockDrivenDSM.to_stock_type()
      • StockDrivenDSM.validate_stock_arrays
      • StockDrivenDSM.validate_time_first_dim
      • StockDrivenDSM.process_id
      • StockDrivenDSM.shape
    • StockDrivenDSM_NIC
      • StockDrivenDSM_NIC.dims
      • StockDrivenDSM_NIC.inflow
      • StockDrivenDSM_NIC.lifetime_model
      • StockDrivenDSM_NIC.name
      • StockDrivenDSM_NIC.outflow
      • StockDrivenDSM_NIC.process
      • StockDrivenDSM_NIC.stock
      • StockDrivenDSM_NIC.time_letter
      • StockDrivenDSM_NIC.check_negative_inflow()
      • StockDrivenDSM_NIC.check_stock_balance()
      • StockDrivenDSM_NIC.compute()
      • StockDrivenDSM_NIC.compute_inflow_and_outflow()
      • StockDrivenDSM_NIC.get_stock_balance()
      • StockDrivenDSM_NIC.inflow_from_balance()
      • StockDrivenDSM_NIC.inflow_from_balance_correction()
      • StockDrivenDSM_NIC.init_cohort_arrays
      • StockDrivenDSM_NIC.init_lifetime_model
      • StockDrivenDSM_NIC.to_stock_type()
      • StockDrivenDSM_NIC.validate_stock_arrays
      • StockDrivenDSM_NIC.validate_time_first_dim
      • StockDrivenDSM_NIC.process_id
      • StockDrivenDSM_NIC.shape
    • LifetimeModel
      • LifetimeModel.dims
      • LifetimeModel.time_letter
      • LifetimeModel.cast_any_to_flodym_array()
      • LifetimeModel.compute_outflow_pdf()
      • LifetimeModel.compute_survival_factor()
      • LifetimeModel.set_prms()
      • LifetimeModel.sf
      • LifetimeModel.shape
      • LifetimeModel.t
      • LifetimeModel.t_diag_indices
    • FixedLifetime
      • FixedLifetime.dims
      • FixedLifetime.mean
      • FixedLifetime.time_letter
      • FixedLifetime.cast_any_to_flodym_array()
      • FixedLifetime.cast_mean
      • FixedLifetime.compute_outflow_pdf()
      • FixedLifetime.compute_survival_factor()
      • FixedLifetime.set_prms()
      • FixedLifetime.sf
      • FixedLifetime.shape
      • FixedLifetime.t
      • FixedLifetime.t_diag_indices
    • NormalLifetime
      • NormalLifetime.dims
      • NormalLifetime.mean
      • NormalLifetime.std
      • NormalLifetime.time_letter
      • NormalLifetime.cast_any_to_flodym_array()
      • NormalLifetime.cast_mean_std
      • NormalLifetime.compute_outflow_pdf()
      • NormalLifetime.compute_survival_factor()
      • NormalLifetime.set_prms()
      • NormalLifetime.sf
      • NormalLifetime.shape
      • NormalLifetime.t
      • NormalLifetime.t_diag_indices
    • FoldedNormalLifetime
      • FoldedNormalLifetime.dims
      • FoldedNormalLifetime.mean
      • FoldedNormalLifetime.std
      • FoldedNormalLifetime.time_letter
      • FoldedNormalLifetime.cast_any_to_flodym_array()
      • FoldedNormalLifetime.cast_mean_std
      • FoldedNormalLifetime.compute_outflow_pdf()
      • FoldedNormalLifetime.compute_survival_factor()
      • FoldedNormalLifetime.set_prms()
      • FoldedNormalLifetime.sf
      • FoldedNormalLifetime.shape
      • FoldedNormalLifetime.t
      • FoldedNormalLifetime.t_diag_indices
    • LogNormalLifetime
      • LogNormalLifetime.dims
      • LogNormalLifetime.mean
      • LogNormalLifetime.std
      • LogNormalLifetime.time_letter
      • LogNormalLifetime.cast_any_to_flodym_array()
      • LogNormalLifetime.cast_mean_std
      • LogNormalLifetime.compute_outflow_pdf()
      • LogNormalLifetime.compute_survival_factor()
      • LogNormalLifetime.set_prms()
      • LogNormalLifetime.sf
      • LogNormalLifetime.shape
      • LogNormalLifetime.t
      • LogNormalLifetime.t_diag_indices
    • WeibullLifetime
      • WeibullLifetime.dims
      • WeibullLifetime.time_letter
      • WeibullLifetime.weibull_scale
      • WeibullLifetime.weibull_shape
      • WeibullLifetime.cast_any_to_flodym_array()
      • WeibullLifetime.cast_shape_scale
      • WeibullLifetime.compute_outflow_pdf()
      • WeibullLifetime.compute_survival_factor()
      • WeibullLifetime.set_prms()
      • WeibullLifetime.sf
      • WeibullLifetime.shape
      • WeibullLifetime.t
      • WeibullLifetime.t_diag_indices
    • make_empty_stocks()
  • Processes
    • Process
      • Process.id
      • Process.name
      • Process.check_id0
    • make_processes()
  • Export and plotting classes and functions
    • PlotlyArrayPlotter
      • PlotlyArrayPlotter.array
      • PlotlyArrayPlotter.chart_type
      • PlotlyArrayPlotter.color_map
      • PlotlyArrayPlotter.display_names
      • PlotlyArrayPlotter.fig
      • PlotlyArrayPlotter.intra_line_dim
      • PlotlyArrayPlotter.line_label
      • PlotlyArrayPlotter.line_type
      • PlotlyArrayPlotter.linecolor_dim
      • PlotlyArrayPlotter.subplot_dim
      • PlotlyArrayPlotter.suppress_legend
      • PlotlyArrayPlotter.title
      • PlotlyArrayPlotter.x_array
      • PlotlyArrayPlotter.xlabel
      • PlotlyArrayPlotter.ylabel
      • PlotlyArrayPlotter.add_line()
      • PlotlyArrayPlotter.check_chart_type
      • PlotlyArrayPlotter.check_colors
      • PlotlyArrayPlotter.check_dims
      • PlotlyArrayPlotter.check_line_type
      • PlotlyArrayPlotter.col()
      • PlotlyArrayPlotter.display_name()
      • PlotlyArrayPlotter.get_fig()
      • PlotlyArrayPlotter.plot()
      • PlotlyArrayPlotter.plot_legend()
      • PlotlyArrayPlotter.row()
      • PlotlyArrayPlotter.save()
      • PlotlyArrayPlotter.set_subplot_title()
      • PlotlyArrayPlotter.set_title()
      • PlotlyArrayPlotter.set_xlabel()
      • PlotlyArrayPlotter.set_ylabel()
      • PlotlyArrayPlotter.show()
    • PyplotArrayPlotter
      • PyplotArrayPlotter.array
      • PyplotArrayPlotter.chart_type
      • PyplotArrayPlotter.color_map
      • PyplotArrayPlotter.display_names
      • PyplotArrayPlotter.fig
      • PyplotArrayPlotter.intra_line_dim
      • PyplotArrayPlotter.line_label
      • PyplotArrayPlotter.line_type
      • PyplotArrayPlotter.linecolor_dim
      • PyplotArrayPlotter.subplot_dim
      • PyplotArrayPlotter.suppress_legend
      • PyplotArrayPlotter.title
      • PyplotArrayPlotter.x_array
      • PyplotArrayPlotter.xlabel
      • PyplotArrayPlotter.ylabel
      • PyplotArrayPlotter.add_line()
      • PyplotArrayPlotter.check_chart_type
      • PyplotArrayPlotter.check_colors
      • PyplotArrayPlotter.check_dims
      • PyplotArrayPlotter.check_line_type
      • PyplotArrayPlotter.display_name()
      • PyplotArrayPlotter.get_fig()
      • PyplotArrayPlotter.plot()
      • PyplotArrayPlotter.plot_legend()
      • PyplotArrayPlotter.save()
      • PyplotArrayPlotter.set_subplot_title()
      • PyplotArrayPlotter.set_title()
      • PyplotArrayPlotter.set_xlabel()
      • PyplotArrayPlotter.set_ylabel()
      • PyplotArrayPlotter.show()
      • PyplotArrayPlotter.ax
    • PlotlySankeyPlotter
      • PlotlySankeyPlotter.display_names
      • PlotlySankeyPlotter.exclude_flows
      • PlotlySankeyPlotter.exclude_processes
      • PlotlySankeyPlotter.flow_color_dict
      • PlotlySankeyPlotter.mfa
      • PlotlySankeyPlotter.node_color_dict
      • PlotlySankeyPlotter.slice_dict
      • PlotlySankeyPlotter.check_dims
      • PlotlySankeyPlotter.check_excluded
      • PlotlySankeyPlotter.check_flow_colors
      • PlotlySankeyPlotter.check_node_colors
      • PlotlySankeyPlotter.display_name()
      • PlotlySankeyPlotter.plot()
      • PlotlySankeyPlotter.excluded_process_ids
      • PlotlySankeyPlotter.ids_in_sankey
      • PlotlySankeyPlotter.shown_flows
      • PlotlySankeyPlotter.shown_processes
    • export_mfa_flows_to_csv()
    • export_mfa_stocks_to_csv()
    • export_mfa_to_pickle()
    • convert_to_dict()
flodym
  • Search


© Copyright 2025, the flodym authors.

Built with Sphinx using a theme provided by Read the Docs.