plot times

milestone_5_without_improvements-logs
Oli 3 years ago
parent fb20a57560
commit eaeb01d343

3
.gitignore vendored

@ -17,4 +17,5 @@ fftma_module/gen/build/
tools/connec/conec2d
tools/connec/conec3d
utilities/__pycache__/
fftma_module/gen/log.txt
fftma_module/gen/log_*.txt
fftma_module/gen/out*.npy

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
@ -11,9 +11,17 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['12:30:24', 'INFO', './lib_src/generate.c:61:', 'TOTAL', 'VIRTUAL', 'MEM', '=', '7683.0', 'MB,', 'USED', 'VIRTUAL', 'MEM', '=', '304.2', 'MB,', 'USED', 'VIRTUAL', 'MEM', 'BY', 'CURRENT', 'PROCESS', '=', '1072', 'MB']\n",
"['12:30:24', 'INFO', './lib_src/Py_kgeneration.c:64:', 'TOTAL', 'VIRTUAL', 'MEM', '=', '7683.0', 'MB,', 'USED', 'VIRTUAL', 'MEM', '=', '303.6', 'MB,', 'USED', 'VIRTUAL', 'MEM', 'BY', 'CURRENT', 'PROCESS', '=', '1072', 'MB']\n"
]
},
{
"data": {
"text/html": [
@ -35,138 +43,662 @@
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>elapsed_time (seconds)</th>\n",
" <th>function_name</th>\n",
" <th>elapsed_time</th>\n",
" <th>executions</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.150900</td>\n",
" <td>./lib_src/generate.c:75:</td>\n",
" <td>./lib_src/Py_getvalues.c:157:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>0.000051</td>\n",
" <td>./lib_src/build_real.c:50:</td>\n",
" <td>./lib_src/ran2.c:68:</td>\n",
" <td>0.000004</td>\n",
" <td>142</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>0.000091</td>\n",
" <td>./lib_src/cov_value.c:60:</td>\n",
" <td>./lib_src/gasdev.c:35:</td>\n",
" <td>0.000023</td>\n",
" <td>151</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>0.000021</td>\n",
" <td>./lib_src/length.c:47:</td>\n",
" <td>./lib_src/gasdev.c:43:</td>\n",
" <td>0.000003</td>\n",
" <td>202</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>0.000017</td>\n",
" <td>./lib_src/clean_real.c:48:</td>\n",
" <td>./lib_src/generate.c:75:</td>\n",
" <td>0.010957</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0.000068</td>\n",
" <td>./lib_src/gasdev.c:43:</td>\n",
" <td>./lib_src/maxfactor.c:42:</td>\n",
" <td>0.000004</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>0.082331</td>\n",
" <td>./lib_src/covariance.c:86:</td>\n",
" <td>./lib_src/length.c:47:</td>\n",
" <td>0.000013</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>0.000713</td>\n",
" <td>./lib_src/gasdev.c:35:</td>\n",
" <td>./lib_src/cgrid.c:50:</td>\n",
" <td>0.000060</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>0.000101</td>\n",
" <td>./lib_src/ran2.c:68:</td>\n",
" <td>./lib_src/cov_value.c:60:</td>\n",
" <td>0.000011</td>\n",
" <td>76</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>0.000047</td>\n",
" <td>./lib_src/prebuild_gwn.c:57:</td>\n",
" <td>./lib_src/covariance.c:86:</td>\n",
" <td>0.012162</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>0.236221</td>\n",
" <td>./lib_src/Py_kgeneration.c:74:</td>\n",
" <td>./lib_src/fourt.c:593:</td>\n",
" <td>0.000065</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>0.084618</td>\n",
" <td>./lib_src/fftma2.c:106:</td>\n",
" <td>./lib_src/prebuild_gwn.c:57:</td>\n",
" <td>0.000009</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>0.000007</td>\n",
" <td>./lib_src/maxfactor.c:42:</td>\n",
" <td>./lib_src/build_real.c:50:</td>\n",
" <td>0.000019</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>0.000835</td>\n",
" <td>./lib_src/fourt.c:593:</td>\n",
" <td>./lib_src/clean_real.c:48:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>0.000086</td>\n",
" <td>./lib_src/cgrid.c:50:</td>\n",
" <td>./lib_src/fftma2.c:106:</td>\n",
" <td>0.012503</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>0.000026</td>\n",
" <td>./lib_src/Py_getvalues.c:157:</td>\n",
" <td>./lib_src/Py_kgeneration.c:74:</td>\n",
" <td>0.023829</td>\n",
" <td>1</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" elapsed_time (seconds) function_name\n",
"0 0.150900 ./lib_src/generate.c:75:\n",
"1 0.000051 ./lib_src/build_real.c:50:\n",
"2 0.000091 ./lib_src/cov_value.c:60:\n",
"3 0.000021 ./lib_src/length.c:47:\n",
"4 0.000017 ./lib_src/clean_real.c:48:\n",
"5 0.000068 ./lib_src/gasdev.c:43:\n",
"6 0.082331 ./lib_src/covariance.c:86:\n",
"7 0.000713 ./lib_src/gasdev.c:35:\n",
"8 0.000101 ./lib_src/ran2.c:68:\n",
"9 0.000047 ./lib_src/prebuild_gwn.c:57:\n",
"10 0.236221 ./lib_src/Py_kgeneration.c:74:\n",
"11 0.084618 ./lib_src/fftma2.c:106:\n",
"12 0.000007 ./lib_src/maxfactor.c:42:\n",
"13 0.000835 ./lib_src/fourt.c:593:\n",
"14 0.000086 ./lib_src/cgrid.c:50:\n",
"15 0.000026 ./lib_src/Py_getvalues.c:157:"
]
},
"execution_count": 33,
" function_name elapsed_time executions\n",
"0 ./lib_src/Py_getvalues.c:157: 0.000007 1\n",
"1 ./lib_src/ran2.c:68: 0.000004 142\n",
"2 ./lib_src/gasdev.c:35: 0.000023 151\n",
"3 ./lib_src/gasdev.c:43: 0.000003 202\n",
"4 ./lib_src/generate.c:75: 0.010957 1\n",
"5 ./lib_src/maxfactor.c:42: 0.000004 1\n",
"6 ./lib_src/length.c:47: 0.000013 1\n",
"7 ./lib_src/cgrid.c:50: 0.000060 1\n",
"8 ./lib_src/cov_value.c:60: 0.000011 76\n",
"9 ./lib_src/covariance.c:86: 0.012162 1\n",
"10 ./lib_src/fourt.c:593: 0.000065 2\n",
"11 ./lib_src/prebuild_gwn.c:57: 0.000009 1\n",
"12 ./lib_src/build_real.c:50: 0.000019 1\n",
"13 ./lib_src/clean_real.c:48: 0.000007 1\n",
"14 ./lib_src/fftma2.c:106: 0.012503 1\n",
"15 ./lib_src/Py_kgeneration.c:74: 0.023829 1"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data = {}\n",
"with open(\"log_16.txt\") as log_file:\n",
"with open(\"log_8.txt\") as log_file:\n",
" lines = log_file.readlines()\n",
" \n",
" for line in lines:\n",
" if \"MEM\" in line:\n",
" split_line = line.split()\n",
" print(split_line)\n",
" if \"ELAPSED\" in line:\n",
" split_line = line.split()\n",
" idx_elapsed = split_line.index(\"ELAPSED\") + 2\n",
" function_name, elapsed = split_line[2], float(split_line[idx_elapsed])\n",
" if function_name not in data or (function_name in data and elapsed > data[function_name]):\n",
" data[function_name] = elapsed\n",
"new_data = {\"function_name\": data.keys(), \"elapsed_time (seconds)\": data.values()}\n",
" if function_name not in data or (function_name in data and elapsed > data[function_name][0]):\n",
" val = data.get(function_name, (elapsed, 0))\n",
" data[function_name] = (val[0], val[1] + 1)\n",
"\n",
"values = data.values()\n",
"new_data = {\"function_name\": data.keys(), \"elapsed_time\": map(lambda x: x[0], values), \"executions\": map(lambda x: x[1], values)}\n",
" \n",
"df = pd.DataFrame(new_data) \n",
"\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"df[\"total_time\"] = df[\"elapsed_time\"] * df[\"executions\"]"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>function_name</th>\n",
" <th>elapsed_time</th>\n",
" <th>executions</th>\n",
" <th>total_time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>./lib_src/Py_kgeneration.c:74:</td>\n",
" <td>0.023829</td>\n",
" <td>1</td>\n",
" <td>0.023829</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>./lib_src/fftma2.c:106:</td>\n",
" <td>0.012503</td>\n",
" <td>1</td>\n",
" <td>0.012503</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>./lib_src/covariance.c:86:</td>\n",
" <td>0.012162</td>\n",
" <td>1</td>\n",
" <td>0.012162</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>./lib_src/generate.c:75:</td>\n",
" <td>0.010957</td>\n",
" <td>1</td>\n",
" <td>0.010957</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>./lib_src/fourt.c:593:</td>\n",
" <td>0.000065</td>\n",
" <td>2</td>\n",
" <td>0.000130</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>./lib_src/cgrid.c:50:</td>\n",
" <td>0.000060</td>\n",
" <td>1</td>\n",
" <td>0.000060</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>./lib_src/gasdev.c:35:</td>\n",
" <td>0.000023</td>\n",
" <td>151</td>\n",
" <td>0.003473</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>./lib_src/build_real.c:50:</td>\n",
" <td>0.000019</td>\n",
" <td>1</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>./lib_src/length.c:47:</td>\n",
" <td>0.000013</td>\n",
" <td>1</td>\n",
" <td>0.000013</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>./lib_src/cov_value.c:60:</td>\n",
" <td>0.000011</td>\n",
" <td>76</td>\n",
" <td>0.000836</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>./lib_src/prebuild_gwn.c:57:</td>\n",
" <td>0.000009</td>\n",
" <td>1</td>\n",
" <td>0.000009</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>./lib_src/Py_getvalues.c:157:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>./lib_src/clean_real.c:48:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>./lib_src/ran2.c:68:</td>\n",
" <td>0.000004</td>\n",
" <td>142</td>\n",
" <td>0.000568</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>./lib_src/maxfactor.c:42:</td>\n",
" <td>0.000004</td>\n",
" <td>1</td>\n",
" <td>0.000004</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>./lib_src/gasdev.c:43:</td>\n",
" <td>0.000003</td>\n",
" <td>202</td>\n",
" <td>0.000606</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" function_name elapsed_time executions total_time\n",
"15 ./lib_src/Py_kgeneration.c:74: 0.023829 1 0.023829\n",
"14 ./lib_src/fftma2.c:106: 0.012503 1 0.012503\n",
"9 ./lib_src/covariance.c:86: 0.012162 1 0.012162\n",
"4 ./lib_src/generate.c:75: 0.010957 1 0.010957\n",
"10 ./lib_src/fourt.c:593: 0.000065 2 0.000130\n",
"7 ./lib_src/cgrid.c:50: 0.000060 1 0.000060\n",
"2 ./lib_src/gasdev.c:35: 0.000023 151 0.003473\n",
"12 ./lib_src/build_real.c:50: 0.000019 1 0.000019\n",
"6 ./lib_src/length.c:47: 0.000013 1 0.000013\n",
"8 ./lib_src/cov_value.c:60: 0.000011 76 0.000836\n",
"11 ./lib_src/prebuild_gwn.c:57: 0.000009 1 0.000009\n",
"0 ./lib_src/Py_getvalues.c:157: 0.000007 1 0.000007\n",
"13 ./lib_src/clean_real.c:48: 0.000007 1 0.000007\n",
"1 ./lib_src/ran2.c:68: 0.000004 142 0.000568\n",
"5 ./lib_src/maxfactor.c:42: 0.000004 1 0.000004\n",
"3 ./lib_src/gasdev.c:43: 0.000003 202 0.000606"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.sort_values(by=[\"elapsed_time\"], ascending=False)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>function_name</th>\n",
" <th>elapsed_time</th>\n",
" <th>executions</th>\n",
" <th>total_time</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>./lib_src/Py_kgeneration.c:74:</td>\n",
" <td>0.023829</td>\n",
" <td>1</td>\n",
" <td>0.023829</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>./lib_src/fftma2.c:106:</td>\n",
" <td>0.012503</td>\n",
" <td>1</td>\n",
" <td>0.012503</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>./lib_src/covariance.c:86:</td>\n",
" <td>0.012162</td>\n",
" <td>1</td>\n",
" <td>0.012162</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>./lib_src/generate.c:75:</td>\n",
" <td>0.010957</td>\n",
" <td>1</td>\n",
" <td>0.010957</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>./lib_src/gasdev.c:35:</td>\n",
" <td>0.000023</td>\n",
" <td>151</td>\n",
" <td>0.003473</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>./lib_src/cov_value.c:60:</td>\n",
" <td>0.000011</td>\n",
" <td>76</td>\n",
" <td>0.000836</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>./lib_src/gasdev.c:43:</td>\n",
" <td>0.000003</td>\n",
" <td>202</td>\n",
" <td>0.000606</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>./lib_src/ran2.c:68:</td>\n",
" <td>0.000004</td>\n",
" <td>142</td>\n",
" <td>0.000568</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>./lib_src/fourt.c:593:</td>\n",
" <td>0.000065</td>\n",
" <td>2</td>\n",
" <td>0.000130</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>./lib_src/cgrid.c:50:</td>\n",
" <td>0.000060</td>\n",
" <td>1</td>\n",
" <td>0.000060</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>./lib_src/build_real.c:50:</td>\n",
" <td>0.000019</td>\n",
" <td>1</td>\n",
" <td>0.000019</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>./lib_src/length.c:47:</td>\n",
" <td>0.000013</td>\n",
" <td>1</td>\n",
" <td>0.000013</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>./lib_src/prebuild_gwn.c:57:</td>\n",
" <td>0.000009</td>\n",
" <td>1</td>\n",
" <td>0.000009</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>./lib_src/Py_getvalues.c:157:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>./lib_src/clean_real.c:48:</td>\n",
" <td>0.000007</td>\n",
" <td>1</td>\n",
" <td>0.000007</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>./lib_src/maxfactor.c:42:</td>\n",
" <td>0.000004</td>\n",
" <td>1</td>\n",
" <td>0.000004</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" function_name elapsed_time executions total_time\n",
"15 ./lib_src/Py_kgeneration.c:74: 0.023829 1 0.023829\n",
"14 ./lib_src/fftma2.c:106: 0.012503 1 0.012503\n",
"9 ./lib_src/covariance.c:86: 0.012162 1 0.012162\n",
"4 ./lib_src/generate.c:75: 0.010957 1 0.010957\n",
"2 ./lib_src/gasdev.c:35: 0.000023 151 0.003473\n",
"8 ./lib_src/cov_value.c:60: 0.000011 76 0.000836\n",
"3 ./lib_src/gasdev.c:43: 0.000003 202 0.000606\n",
"1 ./lib_src/ran2.c:68: 0.000004 142 0.000568\n",
"10 ./lib_src/fourt.c:593: 0.000065 2 0.000130\n",
"7 ./lib_src/cgrid.c:50: 0.000060 1 0.000060\n",
"12 ./lib_src/build_real.c:50: 0.000019 1 0.000019\n",
"6 ./lib_src/length.c:47: 0.000013 1 0.000013\n",
"11 ./lib_src/prebuild_gwn.c:57: 0.000009 1 0.000009\n",
"0 ./lib_src/Py_getvalues.c:157: 0.000007 1 0.000007\n",
"13 ./lib_src/clean_real.c:48: 0.000007 1 0.000007\n",
"5 ./lib_src/maxfactor.c:42: 0.000004 1 0.000004"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.sort_values(by=[\"total_time\"], ascending=False)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#Import libraries\n",
"from matplotlib_venn import venn3\n",
"from matplotlib import pyplot as plt\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"relations = {\n",
" \"generate\": [\"gasdev\"],\n",
" \"fftma2\": [\"covariance\", \"fourt\", \"prebuild_gwn\"]\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"plt.figure(dpi=125)\n",
"set_a = set([0.023829, 0.010957, 0.012503])\n",
"\n",
"set_b = set([0.010957])\n",
"\n",
"set_c = set([0.012503])\n",
"\n",
"venn3([set_a, set_b, set_c], ('Py_kgeneration', 'generate', 'fftma2'))\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"venn3([set(['Py_kgeneration', 'generate', 'fftma2']), set(['generate', 'fftma2']), set(['fftma2'])])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.figure(dpi=125)\n",
"plt.title('Py_kgeneration')\n",
"plt.pie([0.010957, 0.012503], labels=[\"generate\", \"fftma2\"], normalize=True)\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Import libraries\n",
"from matplotlib import pyplot as plt\n",
"import numpy as np\n",
"\n",
"\n",
"# Creating dataset\n",
"size = 6\n",
"cars = ['AUDI', 'BMW', 'FORD',\n",
"\t\t'TESLA', 'JAGUAR', 'MERCEDES']\n",
"\n",
"data = np.array([[23, 16], [17, 23],\n",
"\t\t\t\t[35, 11], [29, 33],\n",
"\t\t\t\t[12, 27], [41, 42]])\n",
"\n",
"# normalizing data to 2 pi\n",
"norm = data / np.sum(data)*2 * np.pi\n",
"\n",
"# obtaining ordinates of bar edges\n",
"left = np.cumsum(np.append(0,\n",
"\t\t\t\t\t\tnorm.flatten()[:-1])).reshape(data.shape)\n",
"\n",
"# Creating color scale\n",
"cmap = plt.get_cmap(\"tab20c\")\n",
"outer_colors = cmap(np.arange(6)*4)\n",
"inner_colors = cmap(np.array([1, 2, 5, 6, 9,\n",
"\t\t\t\t\t\t\t10, 12, 13, 15,\n",
"\t\t\t\t\t\t\t17, 18, 20 ]))\n",
"\n",
"# Creating plot\n",
"fig, ax = plt.subplots(figsize =(10, 7),\n",
"\t\t\t\t\tsubplot_kw = dict(polar = True))\n",
"\n",
"ax.bar(x = left[:, 0],\n",
"\twidth = norm.sum(axis = 1),\n",
"\tbottom = 1-size,\n",
"\theight = size,\n",
"\tcolor = outer_colors,\n",
"\tedgecolor ='w',\n",
"\tlinewidth = 1,\n",
"\talign =\"edge\")\n",
"\n",
"ax.bar(x = left.flatten(),\n",
"\twidth = norm.flatten(),\n",
"\tbottom = 1-2 * size,\n",
"\theight = size,\n",
"\tcolor = inner_colors,\n",
"\tedgecolor ='w',\n",
"\tlinewidth = 1,\n",
"\talign =\"edge\")\n",
"\n",
"ax.set(title =\"Nested pie chart\")\n",
"ax.set_axis_off()\n",
"\n",
"# show plot\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
@ -184,14 +716,14 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.18"
"pygments_lexer": "ipython3",
"version": "3.6.9"
}
},
"nbformat": 4,

Binary file not shown.

@ -0,0 +1,4 @@
matplotlib-venn
pandas
matplotlib
numpy

@ -1 +1 @@
ENV=false python3 test.py 2>&1 | tee log_$1.txt
ENV=true python3 test.py 2>&1 | tee log_$1.txt

@ -2,7 +2,7 @@ from FFTMA import gen
import numpy as np
import gc
N=128
N=64
nx, ny, nz = N,N,N
dx, dy, dz = 1.0, 1.0, 1.0

Loading…
Cancel
Save