-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow non-binary incidence #123
Changes from 5 commits
86f17d5
8d76b0b
7b57863
0990085
6fbbbed
a24e528
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,7 +93,7 @@ | |
" packages = 'pyyaml pandas numpy matplotlib'\n", | ||
" ret = os.system(f'conda install {packages}')\n", | ||
" if ret != 0:\n", | ||
" os.system(f'pip install {packages}')" | ||
" os.system(f'{sys.executable} -m pip install {packages}')" | ||
] | ||
}, | ||
{ | ||
|
@@ -840,7 +840,7 @@ | |
} | ||
], | ||
"source": [ | ||
"def meta_geog_df(meta_geog):\n", | ||
"def meta_geog_df(summary_df, meta_geog):\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. modify the methods to not use global variables and instead pass requisite data as arguments. |
||
" geography_df = pd.read_csv(os.path.join(popsim_dir, geography_file))\n", | ||
" geog = use_geographies[use_geographies.index(meta_geog) + 1] # next geography in list\n", | ||
" meta_df = geography_df[[meta_geog, geog]].drop_duplicates(ignore_index=True)\n", | ||
|
@@ -852,7 +852,7 @@ | |
" \n", | ||
"for geog in use_geographies:\n", | ||
" if not geog in summary_df.geography.unique():\n", | ||
" summary_df = summary_df.append(meta_geog_df(geog))\n", | ||
" summary_df = summary_df.append(summary_df, meta_geog_df(geog))\n", | ||
"\n", | ||
"summary_df.tail()" | ||
] | ||
|
@@ -870,7 +870,7 @@ | |
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"def process_control(name, geography, control, result):\n", | ||
"def process_control(summary_df, name, geography, control, result):\n", | ||
" \"\"\"\n", | ||
" Global\n", | ||
" ------\n", | ||
|
@@ -948,12 +948,12 @@ | |
"\n", | ||
"stats = []\n", | ||
"for params, ax in zip(aggregate_list, axes.ravel()):\n", | ||
" s, f = process_control(**params)\n", | ||
" s, f = process_control(summary_df, **params)\n", | ||
" stats.append(s)\n", | ||
" \n", | ||
" ax.set_title(f\"{params['geography']} - {params['name']}\")\n", | ||
" ax.set_ylabel('Frequency'); ax.set_xlabel('Difference: control vs. result')\n", | ||
" ax.scatter(f.index, f)\n", | ||
" ax.hist(diff, bins=10, range=(-5,5), alpha=0.5)\n", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a histogram plot, rather than a scatter plot, to show the histogram. |
||
"\n", | ||
"summary_fig.savefig(os.path.join(validation_dir, 'frequencies.pdf'))\n", | ||
"stats_df = pd.DataFrame(stats)\n", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you shouldn't call pip or python directly in case the user path picks a different python than the one running the notebook.