Git Product home page Git Product logo

activity-browser's Introduction

conda-forge version Downloads linux apple windows Pull request tests Coverage Status

Activity Browser

The Activity Browser (AB) is an open source software for Life Cycle Assessment (LCA) that builds on Brightway2.

Video tutorials are available on youtube.

Please also read and cite our scientific paper.

Some highlights

  • Fast LCA calculations: for multiple reference flows, impact categories, and scenarios
  • A productivity tool for brightway: model in brightway (python) and see the results in the AB or vice-versa
  • Advanced modeling: Use parameters, scenarios (including prospective LCI databases from premise), uncertainties and our Graph Explorer
  • Advanced analyses: Contribution analyses, Sankey Diagrams, Monte Carlo, and Global Sensitivity Analysis

Contents

Installation

The quick way

You can install and start the activity-browser like this:

conda create -n ab -c conda-forge --solver libmamba activity-browser
conda activate ab
activity-browser

Mamba

You can also install the AB using Mamba:

mamba create -n ab activity-browser
mamba activate ab
activity-browser

The thorough way

Conda

We recommend that you use conda to manage your python installation. You can install Anaconda or the more compact miniconda (Python 3 version) for your operating system. Installation instructions for miniconda can be found here. See also the conda user guide or the Conda cheat sheet.

Skip this step if you already have a working installation of anaconda or miniconda, but make sure to keep your conda installation up-to-date: conda update -n base conda.

Add the Conda-Forge channel

The activity-browser has many dependencies that are managed by the conda-forge channel. Open a cmd-window or terminal (in Windows you may have to use the Anaconda prompt) and type the following:

conda config --prepend channels conda-forge

Also configure conda to use the libmamba solver which is significantly faster than the default.

conda config --set solver libmamba

Installing Activity Browser

conda create -n ab -c conda-forge activity-browser
conda activate ab
activity-browser

Activity Browser is installed

At this point the activity-browser and all of its dependencies will be installed in a new conda environment called ab. You can change the environment name ab to whatever suits you.

Updating the AB

We recommend to regularly update the AB to receive new features & bugfixes. These commands will update the activity-browser and all of its dependencies in the conda environment called ab.

conda activate ab
conda update activity-browser

Getting started

Running the AB

First activate the environment where the activity browser is installed:

conda activate ab

Then simply run activity-browser and the application will open.

Importing LCI databases

  • In the Project-tab there is initially a button called "Add default data (biosphere flows and impact categories)". Click this button to add the default data. This is equivalent to brightway2.bw2setup() in python.
  • After adding the default data, you can import a database with the "Import Database"-Button. Follow the instructions of the database import wizard. Imports can be done in several ways:
    • Directly from the ecoinvent homepage (ecoinvent login credentials required)
    • From a 7zip archive
    • From a directory with ecospold2 files (same as in brightway2)
    • From Excel files using the brightway Excel format

Additional Resources

Plugins

⚠️ DISCLAIMER
Plugins are not necessarily developed by Activity Browser maintainers. Below are listed plugins from people we trust but we do not check plugins code. Use them at your own risk.
The plugin system is still in development so keep in mind that things may change at any point.

Since the 2.8 release a plugin system has been added to the AB. Plugins are a flexible way to add new functionalities to the AB without modifying the software itself.

The plugin code has been designed and written by Remy le Calloch (supported by G-SCOP laboratories) with revisions from the AB-team.

Available plugins

These are the plugins that we know about. To add your plugin to this list either open an issue, or a pull request. All submitted plugins will be reviewed, although all risks associated with their use shall be born by the user.

Name Description Links Author(s)
ScenarioLink Enables you to seamlessly fetch and reproduce scenario-based LCA databases, such as those generated by premise anaconda, pypi, github Romain Sacchi & Marc van der Meide
ReSICLED Evaluating the recyclability of electr(on)ic product for improving product design anaconda, github G-SCOP Laboratory
Notebook Use Jupyter notebooks from AB anaconda, github Rémy Le Calloch
template An empty plugin to start from anaconda, github Rémy Le Calloch

