Skip to content

Commit

Permalink
Merge pull request #304 from arnabiswas/patch-1
Browse files Browse the repository at this point in the history
Update CONTRIBUTING.md
  • Loading branch information
BalzaniEdoardo authored Feb 4, 2025
2 parents 36435fb + 6d9a72e commit 07a9b22
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,28 @@ jobs:
- name: Check links
run: ./bash_scripts/prevent_absolute_links_to_docs.sh

check-links:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install markdown-link-check
run: npm install -g markdown-link-check

- name: Make .sh executable
run: chmod +x bash_scripts/check_markdown_links.sh

- name: Check links in root Markdown files
run: ./bash_scripts/check_markdown_links.sh

check:
if: ${{ !github.event.pull_request.draft }}
needs:
- tox_tests
- prevent_docs_absolute_links
- tox_check
- check-links
runs-on: ubuntu-latest
steps:
- name: Decide whether all tests and notebooks succeeded
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Developers are encouraged to contribute to various areas of development. This co

Feel free to work on any section of code that you believe you can improve. More importantly, remember to thoroughly test all your classes and functions, and to provide clear, detailed comments within your code. This not only aids others in using the library, but also facilitates future maintenance and further development.

For more detailed information about NeMoS modules, including design choices and implementation details, visit the [`For Developers`](https://nemos.readthedocs.io/en/latest/developers_notes/) section of the package documentation.
For more detailed information about NeMoS modules, including design choices and implementation details, visit the [`For Developers`](https://nemos.readthedocs.io/en/latest/developers_notes/README.html) section of the package documentation.

## Contributing to the code

Expand Down Expand Up @@ -46,7 +46,7 @@ pip install -e .[dev]
```

> [!NOTE]
> In order to install `nemos` in editable mode you will need a Python virtual environment. Please see our documentation [here](https://nemos.readthedocs.io/en/latest/installation/) that provides guidance on how to create and activate a virtual environment.
> In order to install `nemos` in editable mode you will need a Python virtual environment. Please see our documentation [here](https://nemos.readthedocs.io/en/latest/installation.html) that provides guidance on how to create and activate a virtual environment.
3) Add the upstream branch:

Expand Down Expand Up @@ -184,7 +184,7 @@ it must have an `.py` extension, and it must be contained within the `tests` dir
add it to the tests-to-run.
> [!NOTE]
> If you have many variants on a test you wish to run, you should make use of pytest's `parameterize` mark. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/parametrize.html) and NeMoS [`test_error_invalid_entry`](https://github.com/flatironinstitute/nemos/blob/main/tests/test_vallidation.py#L27) for a concrete implementation.
> If you have many variants on a test you wish to run, you should make use of pytest's `parameterize` mark. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/parametrize.html) and NeMoS [`test_error_invalid_entry`](https://github.com/flatironinstitute/nemos/blob/main/tests/test_validation.py) for a concrete implementation.
> [!NOTE]
> If you are using an object that gets used in multiple tests (such as a model with certain data, regularizer, or solver), you should use pytest's `fixtures` to avoid having to load or instantiate the object multiple times. Look at our `conftest.py` to see already available fixtures for your tests. See the official documentation [here](https://docs.pytest.org/en/stable/how-to/fixtures.html).
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ We provide a **Poisson GLM** for analyzing spike counts, and a **Gamma GLM** for
The package is under active development and more methods will be added in the future.

For those looking to get a better grasp of the Generalized Linear Model, we recommend checking out the
Neuromatch Academy's lesson [here](https://compneuro.neuromatch.io/tutorials/W1D3_GeneralizedLinearModels/student/W1D3_Tutorial1.htmls) and Jonathan Pillow's tutorial
Neuromatch Academy's lesson [here](https://compneuro.neuromatch.io/tutorials/W1D3_GeneralizedLinearModels/student/W1D3_Tutorial1.html) and Jonathan Pillow's tutorial
from Cosyne 2018 [here](https://www.youtube.com/watch?v=NFeGW5ljUoI&t=424s).

## Overview
Expand Down Expand Up @@ -99,7 +99,7 @@ ll = glm.score(X, y)
<img src="docs/assets/glm_population_scheme.svg" width="84%">

This second example demonstrates feature construction by convolving the simultaneously recorded population spike counts with a bank of filters, utilizing the basis in `conv` mode.
The figure above show the GLM scheme for a single neuron, however in NeMoS you can fit jointly the whole population with the [`PopulationGLM`](https://nemos.readthedocs.io/en/latest/generated/how_to_guide/plot_04_population_glm/) object.
The figure above show the GLM scheme for a single neuron, however in NeMoS you can fit jointly the whole population with the [`PopulationGLM`](https://nemos.readthedocs.io/en/latest/how_to_guide/plot_03_population_glm.html) object.

#### Feature Representation

Expand Down Expand Up @@ -127,8 +127,8 @@ firing_rate = glm.predict(X)
ll = glm.score(X, spike_counts)
```

For a deeper dive, see our [Quickstart](https://nemos.readthedocs.io/en/latest/quickstart/) guide and consider using [pynapple](https://github.com/pynapple-org/pynapple) for data exploration and preprocessing. When initializing the GLM object, you may optionally specify an [observation
model](https://nemos.readthedocs.io/en/latest/reference/nemos/observation_models/) and a [regularizer](https://nemos.readthedocs.io/en/latest/reference/nemos/regularizer/).
For a deeper dive, see our [Quickstart](https://nemos.readthedocs.io/en/latest/quickstart.html) guide and consider using [pynapple](https://github.com/pynapple-org/pynapple) for data exploration and preprocessing. When initializing the GLM object, you may optionally specify an [observation
model](https://nemos.readthedocs.io/en/latest/api_reference.html#the-nemos-observation-models-module) and a [regularizer](https://nemos.readthedocs.io/en/latest/api_reference.html#the-nemos-regularizer-module).

> **Note: Multi-epoch Convolution**
>
Expand All @@ -149,7 +149,7 @@ Run the following `pip` command in your virtual environment.
python -m pip install nemos
```

For more details, including specifics for GPU users and developers, refer to NeMoS [docs](https://nemos.readthedocs.io/en/latest/installation/).
For more details, including specifics for GPU users and developers, refer to NeMoS [docs](https://nemos.readthedocs.io/en/latest/installation.html).


## Disclaimer
Expand Down
35 changes: 35 additions & 0 deletions bash_scripts/check_markdown_links.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# Fail script if any command fails
set -e

# Find markdown-link-check path
MARKDOWN_LINK_CHECK=$(which markdown-link-check || echo "")

# If markdown-link-check is not found, print an error and exit
if [[ -z "$MARKDOWN_LINK_CHECK" ]]; then
echo "❌ ERROR: markdown-link-check command not found. Make sure it is installed globally."
exit 1
fi

echo "🔍 Checking Markdown links in root directory..."

# Initialize an error flag
ERROR=0
LOG_FILE=$(mktemp) # Temporary file to store output

# Find all Markdown files in the root directory and check links
for file in $(find . -maxdepth 1 -name "*.md"); do
echo "📂 Checking $file..."

# Run markdown-link-check and capture output
$MARKDOWN_LINK_CHECK "$file" 2>&1 | tee -a "$LOG_FILE"
done

# Check if "ERROR:" appears in the log file
if grep -q "ERROR:" "$LOG_FILE"; then
echo "🚨 Link check failed! Please fix broken links."
exit 1
else
echo "✅ All links are valid."
fi

0 comments on commit 07a9b22

Please sign in to comment.