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

codespell: action, config + some typos fixed #183

Open
wants to merge 5 commits into
base: release
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
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = .git,*.pdf,*.svg,LICENSE.md
ignore-words-list = ans
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: [release]
pull_request:
branches: [release]

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 moseq2_viz/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def add_group(index_file, by='SessionName', value='default', group='default', ex

def get_best_fit_model(progress_paths, output_file=None, plot_all=False, fps=30, ext='p', objective='duration (mean match)'):
"""
Return the best model in the model foder that is closest to model free changepoint in the given objective.
Return the best model in the model folder that is closest to model free changepoint in the given objective.

Args:
progress_paths (dict): Dictionary containing paths the to model directory and pc scores file
Expand Down
2 changes: 1 addition & 1 deletion moseq2_viz/helpers/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def plot_syllable_stat_wrapper(model_fit, index_file, output_file, stat='usage',
index_file (str): path to index file.
output_file (str): filename for syllable usage graph.
stat (str): syllable statistic to plot.
sort (bool): sort syllables by parameter specified in count paramter.
sort (bool): sort syllables by parameter specified in count parameter.
count (str): method to compute syllable mean usage, either 'usage' or 'frames'.
group (tuple, list, None): tuple or list of groups to include in usage plot. (None to graph all groups)
max_syllable (int): the index of the maximum number of syllables to include
Expand Down
4 changes: 2 additions & 2 deletions moseq2_viz/info/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def entropy_rate(labels, truncate_syllable=40, normalize='bigram',
truncate_syllable (int): maximum number of labels to keep for this calculation.
normalize (str): the type of transition matrix normalization to perform.
smoothing (float): a constant as pseudocount added to label usages before normalization
tm_smoothing (float): a constant as pseudocount added to label transtition counts before normalization.
tm_smoothing (float): a constant as pseudocount added to label transition counts before normalization.
relabel_by (str): how to re-order labels. Options are: 'usage', 'frames', or None.

Returns:
Expand Down Expand Up @@ -111,7 +111,7 @@ def transition_entropy(labels, tm_smoothing=0, truncate_syllable=40, transition_

Args:
labels (list or np.ndarray): a list of label arrays, where each entry in the list is an array of labels for one session.
tm_smoothing (float): a constant as pseudocount added to label transtition counts before normalization.
tm_smoothing (float): a constant as pseudocount added to label transition counts before normalization.
truncate_syllable (int): maximum number of relabeled syllable to keep for this calculation
transition_type (str): can be either "incoming" or "outgoing" to compute the entropy of each incoming or outgoing syllable transition.
relabel_by (str): how to re-order labels. Options are: 'usage', 'frames', or None.
Expand Down
2 changes: 1 addition & 1 deletion moseq2_viz/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def write_crowd_movie_info_file(model_path, model_fit, index_file, output_dir):

Args:
model_path (str): path to model used to generate movies
model_fit (dict): loaded ARHMM mdoel results
model_fit (dict): loaded ARHMM model results
index_file (str): path to index file used with model
output_dir (str): path to crowd movies directory to store file in.
"""
Expand Down
2 changes: 1 addition & 1 deletion moseq2_viz/model/fingerprint_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def classifier_fingerprint(summary, features=['MoSeq'], preprocessor=None, class
preprocessor (sklearn.preprocessing object, optional): Scalar for scaling the data by feature. Defaults to None.
target (list, optional): labels the classifier predicts. Defaults to ['group'].
param_search (bool, optional): run GridSearchCV to find the regularization param for classifier. Defaults to True.
C_list (numpy.array, optional): list of C regularization paramters to search through. Defaults to None. If None, C_list will search through np.logspace(-6,3, 50)
C_list (numpy.array, optional): list of C regularization parameters to search through. Defaults to None. If None, C_list will search through np.logspace(-6,3, 50)
model_type (str, optional): name of the linear classifier. 'lr' for logistic regression or 'svc' for linearSVC. Defaults to 'lr'.
cv (str, optional): cross validation type. 'loo' for LeaveOneOut 'skf' for StratifiedKFold. Defaults to 'loo'.
n_splits (int, optional): number of splits for StratifiedKFold. Defaults to 5.
Expand Down
4 changes: 2 additions & 2 deletions moseq2_viz/model/stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def ztest_vect(d1, d2):

def bootstrap_group_means(df, group1, group2, statistic="usage", max_syllable=40):
"""
compute boostrapped group means
compute bootstrapped group means

Args:
df (pandas.DataFrame): dataframe that contains syllable statistics per session (mean_df/stats_df)
Expand Down Expand Up @@ -565,7 +565,7 @@ def ttest(df, group1, group2, statistic="usage", max_syllable=40, verbose=False,

def get_sig_syllables(df_pvals, thresh=0.05, mc_method="fdr_bh", verbose=False):
"""
Runs multiple p-value comparisons test given a set alpha threshold with mutliple test correction.
Runs multiple p-value comparisons test given a set alpha threshold with multiple test correction.

Args:
df_pvals (pandas.DataFrame): dataframe listing raw p-values
Expand Down
2 changes: 1 addition & 1 deletion moseq2_viz/model/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def prepare_model_dataframe(model_path, pca_path):
def simulate_ar_trajectory(ar_mat, init_points=None, sim_points=100):
"""
Simulate auto-regressive trajectory matrices from
a set of initalized points.
a set of initialized points.

Args:
ar_mat (2D np.ndarray): numpy array representing the autoregressive matrix of a model state with shape (npcs, npcs * nlags + 1)
Expand Down
16 changes: 8 additions & 8 deletions moseq2_viz/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def _validate_and_order_syll_stats_params(complete_df, stat='usage', ordering='s
ordering (str, list, None): statistics for sorting syllables on or a list for syllable ordering.
max_sylls (int): the index of the maximum number of syllables to include
groups (list): list of groups to include in plot. If groups=None, all groups will be plotted.
ctrl_group (str): name of control group for computing usage difference beween two groups.
exp_group (str): name of experimental group for computing usage difference beween two groups.
ctrl_group (str): name of control group for computing usage difference between two groups.
exp_group (str): name of experimental group for computing usage difference between two groups.
colors (list): list of user-selected colors to represent the data
figsize (tuple): tuple value of length = 2, representing (height x width) of the plotted figure dimensions

Expand Down Expand Up @@ -160,10 +160,10 @@ def make_crowd_matrix(slices, nexamples=50, pad=30, raw_size=(512, 424), outmovi
min_dur (int): minimum syllable duration.
scale (int): mouse size scaling factor.
center (bool): boolean flag that indicates whether mice are centered.
rotate (bool): boolean flag that indicates wehther to rotate mice and orient them.
select_median_duration_instances (bool): flag that indicates wehther to select examples with syallable duration closer to median.
rotate (bool): boolean flag that indicates whether to rotate mice and orient them.
select_median_duration_instances (bool): flag that indicates whether to select examples with syallable duration closer to median.
min_height (int): minimum max height from floor to use.
legacy_jitter_fix (bool): flag that indicates wehther to apply jitter fix for K1 camera.
legacy_jitter_fix (bool): flag that indicates whether to apply jitter fix for K1 camera.
kwargs (dict): extra keyword arguments

Returns:
Expand All @@ -175,7 +175,7 @@ def make_crowd_matrix(slices, nexamples=50, pad=30, raw_size=(512, 424), outmovi

rng = np.random.default_rng(seed)

# set up x, y value to crop out the mouse with respect to the mouse centriod
# set up x, y value to crop out the mouse with respect to the mouse centroid
xc0, yc0 = crop_size[1] // 2, crop_size[0] // 2
xc = np.arange(-xc0, xc0 + 1, dtype='int16')
yc = np.arange(-yc0, yc0 + 1, dtype='int16')
Expand Down Expand Up @@ -287,7 +287,7 @@ def make_crowd_matrix(slices, nexamples=50, pad=30, raw_size=(512, 424), outmovi

rot_mat = cv2.getRotationMatrix2D((xc0, yc0), angles[i], 1)

# add the new instance to the exisiting crowd matrix
# add the new instance to the existing crowd matrix
old_frame = crowd_matrix[i]
new_frame = np.zeros_like(old_frame)

Expand Down Expand Up @@ -616,7 +616,7 @@ def plot_cp_comparison(model_results, pc_cps, plot_all=False, best_model=None, b
pc_cps (np.array): Computed PC changepoints
plot_all (bool): Boolean flag that indicates whether to plot all model changepoints for all keys included in model_cps dict.
best_model (str): key name to the model with the closest median syllable duration
bw_adjust (float): fraction to modify bandwith of kernel density estimate. (lower = higher definition)
bw_adjust (float): fraction to modify bandwidth of kernel density estimate. (lower = higher definition)

Returns:
fig (pyplot.figure): syllable usage ordered by frequency, 90% usage marked
Expand Down