deringeorge commited on
Commit
458e32a
·
1 Parent(s): 5ffa131

docs: add CONTRIBUTING guide and CODE_OF_CONDUCT for open-source community

Browse files
Files changed (2) hide show
  1. CODE_OF_CONDUCT.md +72 -0
  2. CONTRIBUTING.md +243 -0
CODE_OF_CONDUCT.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Code of Conduct
2
+
3
+ SONARIS sits at the intersection of naval engineering, environmental science, acoustic research, and open-source software. The people working on it come from different countries, disciplines, and levels of experience. Some are professional engineers. Some are researchers. Some are students. Some are activists. That range of backgrounds is what makes the project scientifically credible and practically useful.
4
+
5
+ For this community to work, everyone needs to be able to participate without hostility, condescension, or exclusion. This document describes what that means in practice.
6
+
7
+ ---
8
+
9
+ ## Our Standards
10
+
11
+ ### Expected behavior
12
+
13
+ - Communicate with respect, even when you disagree. Scientific disagreement is part of the process here, and that requires the ability to challenge ideas without attacking the people who hold them.
14
+ - Give credit where it is due. If a contribution, an idea, or a dataset came from someone else, say so.
15
+ - Be specific when giving feedback. "This approach is wrong" is not useful. "This masking model underestimates threshold shifts at high SPL because it does not account for upward spread; see Moore (2012) p.87" is useful.
16
+ - Accept that you might be wrong. Everyone working on this project is operating near the edge of their knowledge in at least one area. That is fine. Stay open to correction.
17
+ - Consider the experience of people who are newer to the codebase, the science, or open-source contribution generally. Not everyone starts with the same context.
18
+
19
+ ### Unacceptable behavior
20
+
21
+ - Harassment of any kind, including unwanted attention, threats, and targeted mockery.
22
+ - Discrimination based on nationality, gender, age, ethnicity, religion, sexual orientation, disability, or any other personal characteristic.
23
+ - Dismissing contributions because of who made them rather than what they contain.
24
+ - Publishing someone's personal information without their explicit consent.
25
+ - Sustained interruption of discussions, deliberate derailing of technical threads, or bad-faith engagement intended to frustrate rather than resolve.
26
+ - Using SONARIS project spaces to promote unrelated commercial products or services.
27
+
28
+ ---
29
+
30
+ ## Scope
31
+
32
+ This code of conduct applies in all project spaces: the GitHub repository, issues, pull requests, discussions, and any public forum where someone is representing SONARIS. It also applies to private communication when a participant brings a complaint about conduct that occurred in those spaces.
33
+
34
+ ---
35
+
36
+ ## Enforcement
37
+
38
+ ### Reporting
39
+
40
+ If you experience or witness behavior that violates this code of conduct, report it by opening a GitHub issue marked with the label `conduct-report`, or by contacting the project maintainer directly through GitHub. Reports will be handled with discretion. The identity of the person reporting will not be disclosed without their consent.
41
+
42
+ When filing a report, include as much context as you can: what happened, where, when, and who was involved. If there are links to the relevant comments or threads, include them.
43
+
44
+ ### What happens after a report
45
+
46
+ The maintainer will review the report, gather additional context if needed, and determine the appropriate response. The person who filed the report will be informed of the outcome. All reports are taken seriously. No report will be dismissed without review.
47
+
48
+ ### Enforcement ladder
49
+
50
+ Responses to violations follow a four-level escalation based on the severity and frequency of the behavior.
51
+
52
+ **1. Correction**
53
+
54
+ For minor violations, such as a single instance of dismissive language or an inappropriate comment. The maintainer will contact the person privately, explain the problem, and ask them to correct the behavior. A public apology may be requested.
55
+
56
+ **2. Warning**
57
+
58
+ For a more serious violation, or a repeated minor violation after correction. The person receives a formal warning. Continued participation is conditional on improved conduct. Further violations will result in a temporary ban.
59
+
60
+ **3. Temporary ban**
61
+
62
+ For a serious violation or pattern of behavior that has continued after a warning. The person is removed from all project spaces for a defined period. No contact with the project community is permitted during this period, including through third parties. Re-entry requires acknowledgment of the conduct issue.
63
+
64
+ **4. Permanent ban**
65
+
66
+ For sustained harmful behavior, harassment, or conduct that creates a genuinely hostile environment for other participants. The person is permanently removed from all project spaces with no path to re-entry.
67
+
68
+ ---
69
+
70
+ ## Attribution
71
+
72
+ This Code of Conduct is adapted from the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/), maintained by Coraline Ada Ehmke and contributors. The enforcement guidelines draw from Mozilla's conduct enforcement ladder.
CONTRIBUTING.md ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to SONARIS
2
+
3
+ SONARIS is an open-source platform for predicting ship underwater radiated noise, verifying IMO compliance, and quantifying acoustic harm to marine mammals. It is student-led, research-grade, and built to be used by shipyards, classification societies, environmental NGOs, naval engineers, and ocean researchers worldwide. Every meaningful contribution, whether code, data, documentation, or scientific critique, directly improves a tool that has real environmental consequences.
4
+
5
+ Contributors from any background are welcome. You do not need to be a software engineer. Naval architects, acousticians, marine biologists, oceanographers, and data scientists all have things to contribute here that a programmer alone cannot.
6
+
7
+ ---
8
+
9
+ ## Types of Contributions
10
+
11
+ ### Code
12
+
13
+ - New features within any of the six modules
14
+ - Bug fixes with a clear description of the problem being solved
15
+ - Tests that cover untested behavior in existing code
16
+ - Performance improvements to signal processing pipelines or model inference
17
+ - Refactoring that improves readability or reduces technical debt without changing behavior
18
+
19
+ ### Data
20
+
21
+ - Measured URN spectra for any vessel type, submitted to the Open URN Database (Module 6)
22
+ - Published audiogram data for marine mammal species not currently covered in Module 4
23
+ - Validation datasets that can be used to benchmark the URN prediction model against real measurements
24
+ - Marine protected area boundary files or shipping lane data for the routing avoidance module
25
+
26
+ ### Documentation
27
+
28
+ - Corrections or clarifications to existing docs
29
+ - API reference entries for undocumented functions
30
+ - Tutorials showing how to use SONARIS for a specific task
31
+ - Research notes that explain the scientific background behind a module
32
+
33
+ ### Scientific Contributions
34
+
35
+ - Methodology improvements backed by published literature
36
+ - Challenges to existing algorithms, including the BIS scoring formula, the MFCC feature pipeline, or the masking model
37
+ - Literature reviews that identify gaps or errors in the current approach
38
+ - Validation studies comparing SONARIS predictions to measured data
39
+
40
+ ### Bug Reports
41
+
42
+ If something is broken or produces incorrect results, filing a clear bug report is a contribution. Instructions are in the Reporting Bugs section below.
43
+
44
+ ---
45
+
46
+ ## Getting Started
47
+
48
+ ```bash
49
+ # Clone the repository
50
+ git clone https://github.com/deringeorge-nebula/SONARIS.git
51
+ cd SONARIS
52
+
53
+ # Create and activate a virtual environment
54
+ python -m venv venv
55
+
56
+ # Windows
57
+ venv\Scripts\activate
58
+
59
+ # macOS / Linux
60
+ source venv/bin/activate
61
+
62
+ # Install dependencies
63
+ pip install -r requirements.txt
64
+ ```
65
+
66
+ **Note on mSOUND:** The mSOUND acoustic simulation library is not available via pip and must be integrated manually from source. This is only required for Phase 3 work on the physics simulation layer. If you are not working on OpenFOAM or wave propagation components, you do not need it.
67
+
68
+ **Note on pyaudio:** pyaudio has been removed from requirements.txt due to a wheel incompatibility with Python 3.14. It is not required for any current development work. All audio processing uses librosa and scipy.
69
+
70
+ After installation, verify your setup:
71
+
72
+ ```bash
73
+ pytest tests/ -v
74
+ ```
75
+
76
+ All tests should pass before you begin making changes.
77
+
78
+ ---
79
+
80
+ ## Contribution Workflow
81
+
82
+ ### 1. Fork and branch
83
+
84
+ Fork the repository on GitHub, then create a branch from `main` using the naming conventions below.
85
+
86
+ ```
87
+ feat/module-name-description # new features
88
+ fix/issue-description # bug fixes
89
+ data/dataset-name # data contributions
90
+ docs/topic # documentation changes
91
+ ```
92
+
93
+ Examples:
94
+
95
+ ```
96
+ feat/module4-porpoise-audiogram
97
+ fix/module2-mfcc-window-overlap
98
+ data/shipsear-bulk-carrier-records
99
+ docs/bis-scoring-methodology
100
+ ```
101
+
102
+ ### 2. Make your changes
103
+
104
+ Keep commits focused. One logical change per commit. Write commit messages in the imperative: `Add porpoise audiogram to Module 4` not `Added porpoise audiogram`.
105
+
106
+ ### 3. Run tests
107
+
108
+ ```bash
109
+ pytest tests/ -v
110
+ ```
111
+
112
+ If your change touches a specific module, run only that module's tests first:
113
+
114
+ ```bash
115
+ pytest tests/test_module4/ -v
116
+ ```
117
+
118
+ Add new tests for any new behavior you introduce. Untested code will not be merged.
119
+
120
+ ### 4. Submit a pull request
121
+
122
+ Open a pull request against the `main` branch. In the description:
123
+
124
+ - State what the change does and why it is needed
125
+ - Reference any related issue with `Closes #issue-number` if applicable
126
+ - For scientific changes, cite the source that justifies the approach
127
+ - For data contributions, include metadata as described in the Data Contribution Guidelines below
128
+
129
+ PRs will be reviewed for correctness, code quality, and scientific validity. Reviews may take time. If you do not hear back within two weeks, comment on the PR to follow up.
130
+
131
+ ---
132
+
133
+ ## Code Standards
134
+
135
+ **Style:** Follow PEP 8. Line length maximum is 100 characters. Use `black` for formatting and `isort` for import ordering. Both are in requirements.txt.
136
+
137
+ ```bash
138
+ black sonaris/
139
+ isort sonaris/
140
+ ```
141
+
142
+ **Type hints:** All functions in the six core module directories (`sonaris/module1_input/` through `sonaris/module6_database/`) must include type hints on all parameters and return values. Shared utilities in `sonaris/shared/` should also have type hints but may have exceptions for highly dynamic functions.
143
+
144
+ **Docstrings:** Use Google-style docstrings. Every public function and class needs a docstring that states what it does, what the parameters are, and what it returns. For functions that implement a specific algorithm or formula, include a reference to the source.
145
+
146
+ Example:
147
+
148
+ ```python
149
+ def compute_bis(
150
+ ship_spectrum_db: np.ndarray,
151
+ audiogram_db: np.ndarray,
152
+ frequency_bands: np.ndarray
153
+ ) -> float:
154
+ """Compute the Biological Interference Score for a single species group.
155
+
156
+ Calculates the proportion of the species' audible frequency range where
157
+ ship noise exceeds the masking threshold, normalized to a 0-100 scale.
158
+ Based on the masking model described in Moore (2012), Chapter 3.
159
+
160
+ Args:
161
+ ship_spectrum_db: Received ship noise level in dB re 1 uPa, one value
162
+ per 1/3-octave band.
163
+ audiogram_db: Hearing threshold in dB re 1 uPa for the species group,
164
+ aligned to the same frequency bands.
165
+ frequency_bands: Center frequencies of each 1/3-octave band in Hz.
166
+
167
+ Returns:
168
+ BIS score from 0.0 (no interference) to 100.0 (complete masking).
169
+ """
170
+ ```
171
+
172
+ **Inline comments:** Write comments to explain why, not what. If the code is readable and the comment just restates what the line does, delete the comment.
173
+
174
+ **Tests:** Use pytest. Test files go in `tests/test_moduleN/` matching the module being tested. Test functions should have names that describe the specific scenario being tested, not just the function name.
175
+
176
+ ---
177
+
178
+ ## Data Contribution Guidelines
179
+
180
+ Measured or published URN data can be contributed directly to the Open URN Database (Module 6). Data contributions are valuable even if you cannot contribute code.
181
+
182
+ ### Required metadata for each record
183
+
184
+ | Field | Description |
185
+ |---|---|
186
+ | `vessel_type` | IMO vessel type category (cargo, tanker, container, bulk, passenger, etc.) |
187
+ | `length_m` | Length between perpendiculars in meters |
188
+ | `speed_knots` | Ship speed during measurement |
189
+ | `engine_type` | Diesel, diesel-electric, gas turbine, or other |
190
+ | `propeller_type` | FPP, CPP, or other, with blade count if known |
191
+ | `measurement_method` | How the data was acquired: sea trial, tank test, model prediction, published paper |
192
+ | `frequency_resolution` | 1/3-octave, 1/1-octave, or narrowband |
193
+ | `source_reference` | DOI, report number, or dataset name |
194
+ | `license` | Confirm the data can be shared under CC BY 4.0 or equivalent |
195
+
196
+ ### Format
197
+
198
+ Submit spectra as a CSV with columns `frequency_hz` and `spl_db` (dB re 1 µPa @ 1m). Include a JSON sidecar file with the metadata fields above. See `data/seed/` for examples of the expected format.
199
+
200
+ ### How to submit
201
+
202
+ For small submissions (fewer than 10 records), include the CSV and JSON files in a pull request under `data/contributions/`. For larger datasets, open a GitHub issue with the label `data-contribution` and describe the dataset. We will coordinate the ingestion process.
203
+
204
+ Data contributed to SONARIS must be yours to share, or from a published source with a license that permits redistribution. Do not submit proprietary or confidential data.
205
+
206
+ ---
207
+
208
+ ## Reporting Bugs
209
+
210
+ Before filing a bug report, check whether the issue already exists in the [GitHub Issues](https://github.com/deringeorge-nebula/SONARIS/issues) list.
211
+
212
+ When filing a new issue, use the Bug Report template and include:
213
+
214
+ - **What you expected to happen**, stated specifically
215
+ - **What actually happened**, with the full error message or incorrect output
216
+ - **Steps to reproduce the issue**, as minimal as possible
217
+ - **Your environment:** operating system, Python version, relevant package versions
218
+ - **Which module** the bug is in, if known
219
+
220
+ If the bug produces incorrect scientific output (wrong URN values, wrong compliance verdict, wrong BIS score), that is a high-priority issue. Flag it clearly and include the input parameters that produced the wrong result.
221
+
222
+ ---
223
+
224
+ ## Scientific Contributions
225
+
226
+ SONARIS's methodology is not fixed. The BIS scoring formula, the psychoacoustic masking model, the MFCC feature pipeline, and the compliance interpretation logic are all open to scrutiny and improvement.
227
+
228
+ To propose a methodology change:
229
+
230
+ 1. Open a thread in [GitHub Discussions](https://github.com/deringeorge-nebula/SONARIS/discussions) under the "Science" category
231
+ 2. State the current approach and what you believe is wrong or suboptimal about it
232
+ 3. Propose an alternative, with citations to published literature that support it
233
+ 4. If you have validation data that demonstrates the improvement, include it or describe how to obtain it
234
+
235
+ Scientific disagreement is welcome and expected. A methodology that has been challenged and defended is more credible than one that has not been examined. If you believe a part of the platform produces results that are scientifically indefensible, say so clearly and explain why.
236
+
237
+ For literature contributions, you can open a Discussion thread or submit a PR adding references to `docs/datasets.md` or `docs/methodology.md`. Include the full citation and a one-paragraph summary of how the source is relevant.
238
+
239
+ ---
240
+
241
+ ## Contact
242
+
243
+ Open a [GitHub Discussion](https://github.com/deringeorge-nebula/SONARIS/discussions) for questions, ideas, or anything that does not fit into an issue. For bugs and specific technical problems, file a [GitHub Issue](https://github.com/deringeorge-nebula/SONARIS/issues).