Installation

detailed instructions

Every plugin's Github page (links are provided in the above table) should have a Get this plugin section with installation instructions.

general instructions

Plugins are conda packages (like the Activity Browser). To add a plugin simply install it in your conda environment from the Anaconda repos.

Nb: add -c conda-forge to the install command like below to avoid problems with dependencies.

Ex:

conda activate ab
conda install -c pan6ora -c conda-forge ab-plugin-notebook

Usage

Once a new plugin is installed restart the Activity Browser.

enabling a plugin

Plugins are enabled per-project. Simply open the plugin manager in the Tools > Plugins menu.

Close the plugin manager. New tabs should have appeared in the AB (each plugin can spawn one tab on each left/right panel).

disabling a plugin

Disable a plugin the same way you activated it.

⚠️ Keep in mind that all data created by the plugin in a project could be erased when you disable it.

Development

The best place to start to create new plugins is the plugin template. Its code and README will help you to understand how to create a plugin.

Contributing

The Activity Browser is a community project. Your contribution counts!

If you have ideas for improvements to the code or documentation or want to propose new features, please take a look at our contributing guidelines and open issues and/or pull-requests.

If you experience problems or are suffering from a specific bug, please raise an issue here on github.

Developers

Current main developers

Important contributers

Copyright

  • 2016-2023: Bernhard Steubing (Leiden University)

License

You can find the license information for Activity Browser in the license file.

activity-browser's People

Contributors

acoudard avatar athunc avatar benportner avatar bsteubing avatar cardosan avatar cmutel avatar dgdekoning avatar haasad avatar joeytje50 avatar jsvgoncalves avatar lfen7 avatar m-rossi avatar marc-vdm avatar mrvisscher avatar nabilahmed739 avatar pan6ora avatar sandernielen avatar stpdfox avatar tmillross avatar ughstudios avatar will7200 avatar zber avatar zoophobus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activity-browser's Issues

Navigation within the Activities Tab by double-clicking

Users should be able to navigate through the database by double-clicking on any technosphere exchange. (And perhaps get additional information on the biosphere exchanges by clicking on them as well, e.g. CFs? not sure what exactly at this point).

New issue reported from app

test log output

