Skip to content
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

Add codespell config, workflow and get it to fix some typos it finds #1610

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[codespell]
skip = .git,*.pdf,*.svg,.codespellrc
check-hidden = true
ignore-regex = ^\s*"image/\S+": ".*|^ "# .*\bbu.210506
# importAT - is a function
ignore-words-list = importat
22 changes: 22 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Codespell

on:
push:
branches: [develop]
pull_request:
branches: [develop]

permissions:
contents: read

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
2 changes: 1 addition & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Github has made it easy to separate issues from discussions. Generally speaking,
* Optionally assign a reviewer on the right of the screen - otherwise a member of the SLEAP developer team will self-assign themselves.
8) If the reviewer requests changes, repeat steps 3-5 and `Re-request review`.
9) Once the reviewer signs off they will squash + merge the PR into the `develop` branch.
* New feautures will be available on the `main` branch when a new release of SLEAP is released.
* New features will be available on the `main` branch when a new release of SLEAP is released.

## Style Guides

Expand Down
4 changes: 2 additions & 2 deletions docs/guides/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ optional arguments:
Path to output directory where the frozen model will be exported to.
Defaults to a folder named 'exported_model'.
-r, --ragged RAGGED
Keep tensors ragged if present. If ommited, convert
Keep tensors ragged if present. If omitted, convert
ragged tensors into regular tensors with NaN padding.
-n, --max_instances MAX_INSTANCES
Limit maximum number of instances in multi-instance models.
Expand Down Expand Up @@ -303,7 +303,7 @@ optional arguments:
naming convention
<slp path>.<video index>_<video filename>.analysis.h5 will be
used for every video without a specified output path. Multiple
outputs can be specified, each preceeded by --output.
outputs can be specified, each preceded by --output.

Example (analysis format):
Input:
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Note that many of the menu command have keyboard shortcuts which can be configur

"**Evaluate Metrics for Trained Models...**" provides you with information to evaluate all of your trained models. For example, you can see the recall and precision of predictions on frames with ground truth validation data (i.e., data withheld when training).

"**Visualize Model Outputs...**" allows you to select a trained model and see the intermediate inference data plotted on the frame image. In particular, looking at the confidence maps used to predict each node can be helpful for understanding why and where your model isn't preforming well.
"**Visualize Model Outputs...**" allows you to select a trained model and see the intermediate inference data plotted on the frame image. In particular, looking at the confidence maps used to predict each node can be helpful for understanding why and where your model isn't performing well.

"**Add Instances from All Predictions on Current Frame**" converts ever predicted instance on the current frame into a user editable instance (which allows you to make corrections and/or use it for training).

