-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bd9af6
commit 8fbd233
Showing
7 changed files
with
260 additions
and
130 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
import ugropy as ug | ||
|
||
|
||
# ============================================================================= | ||
# 14 - OH (P), OH (S), OH (T) | ||
# ============================================================================= | ||
# Dortmund | ||
trials_dortmund = [ | ||
|
||
] | ||
|
||
|
||
@pytest.mark.OH | ||
@pytest.mark.DORTMUND | ||
@pytest.mark.parametrize("identifier, result, identifier_type", trials_dortmund) | ||
def test_unifac_ch2(identifier, result, identifier_type): | ||
groups = ug.Groups(identifier, identifier_type) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import json\n", | ||
"\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"import numpy as np" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"with open(\"../ugropy/groupscsv/dortmund/dortmund_subgroups.csv\", mode='r') as f:\n", | ||
" df = pd.read_csv(f, sep='|', index_col=\"group\", comment=\"?\")\n", | ||
"\n", | ||
"# indexes of the groups matrix\n", | ||
"index = df.index.to_numpy()\n", | ||
"\n", | ||
"# filles with zeros at start\n", | ||
"matrix = np.zeros((len(index), len(index)), dtype=int)\n", | ||
"\n", | ||
"# build the matrix\n", | ||
"dfm = pd.DataFrame(matrix, index=index, columns=index).rename_axis(\"group\")\n", | ||
"\n", | ||
"# fill the matrix\n", | ||
"for group in df.index:\n", | ||
" string_contribution = df.loc[group].contribute\n", | ||
" \n", | ||
" try:\n", | ||
" contribution = json.loads(string_contribution) # transform into dict\n", | ||
" except json.JSONDecodeError:\n", | ||
" print(group)\n", | ||
" print(string_contribution)\n", | ||
" break\n", | ||
" except TypeError:\n", | ||
" print(group)\n", | ||
" print(string_contribution)\n", | ||
" break\n", | ||
"\n", | ||
" for k in contribution.keys():\n", | ||
" dfm.loc[group][k] = contribution[k] # fill contribution\n", | ||
"\n", | ||
"# save the matrix\n", | ||
"dfm.to_csv(\"../ugropy/groupscsv/dortmund/dortmund_matrix.csv\", sep=\"|\")\n", | ||
" " | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "ugropy", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.12" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.