Skip to content

Commit

Permalink
Improved naming (e.g. impact categories instead of LCIA methods)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsteubing committed Nov 11, 2019
1 parent 21cbdc0 commit 3523e24
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Then simply run `activity-browser` and the application will open.

### Importing an LCI database

- In the `inventory`-tab there is a button called _"Add Default Data (Biosphere flows, LCIA methods)"_. Click this button to add the default data. This is equivalent to `brightway2.bw2setup()` in python.
- In the `inventory`-tab there is 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. There are currently three types of imports possible:
- Directly from the ecoinvent homepage (ecoinvent login credentials required)
- From a 7zip archive
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/bwutils/commontasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def unit_of_method(method):
return bw.methods[method].get('unit')

def get_LCIA_method_name_dict(keys):
"""LCIA methods in brightway2 are stored in tuples, which is unpractical for display in, e.g. dropdown Menues.
"""Impact categories in brightway2 are stored in tuples, which is unpractical for display in, e.g. dropdown Menues.
Returns a dictionary with
keys: comma separated strings
values: brightway2 method tuples
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/bwutils/montecarlo.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def load_data(self):
self.lca.tech_rng = MCRandomNumberGenerator(self.lca.tech_params, seed=self.seed)
self.lca.bio_rng = MCRandomNumberGenerator(self.lca.bio_params, seed=self.seed)
if self.lca.lcia:
self.cf_rngs = dict() # we need as many cf_rng as LCIA methods, because they are of different size
self.cf_rngs = dict() # we need as many cf_rng as impact categories, because they are of different size
for method in self.methods:
self.lca.switch_method(method)
self.lca.load_lcia_data()
Expand Down
8 changes: 4 additions & 4 deletions activity_browser/app/bwutils/multilca.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@


class MLCA(object):
"""Wrapper class for performing LCA calculations with many functional units and LCIA methods.
"""Wrapper class for performing LCA calculations with many functional units and impact categories.
Needs to be passed a brightway ``calculation_setup`` name.
This class does not subclass the `LCA` class, and performs all
calculations upon instantiation.
Initialization creates `self.lca_scores`, which is a NumPy array
of LCA scores, with rows of functional units and columns of LCIA methods.
of LCA scores, with rows of functional units and columns of impact categories.
Ordering is the same as in the `calculation_setup`.
This class is adapted from `bw2calc.multi_lca.MultiLCA` and includes a
Expand All @@ -46,9 +46,9 @@ class MLCA(object):
rev_fu_index: dict
Same as `fu_index` but using the indexes as keys
methods: list
The LCIA methods of the calculation setup
The impact categories of the calculation setup
method_index: dict
Links the LCIA methods to a specific index
Links the impact categories to a specific index
rev_method_index: dict
Same as `method_index` but using the indexes as keys
lca: `bw2calc.lca.LCA`
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/ui/figures.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ class MonteCarloPlot(Plot):
""" Monte Carlo plot."""
def __init__(self, parent=None):
super(MonteCarloPlot, self).__init__(parent)
self.plot_name = 'MonteCarlo'
self.plot_name = 'Monte Carlo'

def plot(self, df, method):
# self.figure.clf()
Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/panels/right.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, *args):
self.tabs = {
"Welcome": RestrictedWebViewWidget(html_file=PACKAGE_DIRECTORY + r'/app/ui/web/startscreen/welcome.html'),
"Characterization Factors": CharacterizationFactorsTab(self),
"Activities": ActivitiesTab(self),
"Activity Details": ActivitiesTab(self),
"LCA Setup": LCASetupTab(self),
"Graph Explorer": GraphExplorerTab(self),
"LCA results": LCAResultsTab(self),
Expand All @@ -38,7 +38,7 @@ def __init__(self, *args):
self.tab_order[tab_name] = self.addTab(tab, tab_name)

# tabs hidden at start
for tab_name in ["Activities", "Characterization Factors", "Graph Explorer", "LCA results"]:
for tab_name in ["Activity Details", "Characterization Factors", "Graph Explorer", "LCA results"]:
self.hide_tab(tab_name)

def show_tab(self, tab_name):
Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/tabs/LCA_results_tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def get_radio_buttons(names=['first', 'second'], states=[True, False]):
def get_unit(method, relative):
"""Determine the unit based on whether a plot is shown:
- for a number of functional units
- for a number of LCIA methods
- for a number of impact categories
and whether the axis are related to:
- relative or
- absolute numbers."""
Expand Down Expand Up @@ -894,7 +894,7 @@ def __init__(self, parent=None):
super(MonteCarloTab, self).__init__(parent)
self.parent = parent

self.layout.addLayout(get_header_layout('MonteCarlo'))
self.layout.addLayout(get_header_layout('Monte Carlo Simulation'))

self.add_MC_ui_elements()

Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/ui/tabs/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def open_activity_tab(self, key: tuple) -> None:
# new_tab.setToolTip(bw.get_activity(key).as_dict()['name'])

self.select_tab(self.tabs[key])
signals.show_tab.emit("Activities")
signals.show_tab.emit("Activity Details")

def update_activity_name(self, key, field, value):
if key in self.tabs and field == 'name':
Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/tabs/impact_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ def __init__(self, parent):

self.table = MethodsTable()
self.search_box = QtWidgets.QLineEdit()
self.search_box.setPlaceholderText("Filter LCIA methods")
self.search_box.setPlaceholderText("Filter impact categories")
reset_search_button = QtWidgets.QPushButton("Reset")
#
search_layout = QtWidgets.QHBoxLayout()
search_layout.setAlignment(QtCore.Qt.AlignTop)
search_layout.addWidget(header('LCIA Methods:'))
search_layout.addWidget(header('Impact Categories'))
search_layout.addWidget(self.search_box)
search_layout.addWidget(reset_search_button)
#
Expand Down
6 changes: 3 additions & 3 deletions activity_browser/app/ui/tabs/project_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def __init__(self):
)
# Layout
self.h_layout = QtWidgets.QHBoxLayout()
self.h_layout.addWidget(header('Project:'))
self.h_layout.addWidget(header('Projects:'))
self.h_layout.addWidget(self.projects_list)
self.h_layout.addWidget(self.new_project_button)
self.h_layout.addWidget(self.copy_project_button)
Expand Down Expand Up @@ -153,7 +153,7 @@ def __init__(self, parent):