Log Output:
```Filters will effect all database queries until unset (.filters = None)
Using the following database filters:
{'type': 'process'}
Using the following database filters:
{'type': 'process'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}

Make DatabaseImportWizard more secure

  • Right now it's possible to open two wizards which leads to various crashes, eg orphaned QThreads that segfault and things like that
  • If there is already a database with db_name, it is silently overwritten and the UI doesn't display the progress of writing to sqlite:
    image
  • If the users selects a directory without ecospold files, there is no useful feedback and the wizard looks like this:
    image

Creating new activities

There is quite a bit functionality missing for creating new activities:

  • defining the reference product
  • defining the unit
  • defining uncertainties (e.g. pedigree matrix), probably an issue by itself
  • ... to be completed

Interactive visualizations of process/elementary flow contributions

How can process/elementary flow contributions to LCA results be communicated in a graphically compelling way (e.g. interactive Sankey diagrams displaying inventory flows or impact category "flows" along the supply chain)?
This is closely linked to issue #22.
A widget should be developed that enables:
• Display (parts of) the supply chain (as required by the user)
• Enable a graphical supply chain navigation
• Cut-offs to focus on the relevant part of the supply chains (defined by flow/impact relevance or the interest of the user)

read-only databases

Certain databases, like ecoinvent should be read-only, or in other words should be protected so the user cannot accidentally mess them up.
The Activity Browser currently already prevents activities from being deleted when other activities still use them, but, what is not prevented, e.g. is that exchanges can be added to activities by dragging and dropping...

New issue reported from app

Test bug report from CML Leiden.

Log Output:

Brightway2 data directory: C:\Users\steubingbrp\AppData\Local\pylca\Brightway3
Brightway2 active project: default
Switched to C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3 as Brightway2 data directory.
Switched to Brightway2 data directory: C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'process'}
Using the following database filters:
{'type': 'process'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}

LCA Calculations does not work with only one FU

As promised I start to contribute....or bother depending on the point of view :P

LCA Calculations does not work when only one FU is used (regardless of the number of methods), the prob does no occurs with more than one.
See error below

Entering clear layout
Total: 0
Traceback (most recent call last):
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/lca_activity_browser/app/ui/tabs/lca_results.py", line 82, in calculate
    process_contribution_plot = LCAProcessContributionPlot(self, self.mlca)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/lca_activity_browser/app/ui/graphics.py", line 139, in __init__
    df_tc = pd.DataFrame(tc)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 330, in __init__
    mgr = self._init_dict(data, index, columns, dtype=dtype)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 461, in _init_dict
    return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 6130, in _arrays_to_mgr
    index = extract_index(arrays)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 6173, in extract_index
    index = _union_indexes(indexes)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/indexes/api.py", line 67, in _union_indexes
    result = Index(sorted(result))
TypeError: '<' not supported between instances of 'tuple' and 'str'

Entering clear layout
Total: 0
Traceback (most recent call last):
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/lca_activity_browser/app/ui/tabs/lca_results.py", line 82, in calculate
    process_contribution_plot = LCAProcessContributionPlot(self, self.mlca)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/lca_activity_browser/app/ui/graphics.py", line 139, in __init__
    df_tc = pd.DataFrame(tc)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 330, in __init__
    mgr = self._init_dict(data, index, columns, dtype=dtype)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 461, in _init_dict
    return _arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 6130, in _arrays_to_mgr
    index = extract_index(arrays)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/frame.py", line 6173, in extract_index
    index = _union_indexes(indexes)
  File "/home/giuseppec/miniconda3/envs/param/lib/python3.6/site-packages/pandas/core/indexes/api.py", line 67, in _union_indexes
    result = Index(sorted(result))
TypeError: '<' not supported between instances of 'tuple' and 'str'

New issue reported from app

Test QInputDialog.getMultilineText

this is multiline text

What about markdown?

google

Log Output:

Brightway2 data directory: /home/adrian/.local/share/Brightway3
Brightway2 active project: default

Tests with continuous integration

It would be nice to have some automated tests with a CI-service. First of all just to make sure that the activity-browser actually runs on all platforms to catch things like the issue with QtWebEngineWidgets earlier (see #16 ). Secondly it would also be great to have some aspects of the GUI tested automatically, for example with pytest-qt.

test

this is a test

Package js-files

The javascript-files need to be packaged with the python files for the sankey visualization to work:

  • add the required files to setup.py to make pip install https://github.com/LCA-ActivityBrowser/activity-browser/archive/master.zip work
  • add the files to meta.yaml to make it work with conda install ...

Process modeling (data entry)

Required developments:
A robust data entry mask for the AB including
• Economic and environmental exchanges
• Unit, location, etc.
• Uncertainties
• Possibly parameters
• Copying, saving, and deleting activities from selected databases
etc.

Calculation setups behaviour

CS only work if the project is reloaded... also, at start the CS shows 1,2,3 in "Products and amounts" as well as the 4 buttons (CS selection, new, rename, delete), but one cannot select from CS selection. It works once the project has been reloaded...

Code Style, flake8

At the moment my linter-plugin is complaining whenever I open one of the py-files. Need to go through the code base make it more pep8 conforming.

biosphere datasets are not opened in tab

HI guys,
when I open a database in a project, while I can open activities in the separate tab this is not possible with biosphere datasets. Is this the expected behaviour.
I think would be convenient to be able also to open such a type e.g. to explore the activities that uses a certain biosphere flow downstream.

Load BW2 database directory from within AB

Users should be able to choose their database directory from within the GUI.
Currently, there is a workaround, by creating a app/settings.py file with two variables:

BW2_DIR = r'YOUR PATH' # the directory that your brightway2 data(bases) are located in
PROJECT_NAME = 'YOUR PROJECT NAME' # the project that you'd like to open when the activity-browser starts

Conda install broken on OS X

The os selectors in the conda build recipe don't do what I expected them to do:

- pyqt # [osx]
- pyqt >=5.9 # [not osx]

See explanation here: conda/conda-build#1024

Maybe the easiest fix for this is to build pyqt 5.9 for OS X. Otherwise the dev version noarch build on travis won't work, no matter what.

LCA results presentation

How to display LCA results in informative and graphically appealing ways? Here some ideas:
Different plots
• Inventory level (economic/environmental flows)
• LCA score(s) (Barchart, Piechart, Treemap…)
• Contribution Analyses (by process, elementary flow, product, geography, ISIC sector) (Barchart, Treemap, Piechart, Worldmap for geo)
• Uncertainties: Monte Carlo (possibly also others, e.g. Latin-Hypercube) (needs also to integrated in to calculation setups)
Tables to export the data
• To be developed first
User choices:
• LCIA method, cut-off

Report bug option

This is currently not working and too prominent. Perhaps we could have it report issues to this repository, but in the MenuBar under "Help".

development plan

HI Hadrian,
cool that you took this project over, do you have any development plan perhaps?
I think the development of a GUI would tremendously help all the bw2 users.....I guess almost everyone is using bw2 for more advanced things but still, most of the time is often spent in working on the databases, and having GUI would allow to save a tremendous amount of time for doing other things....
I am willing to help...even if I have basically no experience with pyqt...

Create stand-alone executable

To make the activity-browser easily accessible to non-python users, a standalone executable would be required. The most promising way to do this is with pyinstaller, especially because it allows to build self-contained python applications for all major platforms.

A standalone executable would also make it necessary for the activity-browser to have the option to import databases from raw data (ie. ecoinvent db from ecospold).

New issue reported from app

Test new implementation of raising issues directly

Log Output:

Brightway2 data directory: /home/adrian/.local/share/Brightway3
Brightway2 active project: default

New issue reported from app

Another test bug report from Leiden.

Log Output:

Brightway2 data directory: C:\Users\steubingbrp\AppData\Local\pylca\Brightway3
Brightway2 active project: default
Switched to C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3 as Brightway2 data directory.
Switched to Brightway2 data directory: C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'process'}
Using the following database filters:
{'type': 'process'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}
Filters will effect all database queries until unset (`.filters = None`)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}
Test bug report from CML Leiden.

Log Output:

Brightway2 data directory: C:\Users\steubingbrp\AppData\Local\pylca\Brightway3
Brightway2 active project: default
Switched to C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3 as Brightway2 data directory.
Switched to Brightway2 data directory: C:\Users\steubingbrp\surfdrive\Leiden\python\Brightway3
Filters will effect all database queries until unset (.filters = None)
Using the following database filters:
{'type': 'process'}
Using the following database filters:
{'type': 'process'}
Filters will effect all database queries until unset (.filters = None)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}
Filters will effect all database queries until unset (.filters = None)
Using the following database filters:
{'type': 'emission'}
Using the following database filters:
{'type': 'emission'}

Conda Recipe

Split out the relevant files for conda build to their own conda-recipe repo. Otherwise the whole repo is included in the recipe.

installation downgrades packages

Hi guys,
first happy to see you take the development back.

I have just installed AB in an already created environment and some packages got downgraded

The following NEW packages will be INSTALLED:

    activity-browser: 2.2.1-pyhd50db26_1 haasad     

The following packages will be UPDATED:

    pyqt:             5.6.0-py36_4       conda-forge --> 5.9.2-py36h7ca782d_0  haasad
    sip:              4.18-py36_1        conda-forge --> 4.19.6-py36h7b295a5_1 haasad

The following packages will be SUPERSEDED by a higher-priority channel:

    fontconfig:       2.12.1-4           conda-forge --> 2.11.1-6                    
    freetype:         2.7-1              conda-forge --> 2.5.5-2                     
    matplotlib:       2.1.0-py36_0       conda-forge --> 2.0.2-np113py36_0           
    qt:               5.6.2-3            conda-forge --> 4.8.7-3                     

Dunno if this unwanted behaviour or is necessary to make AB works, but in the latter case I would specify in the sectionInstall the activity browser of the README that AB must/should be installed in a separate environment to avoid this.

Interactive visualization of the supply chain network

What is the best graphical representation / interactive visualization to understand complex supply chain networks as described in life cycle inventory databases?
This should be implemented in a widget that is able to:
• Display (parts of) the supply chain (as required by the user)
• Enable graphical supply chain navigation (i.e. by right/left-clicking on processes, and using buttons, etc., the user can comfortably navigate through the supply chain and get a quick understanding of it)

Seaborn changes upstream result in import error

File "/Users/cmutel/miniconda3/envs/isie/lib/python3.6/site-packages/lca_activity_browser/app/ui/panels/left.py", line 5, in <module> from ..graphics import DefaultGraph File "/Users/cmutel/miniconda3/envs/isie/lib/python3.6/site-packages/lca_activity_browser/app/ui/graphics.py", line 9, in <module> from seaborn.linearmodels import corrplot ImportError: cannot import name 'corrplot'

Improve activity tab

Issue on bitbucket

The vertical layout of the activity tab needs to be improved to use the space more efficiently:

Things to improve:

  • Reduce margin space / unused vertical space
  • Resize tables based on content
  • Display comment only when triggerd by some event (eg. button, or hover tooltip)

From original issue on bitbucket:

  • Allow tables to expand/collapse with more details, e.g. database, parameterized exchange, uncertainty type, uncertainty values

License is not up to date

  • Who exactly is going to be the copyright holder now?
  • Use github's template to make sure license type is display in header of repo (see picture)
    image

Tab Management

The main tabs can't be closed and therefore shouldn't have the option available:

Ideally new, closable tabs should be opened as subtabs of a non-closeable main tab (subtab example from another app):

Like this the main tabs aren't cluttered by opening many activity tabs:

Search function

The search function is very basic and could be much improved.

Put the activity browser on PyPI, update setup.py

So far the activity browser is only installable via conda:
conda install -c conda-forge -c cmutel -c haasad activity-browser

Pip install is only possible via github:
pip install https://github.com/haasad/activity-browser/archive/master.zip

install_requires in setup.py needs to be updated to make github pip install work properly.

Advanced activity search

In order to explore a database with the activity browser it would be nice to have an advanced search feature, where one can filter for different attributes:

  • name, search string contained in name
  • activity type
  • location
  • reference product
  • economic sector (via ISIC code)
  • biosphere flows (see #3 )

Below is a screenshot of a tool with some of these capabilities that I built some time ago:

Versioning, Changelog, Milestones

We need to come up with a system to plan the development. The current CHANGES.txt file is not the best way forward in my opinion. I have no experience yet with the github projects and milestones, but it appears to work very well in other projects.

I think it would be useful to translate things mentioned in #1 and also some of the very broad issues like #21, #22 and #23 to projects and milestones or something similar. I think an issue should ideally be small and centered around one problem that can be resolved with a single pull-request (or a more general discussion like here).

Other projects use certain milestones to define when the next release is ready. We are now at the somewhat random version number 2.2.1. I think it makes sense to tie the stable release of the activity-browser package on conda to a version number. Additionally the most up-to-date state of AB is available as activity-browser-dev (with version number 2.2.1.dev).

Happy to hear any inputs/suggestions/opinions

Sankey Window is opened twice

This might be related to @bsteubing changes with setFullscreen, since the behaviour of fullscreen appears to differ between operating systems. Need to investigate further.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.