Expand Down
6 changes: 3 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ Although you do not need Mambaforge installed to perform a `pip install`, we rec
The pypi distributed package of SLEAP ships with the following extras:
- **pypi**: For installation without an mamba environment file. All dependencies come from PyPI.
- **jupyter**: This installs all *pypi* and jupyter lab dependencies.
- **dev**: This installs all *jupyter* dependencies and developement tools for testing and building docs.
- **dev**: This installs all *jupyter* dependencies and development tools for testing and building docs.
- **conda_jupyter**: For installation using a mamba environment file included in the source code. Most dependencies are listed as conda packages in the environment file and only a few come from PyPI to allow jupyter lab support.
- **conda_dev**: For installation using [a mamba environment](https://github.com/search?q=repo%3Atalmolab%2Fsleap+path%3Aenvironment*.yml&type=code) with a few PyPI dependencies for development tools.
```
Expand Down Expand Up @@ -315,11 +315,11 @@ python -c "import sleap; sleap.system_summary()"
GPUs: 2/2 available
Device: /physical_device:GPU:0
Available: True
Initalized: False
Initialized: False
Memory growth: None
Device: /physical_device:GPU:1
Available: True
Initalized: False
Initialized: False
Memory growth: None

SLEAP uses TensorFlow for GPU acceleration. To directly check if TensorFlow is detecting your GPUs:
Expand Down
2 changes: 1 addition & 1 deletion docs/notebooks/Interactive_and_realtime_inference.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
"GPUs: 1/1 available\n",
" Device: /physical_device:GPU:0\n",
" Available: True\n",
" Initalized: False\n",
" Initialized: False\n",
" Memory growth: True\n"
]
},
Expand Down
4 changes: 2 additions & 2 deletions docs/notebooks/Interactive_and_resumable_training.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"GPUs: 1/1 available\n",
" Device: /physical_device:GPU:0\n",
" Available: True\n",
" Initalized: False\n",
" Initialized: False\n",
" Memory growth: None\n"
]
}
Expand Down Expand Up @@ -207,7 +207,7 @@
"cfg.data.labels.training_labels = TRAINING_SLP_FILE\n",
"cfg.data.labels.validation_fraction = 0.1\n",
"\n",
"# Preprocesssing and training parameters.\n",
"# Preprocessing and training parameters.\n",
"cfg.data.instance_cropping.center_on_part = \"thorax\"\n",
"cfg.optimization.augmentation_config.rotate = True\n",
"cfg.optimization.epochs = 10 # This is the maximum number of training rounds.\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@
"GPUs: 1/1 available\n",
" Device: /physical_device:GPU:0\n",
" Available: True\n",
" Initalized: False\n",
" Initialized: False\n",
" Memory growth: True\n",
"INFO:sleap.nn.training:\n",
"INFO:sleap.nn.training:Initializing trainer...\n",
Expand Down Expand Up @@ -768,7 +768,7 @@
"GPUs: 1/1 available\n",
" Device: /physical_device:GPU:0\n",
" Available: True\n",
" Initalized: False\n",
" Initialized: False\n",
" Memory growth: True\n",
"INFO:sleap.nn.training:\n",
"INFO:sleap.nn.training:Initializing trainer...\n",
Expand Down Expand Up @@ -1052,7 +1052,7 @@
"GPUs: 1/1 available\n",
" Device: /physical_device:GPU:0\n",
" Available: True\n",
" Initalized: False\n",
" Initialized: False\n",
" Memory growth: True\n",
"\n",
"Video: dataset/drosophila-melanogaster-courtship/20190128_113421.mp4\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"### Create and export the training job package\n",
"A self-contained **training job package** contains a .slp file with labeled data and images which will be used for training, as well as .json training configuration file(s).\n",
"\n",
"A training job package can be exported in the SLEAP GUI fron the \"Run Training..\" dialog under the \"Predict\" menu."
"A training job package can be exported in the SLEAP GUI from the \"Run Training..\" dialog under the \"Predict\" menu."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pypi_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# setup.py, the packages in requirements.txt will also be installed when running
# pip install sleap[pypi].

# These are also distrubuted through conda and not pip installed when using conda.
# These are also distributed through conda and not pip installed when using conda.
attrs>=21.2.0,<=21.4.0
cattrs==1.1.1
# certifi>=2017.4.17,<=2021.10.8
Expand Down
2 changes: 1 addition & 1 deletion sleap/config/training_editor_form.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ augmentation:
name: optimization.augmentation_config.gaussian_noise_stddev
type: double
- default: false
help: If True, gamma constrast adjustment will be applied to the image. This scales
help: If True, gamma contrast adjustment will be applied to the image. This scales
all pixel values by `x ** gamma` where `x` is the pixel value in the [0, 1] range.
Values in [0, 255] are first scaled to [0, 1]. See `imgaug.augmenters.contrast.GammaContrast`.
label: Contrast
Expand Down
4 changes: 2 additions & 2 deletions sleap/gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def __init__(
self._initialize_gui()

if reset:
print("Reseting GUI state and preferences...")
print("Resetting GUI state and preferences...")
prefs.reset_to_default()
elif len(prefs["window state"]) > 0:
print("Restoring GUI state...")
Expand Down Expand Up @@ -1481,7 +1481,7 @@ def _show_learning_dialog(self, mode: str):
return

if self._child_windows.get(mode, None) is None:
# Re-use existing dialog widget.
# Reuse existing dialog widget.
self._child_windows[mode] = LearningDialog(
mode,
self.state["filename"],
Expand Down
6 changes: 3 additions & 3 deletions sleap/gui/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,7 @@ def _try_save(context, labels: Labels, filename: str):

except Exception as e:
message = (
f"An error occured when attempting to save:\n {e}\n\n"
f"An error occurred when attempting to save:\n {e}\n\n"
"Try saving your project with a different filename or in a different "
"format."
)
Expand Down Expand Up @@ -1240,7 +1240,7 @@ def ask_for_filename(default_name: str, csv: bool) -> str:
analysis_videos.append(video)
output_paths.append(filename)

# Chack that output paths are valid
# Check that output paths are valid
if len(output_paths) == 0:
return False

Expand Down Expand Up @@ -2068,7 +2068,7 @@ def try_and_skip_if_error(func, *args, **kwargs):
etype=type(e), value=e, tb=e.__traceback__
)
logger.warning(
f"Recieved the following error while replacing skeleton:\n"
f"Received the following error while replacing skeleton:\n"
f"{''.join(tb_str)}"
)

Expand Down
2 changes: 1 addition & 1 deletion sleap/gui/learning/dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ def update_loaded_config(
editor GUI tab.

Returns:
A `ScopedKeyDict` with the loaded config values overriden by the corresponding
A `ScopedKeyDict` with the loaded config values overridden by the corresponding
ones from the `tab_cfg_key_val_dict`.
"""
# Serialize training config
Expand Down
2 changes: 1 addition & 1 deletion sleap/gui/learning/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def waiting_item(**kwargs):
if gui:
QtWidgets.QMessageBox(
text=(
"An error occcured during inference. Your command line "
"An error occurred during inference. Your command line "
"terminal may have more information about the error."
)
).exec_()
Expand Down
2 changes: 1 addition & 1 deletion sleap/gui/overlays/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TrackTrailOverlay(BaseOverlay):
max_node_count: Optional[int] = None

def __attrs_post_init__(self):
"""Initialize the shade options attribute after initalizing the instance."""
"""Initialize the shade options attribute after initializing the instance."""

self.shade_options = self.get_shade_options()

Expand Down
4 changes: 2 additions & 2 deletions sleap/gui/widgets/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,11 +1172,11 @@ def wheelEvent(self, event):
pass

def keyPressEvent(self, event):
"""Custom event hander, disables default QGraphicsView behavior."""
"""Custom event handler, disables default QGraphicsView behavior."""
event.ignore() # Kicks the event up to parent

def keyReleaseEvent(self, event):
"""Custom event hander, disables default QGraphicsView behavior."""
"""Custom event handler, disables default QGraphicsView behavior."""
event.ignore() # Kicks the event up to parent


Expand Down
2 changes: 1 addition & 1 deletion sleap/gui/widgets/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def toggle_button_callback(self, checked: bool):
for child in self.content_area.findChildren(QWidget):
child.setVisible(checked)

# Collapse combo box (otherwise, visiblity opens combo)
# Collapse combo box (otherwise, visibility opens combo)
if checked:
combo = self.content_area.findChild(QComboBox)
combo.hidePopup()
Expand Down
10 changes: 5 additions & 5 deletions sleap/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* `Instance` (`PredictedInstance`) can be associated with a `Track`

* A `PointArray` (or `PredictedPointArray`) contains zero or more
`Point` objects (or `PredictedPoint` objectss), ideally as many as
`Point` objects (or `PredictedPoint` objects), ideally as many as
there are in the associated :class:`Skeleton` although these can get
out of sync if the skeleton is manipulated.
"""
Expand Down Expand Up @@ -91,7 +91,7 @@ def numpy() -> np.ndarray:


# This turns PredictedPoint into an attrs class. Defines comparators for
# us and generaly makes it behave better. Crazy that this works!
# us and generally makes it behave better. Crazy that this works!
Point = attr.s(these={name: attr.ib() for name in Point.dtype.names}, init=False)(Point)


Expand Down Expand Up @@ -157,7 +157,7 @@ def from_point(cls, point: Point, score: float = 0.0) -> "PredictedPoint":


# This turns PredictedPoint into an attrs class. Defines comparators for
# us and generaly makes it behave better. Crazy that this works!
# us and generally makes it behave better. Crazy that this works!
PredictedPoint = attr.s(
these={name: attr.ib() for name in PredictedPoint.dtype.names}, init=False
)(PredictedPoint)
Expand Down Expand Up @@ -212,7 +212,7 @@ def __array_finalize__(self, obj):
"""
Override :method:`np.recarray.__array_finalize__()`.

Overide __array_finalize__ on recarray because it converting the
Override __array_finalize__ on recarray because it converting the
dtype of any np.void subclass to np.record, we don't want this.
"""
pass
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def make_instance_cattr() -> cattr.Converter:

#### UNSTRUCTURE HOOKS

# JSON dump cant handle NumPy bools so convert them. These are present
# JSON dump can't handle NumPy bools so convert them. These are present
# in Point/PredictedPoint objects now since they are actually custom numpy dtypes.
converter.register_unstructure_hook(np.bool_, bool)

Expand Down
2 changes: 1 addition & 1 deletion sleap/io/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def create_parser():
"path per video in the project. Otherwise, the default naming convention "
"`<slp path>.<video index>_<video filename>.analysis.h5` will be used for "
"every video without a specified output path. Multiple outputs can be "
"specified, each preceeded by --output.",
"specified, each preceded by --output.",
)
parser.add_argument(
"--format",
Expand Down
6 changes: 3 additions & 3 deletions sleap/io/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,7 @@ def to_dict(self, skip_labels: bool = False) -> Dict[str, Any]:
skip_labels: If True, skip labels serialization and just do the metadata.

Returns:
A dict containing the followings top level keys:
A dict containing the following top level keys:
* version - The version of the dict/json serialization format.
* skeletons - The skeletons associated with these underlying
instances.
Expand Down Expand Up @@ -2095,7 +2095,7 @@ def export_nwb(

Args:
filename: Output path for the NWB format file.
labels: The `Labels` object to covert to a NWB format file.
labels: The `Labels` object to convert to a NWB format file.
overwrite: Boolean that overwrites existing NWB file if True. If False, data
will be appended to existing NWB file.
session_description: Description for entire project. Stored under
Expand Down Expand Up @@ -2621,7 +2621,7 @@ def video_callback(
Args:
video_list: A list of serialized `Video` objects stored as nested
dictionaries.
new_paths: A list of paths where we'll autimatically try to find the
new_paths: A list of paths where we'll automatically try to find the
missing videos.
context: A dictionary containing a "changed_on_load" key with a boolean
value. Used externally to determine if any filenames were updated.
Expand Down
2 changes: 1 addition & 1 deletion sleap/io/format/ndx_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def write(

Args:
filename: Output path for the NWB format file.
labels: The `Labels` object to covert to a NWB format file.
labels: The `Labels` object to convert to a NWB format file.
overwrite: Boolean that overwrites existing NWB file if True. If False, data
will be appended to existing NWB file.
session_description: Description for entire project. Stored under
Expand Down
6 changes: 3 additions & 3 deletions sleap/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def matches(self, other):
Check if attributes match.

Args:
other: The instance to comapare with.
other: The instance to compare with.

Returns:
True if attributes match, False otherwise
Expand Down Expand Up @@ -1539,7 +1539,7 @@ def make_specific_backend(backend_class, kwargs):

@staticmethod
def cattr():
"""Return a cattr converter for serialiazing/deserializing Video objects.
"""Return a cattr converter for serializing/deserializing Video objects.

Returns:
A cattr converter.
Expand Down Expand Up @@ -1607,7 +1607,7 @@ def fixup_path(
elif os.path.exists(os.path.basename(path)):
return os.path.basename(path)

# Special case: this is an ImgStore path! We cant use
# Special case: this is an ImgStore path! We can't use
# basename because it will strip the directory name off
elif path.endswith("metadata.yaml"):

Expand Down
2 changes: 1 addition & 1 deletion sleap/nn/architectures/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def backbone_fn(x: tf.Tensor, current_stride: int) -> tf.Tensor:
def tile_channels(X: tf.Tensor) -> tf.Tensor:
"""Tile single channel to 3 channel tensor.

This functon is useful to replicate grayscale single-channel images into 3-channel
This function is useful to replicate grayscale single-channel images into 3-channel
monochrome RGB images.

Args:
Expand Down
2 changes: 1 addition & 1 deletion sleap/nn/config/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AugmentationConfig:
See `imgaug.augmenters.arithmetic.AdditiveGaussianNoise`.
gaussian_noise_mean: Mean of the distribution to sample from.
gaussian_noise_stddev: Standard deviation of the distribution to sample from.
contrast: If True, gamma constrast adjustment will be applied to the image.
contrast: If True, gamma contrast adjustment will be applied to the image.
This scales all pixel values by `x ** gamma` where `x` is the pixel value in
the [0, 1] range. Values in [0, 255] are first scaled to [0, 1]. See
`imgaug.augmenters.contrast.GammaContrast`.
Expand Down
Loading
Loading