# Buttons
self.add_default_data_button = QtWidgets.QPushButton(
qicons.import_db, "Add Default Data (Biosphere flows, LCIA methods)"
qicons.import_db, "Add default data (biosphere flows and impact categories)"
)
self.new_database_button = QtWidgets.QPushButton(qicons.add, "New")
self.import_database_button = QtWidgets.QPushButton(qicons.import_db, "Import")
Expand Down Expand Up @@ -195,7 +195,7 @@ def update_widget(self):
class ActivityBiosphereWidget(QtWidgets.QWidget):
def __init__(self, parent):
super(ActivityBiosphereWidget, self).__init__(parent)
self.header = 'Datasets'
self.header = 'Activities'

self.table = ActivitiesBiosphereTable(self)

Expand Down
2 changes: 1 addition & 1 deletion activity_browser/app/ui/web/startscreen/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h2>Key features:</h2>

<ul>
<li>Mange brightway2 projects, databases and activities (increasing your productivity with brightway)</li>
<li>Calculate fast LCA results (use "calculation setups" to calculate LCA results for several activities and LCIA methods at once)</li>
<li>Calculate fast LCA results (use "calculation setups" to calculate LCA results for several functional units and impact categories at once)</li>
<li>Easily plot and export your LCA results (contribution analyses, Monte Carlo simulations)</li>
<li>Visualize your results in Sankey diagrams or explore your database with the Graph Explorer</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions activity_browser/app/ui/wizards/db_import_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,9 +759,9 @@ class ImportSignals(QtCore.QObject):
class DefaultBiosphereDialog(QtWidgets.QProgressDialog):
def __init__(self):
super().__init__()
self.setWindowTitle('Biosphere and LCIA methods')
self.setWindowTitle('Biosphere and impact categories')
self.setLabelText(
'Adding default biosphere and LCIA methods to project <b>{}</b>:'.format(
'Adding default biosphere and impact categories to project <b>{}</b>:'.format(
bw.projects.current)
)
self.setRange(0, 0)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_add_default_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def test_fail_open_biosphere(ab_app):
""" Specifically fail to open an activity tab for a biosphere flow
"""
assert bw.projects.current == "pytest_project"
activities_tab = ab_app.main_window.right_panel.tabs["Activities"]
activities_tab = ab_app.main_window.right_panel.tabs["Activity Details"]
# Select any biosphere activity and emit signal to trigger opening the tab
biosphere_flow = bw.Database("biosphere3").random()
signals.open_activity_tab.emit(biosphere_flow.key)
Expand All @@ -88,7 +88,7 @@ def test_succceed_open_activity(ab_app):
]
}
})
activities_tab = ab_app.main_window.right_panel.tabs["Activities"]
activities_tab = ab_app.main_window.right_panel.tabs["Activity Details"]
# Select the activity and emit signal to trigger opening the tab
act = bw.get_activity(act_key)
signals.open_activity_tab.emit(act_key)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def test_open_activity_tab(qtbot, ab_app):
# First, look at the parameters tab
panel = ab_app.main_window.right_panel
param_tab = panel.tabs["Parameters"]
activities_tab = panel.tabs["Activities"]
activities_tab = panel.tabs["Activity Details"]
ab_app.main_window.right_panel.select_tab(param_tab)

# Select an activity
Expand Down

0 comments on commit 3523e24

Please sign in to comment.