|
1 | | - |
2 | 1 | # Quickstart for Contributors 🚀 |
3 | 2 |
|
4 | | -The best way to contribute to c4dynamics is by providing a well-documented use case notebook in the [Use Cases section](https://c4dynamics.github.io/C4dynamics/programs/index.html) of the documentation. |
5 | | -These notebooks help other engineers quickly understand how to apply the framework in practice. |
6 | | - |
7 | | ---- |
8 | | -## How to Add a Use Case Notebook |
9 | | - |
10 | | -* Fork the repository (top-right corner of the GitHub page) |
11 | | -* Design your model or algorithm simulation |
12 | | -* Build with state objects |
13 | | -* Extend with modules from the scientific library (e.g. sensors, filters, detectors) |
14 | | -* Write your program in a Jupyter notebook |
15 | | - - Keep it simple yet functional |
16 | | - - Add comments and documentation to explain your approach |
17 | | - - Test thoroughly: make sure it runs without errors and produces meaningful results |
18 | | - - Visualize outputs: use c4dynamics tools |
19 | | - |
20 | | ---- |
21 | | -## New Features and Features Modifications |
22 | | - |
23 | | -If you come up with an idea for a new function or capability, please open an issue first so it can be discussed. Once agreed, you can start working on it in a separate scope. However, any change to the c4dynamics module requires following c4dynamics standards: |
24 | | - |
25 | | -* Coding |
26 | | - - PEP8-adjacent: Follow Python conventions (imports at the top, clear indentation, type hints with Optional) |
27 | | - - NumPy-based math: Use np.atleast_1d, np.atleast_2d, and standard linear algebra structures |
28 | | - - Defensive coding: Check for None values, enforce shapes (np.atleast_2d), raise errors (TypeError) for invalid argument combinations |
29 | | - |
30 | | -* Commenting |
31 | | - - Extensive docstrings (triple quotes inside class and methods): |
32 | | - + Follow the NumPy docstring standard |
33 | | - + Include doctest-style code snippets inside the docstrings for demonstration and validation |
34 | | - + Provide references to related modules/classes (cross-referencing using `:class:` and `:mod:`) |
35 | | - - Inline comments: |
36 | | - + Short, pragmatic explanations inside functions |
37 | | - + Not verbose, just clarifies tricky implementation details |
38 | | - |
39 | | -* Testing |
40 | | - - Doctest-first: |
41 | | - + The examples inside the docstrings use also as test cases, runnable via `doctest.testmod()` |
42 | | - + Use doctest options like +NUMPY_FORMAT to ignore formatting variations in arrays |
43 | | - - Self-contained testing block: |
44 | | - + Wrapped in if `__name__ == "__main__"`:, so tests can be run simply by executing the file. |
45 | | - - Results are either printed to console (`cprint`) or redirected to a log file. |
46 | | - - Use `FAIL_FAST` so tests stop at the first failure |
47 | | - |
48 | | - |
49 | | -Once your changes are ready, submit your version: |
50 | | - |
51 | | -* Fork the repository (top-right corner of the GitHub page) |
52 | | -* Add comments and documentation to explain your approach |
53 | | -* Add docstring examples and tests in the dedicated unittest files |
54 | | -* Test thoroughly: make sure it runs without errors and produces meaningful results |
55 | | -* Run the doctests locally. Run: ```python tests/run_doctests.py``` |
56 | | -* Run the unit tests locally. Run: ```python tests/run_unittests.py``` |
| 3 | +Welcome! Whether it’s your first contribution or you’re an experienced engineer, this guide will help you contribute to **c4dynamics**. |
| 4 | + |
| 5 | +We mainly accept contributions in two areas: |
| 6 | + |
| 7 | +1. **Use Case Notebooks** – Practical examples demonstrating framework usage. |
| 8 | +2. **New Features / Feature Modifications** – Extensions or improvements to the framework itself. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## 1️⃣ Use Case Notebook |
| 13 | + |
| 14 | +The best way to contribute to c4dynamics is by providing a well-documented use case notebook in the [Use Cases section](https://c4dynamics.github.io/C4dynamics/programs/index.html) of the documentation. |
| 15 | + |
| 16 | +These notebooks help engineers quickly understand how to apply **c4dynamics** in practice. |
| 17 | + |
| 18 | +### steps: |
| 19 | + |
| 20 | +1. **Fork the repository** (top-right corner on GitHub). |
| 21 | +2. **Set up your environment** (install dependencies, etc.). |
| 22 | +3. **Design your model or algorithm simulation.** |
| 23 | +4. **Build using state objects** and extend with modules from the scientific library (e.g., sensors, filters, detectors). |
| 24 | +5. **Write your program in a Jupyter notebook.** |
| 25 | + |
| 26 | + * Keep it simple yet functional. |
| 27 | + * Add comments and documentation to explain your approach. |
| 28 | +6. **Test thoroughly:** Ensure it runs without errors and produces meaningful results. |
| 29 | +7. **Visualize outputs** using **c4dynamics** tools. |
| 30 | +8. **Submit your contribution**: |
| 31 | + |
| 32 | + * Add your notebook to the `Use Cases` section of the documentation. |
| 33 | + * Include any comments, explanations, and docstring examples. |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## 2️⃣ New Features or Modifying Existing Ones |
| 38 | + |
| 39 | +If you have an idea for a new function or feature: |
| 40 | + |
| 41 | +1. **Open an issue first** to discuss the proposal. |
| 42 | +2. Once approved, **work in a separate feature branch**. |
| 43 | + |
| 44 | +### Coding Standards |
| 45 | + |
| 46 | +* **Follow Python conventions** (PEP8-adjacent). |
| 47 | +* **Use NumPy-based math:** `np.atleast_1d`, `np.atleast_2d`, standard linear algebra structures. |
| 48 | +* **Defensive coding:** Check for `None`, enforce shapes, raise `TypeError` for invalid arguments. |
| 49 | + |
| 50 | +### Commenting & Documentation |
| 51 | + |
| 52 | +* **Docstrings:** Use triple quotes, follow NumPy style, include doctest examples, reference related modules/classes. |
| 53 | +* **Inline comments:** Short, clear explanations of tricky code parts. |
| 54 | + |
| 55 | +### Testing |
| 56 | + |
| 57 | +* **Doctests:** Include examples inside docstrings. Run via `doctest.testmod()`. |
| 58 | +* **Self-contained testing block:** Wrap in `if __name__ == "__main__":`. |
| 59 | +* **Unit tests:** Add tests to the dedicated unittest files. |
| 60 | +* **Run tests locally:** |
| 61 | + |
| 62 | + ```bash |
| 63 | + python tests/run_doctests.py |
| 64 | + python tests/run_unittests.py |
| 65 | + ``` |
| 66 | + |
| 67 | +### Submitting Changes |
| 68 | + |
| 69 | +1. Fork the repository (if not already done). |
| 70 | +2. Commit your changes with clear messages. |
| 71 | +3. Push your feature branch. |
| 72 | +4. Open a Pull Request (PR) for review. |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## ✅ Tips for First-Time Contributors |
| 77 | + |
| 78 | +* Start with a small **use case notebook** to get familiar with the framework. |
| 79 | +* Don’t worry about perfection—your contribution will be reviewed and improved collaboratively. |
| 80 | +* Read the examples in existing notebooks to see formatting and documentation standards. |
57 | 81 |
|
0 commit comments