From ed9cb28974908576181b1c0c5a58edefdea3cc1e Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:53:00 -0400 Subject: [PATCH 1/5] Add github action to codespell release on push and PRs --- .github/workflows/codespell.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/codespell.yml diff --git a/.github/workflows/codespell.yml b/.github/workflows/codespell.yml new file mode 100644 index 00000000..26a62d86 --- /dev/null +++ b/.github/workflows/codespell.yml @@ -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 From f0d039bfb4a8e4f8cc1b73436338d9c87f9c012b Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:53:00 -0400 Subject: [PATCH 2/5] Add rudimentary codespell config --- .codespellrc | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .codespellrc diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..da3c0571 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,4 @@ +[codespell] +skip = .git,*.pdf,*.svg +# +# ignore-words-list = From 943826cedf297042e2c0b948b4631667a042ef51 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:53:50 -0400 Subject: [PATCH 3/5] Initial skips for codespell --- .codespellrc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.codespellrc b/.codespellrc index da3c0571..baa75176 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,3 @@ [codespell] -skip = .git,*.pdf,*.svg -# -# ignore-words-list = +skip = .git,*.pdf,*.svg,LICENSE.md +ignore-words-list = ans From 8805f5b71375714a2d6d5b56ab4144f35d3064b4 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:54:09 -0400 Subject: [PATCH 4/5] [DATALAD RUNCMD] Do interactive fixing of some ambigous typos === Do not change lines below === { "chain": [], "cmd": "codespell -w -i 3 -C 2 ./moseq2_viz/gui.py", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- moseq2_viz/gui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moseq2_viz/gui.py b/moseq2_viz/gui.py index 6b10add6..dfe187c4 100644 --- a/moseq2_viz/gui.py +++ b/moseq2_viz/gui.py @@ -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 From 8d21e7734fd4474fdb1ee301828ab6faee02e4e7 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Thu, 31 Aug 2023 14:54:12 -0400 Subject: [PATCH 5/5] [DATALAD RUNCMD] run codespell throughout fixing typo automagically === Do not change lines below === { "chain": [], "cmd": "codespell -w", "exit": 0, "extra_inputs": [], "inputs": [], "outputs": [], "pwd": "." } ^^^ Do not change lines above ^^^ --- moseq2_viz/helpers/wrappers.py | 2 +- moseq2_viz/info/util.py | 4 ++-- moseq2_viz/io/video.py | 2 +- moseq2_viz/model/fingerprint_classifier.py | 2 +- moseq2_viz/model/stat.py | 4 ++-- moseq2_viz/model/util.py | 2 +- moseq2_viz/viz.py | 16 ++++++++-------- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/moseq2_viz/helpers/wrappers.py b/moseq2_viz/helpers/wrappers.py index 5663a92a..79000cbc 100644 --- a/moseq2_viz/helpers/wrappers.py +++ b/moseq2_viz/helpers/wrappers.py @@ -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 diff --git a/moseq2_viz/info/util.py b/moseq2_viz/info/util.py index 3c68f7ce..ef512837 100644 --- a/moseq2_viz/info/util.py +++ b/moseq2_viz/info/util.py @@ -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: @@ -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. diff --git a/moseq2_viz/io/video.py b/moseq2_viz/io/video.py index 7571c6bc..a1ca585d 100644 --- a/moseq2_viz/io/video.py +++ b/moseq2_viz/io/video.py @@ -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. """ diff --git a/moseq2_viz/model/fingerprint_classifier.py b/moseq2_viz/model/fingerprint_classifier.py index 22d9052d..1fbcc370 100644 --- a/moseq2_viz/model/fingerprint_classifier.py +++ b/moseq2_viz/model/fingerprint_classifier.py @@ -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. diff --git a/moseq2_viz/model/stat.py b/moseq2_viz/model/stat.py index d4e3563f..c4896297 100644 --- a/moseq2_viz/model/stat.py +++ b/moseq2_viz/model/stat.py @@ -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) @@ -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 diff --git a/moseq2_viz/model/util.py b/moseq2_viz/model/util.py index 8e0d993d..f2612f51 100644 --- a/moseq2_viz/model/util.py +++ b/moseq2_viz/model/util.py @@ -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) diff --git a/moseq2_viz/viz.py b/moseq2_viz/viz.py index 0dec2f92..0bc13e8c 100644 --- a/moseq2_viz/viz.py +++ b/moseq2_viz/viz.py @@ -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 @@ -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: @@ -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') @@ -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) @@ -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