Skip to content

Commit

Permalink
Fix hidden spelling errors
Browse files Browse the repository at this point in the history
These are the spelling errors that @check-spelling/check-spelling doesn't
warn about.

Changelist:
- .github/actions/spelling
    - Add `GPLv` to allow.txt
    - Add new words to expect.txt
- Add ignore comments in README.md, epispot/plots/native.py
  • Loading branch information
quantum9Innovation committed Jul 20, 2021
1 parent 814a334 commit 00a8e96
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ github
gitignore
gitlocalize
GLOBALS
GPLv
google
homepage
html
Expand Down Expand Up @@ -109,6 +110,7 @@ towardsdatascience
ubuntu
uncomment
url
urls
username
usr
vcs
Expand Down
7 changes: 7 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
abspath
bdist
borderaxespad
Cov
Covsir
cri
currentframe
elif
getfile
hos
len
ncol
Phy
sdist
SIHCR
SIHRD
SIRD
XDI
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ Please see our [CODEOWNERS](https://github.com/epispot/epispot/tree/master/.gith

### Idea & Inspiration

The original idea for epispot came from a [3Blue1Brown video](https://www.youtube.com/watch?v=gxAaO2rsdIs) on basic infectious disease dynamics and an [interactive article](https://www.washingtonpost.com/graphics/2020/world/corona-simulator/) in the Washington Post. This in turn inspired the very basic infectious disease dynamics simulated [here](https://quantum9innovation.github.io/disease/) However, what finally set the package into motion was a series of articles by Henry Froese, available on Medium [here](https://towardsdatascience.com/infectious-disease-modelling-part-i-understanding-sir-28d60e29fdfc), along with their corresponding interactive notebooks.
The original idea for epispot came from a [3Blue1Brown video](https://www.youtube.com/watch?v=gxAaO2rsdIs) on basic infectious disease dynamics and an [interactive article](https://www.washingtonpost.com/graphics/2020/world/corona-simulator/) in the Washington Post. This in turn inspired the very basic infectious disease dynamics simulated [here](https://quantum9innovation.github.io/disease/). However, what finally set the package into motion was a series of articles by Henry Froese, available on Medium
[here](https://towardsdatascience.com/infectious-disease-modelling-part-i-understanding-sir-28d60e29fdfc), <!-- spellcheck: disable -->
along with their corresponding interactive notebooks.

### Code Development & Maintenance

Expand Down
24 changes: 12 additions & 12 deletions epispot/plots/native.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
The `native` module contains various plotting mechanisms utilizing `matplotlib`.
Additionally, in order to display scientifically polished graphs, this module uses the
Additionally, in order to display scientifically polished graphs, this module uses the
[Science-Plots](https://pypi.org/project/SciencePlots/1.0.8/) package.\
We strongly encourage you to cite the authors of this package as demonstrated below:
Expand All @@ -14,8 +14,8 @@
```
Additionally, all functions in this module have a `latex` flag which determines whether to use LaTeX or not.
In order to use LaTeX, please follow the installation instructions for your operating system listed on the
[`SciencePlots` project README](https://github.com/garrettj403/SciencePlots#faq).
In order to use LaTeX, please follow the installation instructions for your operating system listed on the
[`SciencePlots` project README](https://github.com/garrettj403/SciencePlots#faq). <!-- spellcheck: disable -->
## Structure:
Expand All @@ -27,15 +27,15 @@
plt.style.use(['science', 'no-latex']) # default style


def model(Model, time_frame, title='Compartment Populations over Time',
starting_state=None, names=None, show_susceptible=False,
def model(Model, time_frame, title='Compartment Populations over Time',
starting_state=None, names=None, show_susceptible=False,
log=False, latex=True):
"""
Plots the results of one model using `matplotlib`.
The results are displayed natively via a `matplotlib` window.
There are various ways to customize the generated plots by modifying
the time frame or compartments displayed.
Additionally, `matplotlib` allows editing plots even after
the time frame or compartments displayed.
Additionally, `matplotlib` allows editing plots even after
they have been created to change things like colors, margins, etc.
- Model: An `epispot.models.Model` object
Expand Down Expand Up @@ -93,15 +93,15 @@ def stacked(Model, time_frame, title='Compartment Populations over Time',
Plots the results of one model using `matplotlib`.
The results are displayed natively via a `matplotlib` window as a stacked area chart.
There are various ways to customize the generated plots by modifying
the time frame or compartments displayed.
Additionally, `matplotlib` allows editing plots even after
the time frame or compartments displayed.
Additionally, `matplotlib` allows editing plots even after
they have been created to change things like colors, margins, etc.
- Model: An `epispot.models.Model` object
- time_frame: A `range()` describing the time period to plot
- title: (`='Compartment Populations over Time`) The title of the plot
- starting_state: (default:inherited) Initial model state (see `epispot.models.Model.integrate` parameter `starting_state`)
- compartments: (default:all) The indices of the compartments in the model to plot;
- compartments: (default:all) The indices of the compartments in the model to plot;
all other compartments will be hidden
- names: (default:`Model.layer_names`) A list of names for each of the compartments
- show_susceptible: (`=False`) Boolean value describing whether or not to plot the Susceptible compartment.\
Expand Down Expand Up @@ -144,13 +144,13 @@ def stacked(Model, time_frame, title='Compartment Populations over Time',

# plotting
plt.figure(figsize=(9, 5))
plt.stackplot(time_frame, *[DataFrame[Model.layer_names[compartment]] for compartment in compartments],
plt.stackplot(time_frame, *[DataFrame[Model.layer_names[compartment]] for compartment in compartments],
labels=[names[compartment] for compartment in compartments])

if log:
plt.yscale('log')
plt.title(title)
plt.legend(loc="lower center", bbox_to_anchor=(0.5, -0.2), borderaxespad=0, ncol=2)
plt.legend(loc="lower center", bbox_to_anchor=(0.5, -0.2), borderaxespad=0, ncol=2) # spellcheck: disable
plt.tight_layout()

return plt

1 comment on commit 00a8e96

@github-actions
Copy link

@github-actions github-actions bot commented on 00a8e96 Jul 20, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

Unrecognized words, please review:

  • XDl
Previously acknowledged words that are now absent borderaxespad ncol XDI
To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:epispot/epispot.git repository
on the check-spelling branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/epispot/epispot/comments/53746047" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  
update_files
rm $comment_body
git add -u

Please sign in to comment.