Skip to content

Commit

Permalink
media susceptibility script
Browse files Browse the repository at this point in the history
  • Loading branch information
traducha committed May 26, 2022
1 parent ce97840 commit 0aa6107
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scripts/media_susceptibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

from configuration.parser import get_arguments
from tools import convert_to_distributions, split_suffix
from plotting import plot_mean_std, plot_heatmap, plot_std, plot_mean_per, plot_mean_diff
from plotting import plot_mean_std, plot_heatmap, plot_std, plot_mean_per, plot_mean_diff, plot_mean_std_two_systems

# parameters of simulations not present in the config module
media_influence = np.arange(0.0, 1.0, 0.1) # range of considered media influence
media_influence = np.linspace(0, 1, 21) # range of considered media influence


def plot_media_susceptibility(config):
Expand Down Expand Up @@ -79,6 +79,13 @@ def plot_media_susceptibility(config):
plot_mean_diff(x=media_influence, y=results[system]['mean_set'], quantity='media', election_system=system,
suffix=suffix, xlab='media influence', ylab=f'susceptibility derivative', ylim=(),
save_file=True)

plot_mean_std_two_systems(
x=media_influence, y1=results['countrywide_system']['mean_set'], std1=results['countrywide_system']['std_set'],
y1_name='1 district', y2=results['main_district_system']['mean_set'],
std2=results['main_district_system']['std_set'], y2_name=f'{config.q} districts',
quantity='media', suffix=suffix, xlab='media influence', ylab=f'election result of {media_state}',
ylim=ylim_mean, save_file=True)


if __name__ == '__main__':
Expand Down

0 comments on commit 0aa6107

Please sign in to comment.