pySEAFOM 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyseafom-0.1.0/.github/CODEOWNERS +6 -0
- pyseafom-0.1.0/.github/workflows/pr-approvals-check.yml +84 -0
- pyseafom-0.1.0/LICENSE +21 -0
- pyseafom-0.1.0/MANIFEST.in +12 -0
- pyseafom-0.1.0/PKG-INFO +235 -0
- pyseafom-0.1.0/README.md +195 -0
- pyseafom-0.1.0/pyproject.toml +54 -0
- pyseafom-0.1.0/self_noise_test.ipynb +468 -0
- pyseafom-0.1.0/setup.cfg +4 -0
- pyseafom-0.1.0/setup.py +56 -0
- pyseafom-0.1.0/source/pySEAFOM.egg-info/PKG-INFO +235 -0
- pyseafom-0.1.0/source/pySEAFOM.egg-info/SOURCES.txt +13 -0
- pyseafom-0.1.0/source/pySEAFOM.egg-info/dependency_links.txt +1 -0
- pyseafom-0.1.0/source/pySEAFOM.egg-info/requires.txt +10 -0
- pyseafom-0.1.0/source/pySEAFOM.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
name: Require 1 Admin and 1 Maintainer Approval
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
types: [opened, synchronize, reopened, ready_for_review, review_requested]
|
|
6
|
+
pull_request_review:
|
|
7
|
+
types: [submitted, edited, dismissed]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
pull-requests: read
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
check-approvals:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/github-script@v7
|
|
18
|
+
with:
|
|
19
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
20
|
+
script: |
|
|
21
|
+
const core = require('@actions/core');
|
|
22
|
+
const prNumber = context.payload.pull_request
|
|
23
|
+
? context.payload.pull_request.number
|
|
24
|
+
: context.payload.review.pull_request_url.split('/').pop();
|
|
25
|
+
|
|
26
|
+
const { data: pr } = await github.rest.pulls.get({
|
|
27
|
+
owner: context.repo.owner,
|
|
28
|
+
repo: context.repo.repo,
|
|
29
|
+
pull_number: prNumber,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const { data: reviews } = await github.rest.pulls.listReviews({
|
|
33
|
+
owner: context.repo.owner,
|
|
34
|
+
repo: context.repo.repo,
|
|
35
|
+
pull_number: pr.number,
|
|
36
|
+
per_page: 100
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Keep only the latest review per user
|
|
40
|
+
const latestByUser = new Map();
|
|
41
|
+
for (const r of reviews) latestByUser.set(r.user.id, r);
|
|
42
|
+
const approvals = [...latestByUser.values()].filter(r => r.state === 'APPROVED');
|
|
43
|
+
|
|
44
|
+
if (approvals.length === 0) {
|
|
45
|
+
core.setFailed('No approvals yet.');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const approverLogins = approvals.map(a => a.user.login.toLowerCase());
|
|
50
|
+
core.info(`Approvers: ${approverLogins.join(', ')}`);
|
|
51
|
+
|
|
52
|
+
async function teamHasUser(org, team_slug, username) {
|
|
53
|
+
try {
|
|
54
|
+
await github.rest.teams.getMembershipForUserInOrg({ org, team_slug, username });
|
|
55
|
+
return true;
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const org = context.repo.owner;
|
|
62
|
+
const adminTeam = 'pyseafom-admins';
|
|
63
|
+
const maintainerTeam = 'pyseafom-maintainers';
|
|
64
|
+
const prAuthor = pr.user.login.toLowerCase();
|
|
65
|
+
|
|
66
|
+
let hasAdmin = false;
|
|
67
|
+
let hasMaintainer = false;
|
|
68
|
+
|
|
69
|
+
for (const login of approverLogins) {
|
|
70
|
+
if (await teamHasUser(org, adminTeam, login)) hasAdmin = true;
|
|
71
|
+
if (await teamHasUser(org, maintainerTeam, login)) hasMaintainer = true;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Include PR author's approval if they're in either team
|
|
75
|
+
if (approverLogins.includes(prAuthor)) {
|
|
76
|
+
if (await teamHasUser(org, adminTeam, prAuthor)) hasAdmin = true;
|
|
77
|
+
if (await teamHasUser(org, maintainerTeam, prAuthor)) hasMaintainer = true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!hasAdmin || !hasMaintainer) {
|
|
81
|
+
core.setFailed(`Approval missing: need at least 1 Admin (${hasAdmin}) and 1 Maintainer (${hasMaintainer}).`);
|
|
82
|
+
} else {
|
|
83
|
+
core.info('Approval policy satisfied: 1 Admin and 1 Maintainer.');
|
|
84
|
+
}
|
pyseafom-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SEAFOM Fiber Optic Monitoring Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Include documentation and metadata files
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include pyproject.toml
|
|
5
|
+
|
|
6
|
+
# Include example notebooks
|
|
7
|
+
include *.ipynb
|
|
8
|
+
|
|
9
|
+
# Exclude build artifacts and cache
|
|
10
|
+
global-exclude __pycache__
|
|
11
|
+
global-exclude *.py[co]
|
|
12
|
+
global-exclude .git*
|
pyseafom-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pySEAFOM
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Performance analysis and testing tools for Distributed Acoustic Sensing (DAS) systems
|
|
5
|
+
Home-page: https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM
|
|
6
|
+
Author: SEAFOM Fiber Optic Monitoring Group
|
|
7
|
+
Author-email: SEAFOM Fiber Optic Monitoring Group <your.email@example.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM
|
|
10
|
+
Project-URL: Documentation, https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM
|
|
11
|
+
Project-URL: Repository, https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM
|
|
12
|
+
Project-URL: Issues, https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM/issues
|
|
13
|
+
Keywords: DAS,distributed acoustic sensing,self-noise,fiber optic,seismic
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python :: 3
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.20.0
|
|
28
|
+
Requires-Dist: scipy>=1.7.0
|
|
29
|
+
Requires-Dist: matplotlib>=3.3.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pytest-cov>=3.0; extra == "dev"
|
|
33
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
34
|
+
Requires-Dist: flake8>=4.0; extra == "dev"
|
|
35
|
+
Requires-Dist: jupyter>=1.0; extra == "dev"
|
|
36
|
+
Dynamic: author
|
|
37
|
+
Dynamic: home-page
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
Dynamic: requires-python
|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
# pySEAFOM
|
|
44
|
+
|
|
45
|
+
A Python library for performance analysis and testing of Distributed Acoustic Sensing (DAS) interrogators, developed by SEAFOM's Measuring Sensor Performance group. This package provides standardized tools for testing, benchmarking, and performance evaluation of DAS systems following SEAFOM recommended procedures.
|
|
46
|
+
|
|
47
|
+
## ๐ Purpose
|
|
48
|
+
|
|
49
|
+
To promote transparency, consistency, and collaboration in the evaluation of DAS interrogator performance by providing open-source tools and standardized workflows.
|
|
50
|
+
|
|
51
|
+
## โก Quick Start
|
|
52
|
+
|
|
53
|
+
### Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install pySEAFOM
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Basic Usage
|
|
60
|
+
|
|
61
|
+
**Option 1: Import specific functions directly**
|
|
62
|
+
```python
|
|
63
|
+
from pySEAFOM import calculate_self_noise, plot_combined_self_noise_db
|
|
64
|
+
import numpy as np
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Option 2: Import modules (recommended when using multiple engines)**
|
|
68
|
+
```python
|
|
69
|
+
import pySEAFOM
|
|
70
|
+
import numpy as np
|
|
71
|
+
|
|
72
|
+
# Load your DAS data (channels ร time samples)
|
|
73
|
+
data = np.load('your_das_data.npy') # Shape: (n_channels, n_samples)
|
|
74
|
+
|
|
75
|
+
# Define test sections (channel ranges to analyze)
|
|
76
|
+
sections = [data[0:50, :], data[100:150, :]] # Two cable sections
|
|
77
|
+
section_names = ['Section A', 'Section B']
|
|
78
|
+
|
|
79
|
+
# Calculate self-noise for each section (using direct import)
|
|
80
|
+
results = calculate_self_noise(
|
|
81
|
+
sections,
|
|
82
|
+
interrogation_rate=10000, # Hz
|
|
83
|
+
gauge_length=10.0, # meters
|
|
84
|
+
window_function='blackman-harris',
|
|
85
|
+
data_type='pฮต' # picostrain
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# OR using module import:
|
|
89
|
+
# results = pySEAFOM.self_noise.calculate_self_noise(
|
|
90
|
+
sections,
|
|
91
|
+
interrogation_rate=10000, # Hz
|
|
92
|
+
gauge_length=10.0, # meters
|
|
93
|
+
window_function='blackman-harris',
|
|
94
|
+
data_type='pฮต' # picostrain
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
# Visualize results
|
|
98
|
+
plot_combined_self_noise_db(
|
|
99
|
+
results=results,
|
|
100
|
+
test_sections=section_names,
|
|
101
|
+
gauge_length=10.0,
|
|
102
|
+
org_data_unit='pฮต',
|
|
103
|
+
title='DAS Self-Noise Test Results'
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## ๐ Features & Modules
|
|
108
|
+
|
|
109
|
+
### Current Modules
|
|
110
|
+
|
|
111
|
+
#### `pySEAFOM.self_noise`
|
|
112
|
+
Self-noise analysis tools for DAS interrogators:
|
|
113
|
+
- **Self-Noise Calculation**: RMS amplitude spectral density across multiple channels
|
|
114
|
+
- **Multi-Section Analysis**: Compare different cable sections or spatial locations
|
|
115
|
+
- **Publication-Ready Plots**: dB-scale visualization with metadata and frequency bands
|
|
116
|
+
- **Text Reports**: Generate formatted reports of key frequencies and band statistics
|
|
117
|
+
- **Flexible Units**: Support for picostrain (pฮต), nanostrain (nฮต), radians, and arbitrary units
|
|
118
|
+
- **Window Functions**: Multiple FFT window options (Blackman-Harris, Hann, Hamming, etc.)
|
|
119
|
+
|
|
120
|
+
### Future Modules (Planned)
|
|
121
|
+
- **Linearity Analysis**: Dynamic range and linearity testing
|
|
122
|
+
- **Frequency Response**: Frequency-dependent sensitivity
|
|
123
|
+
- **Spatial Resolution**: Gauge length verification
|
|
124
|
+
- **Noise Floor**: System noise characterization
|
|
125
|
+
- *(Add your modules here)*
|
|
126
|
+
|
|
127
|
+
## ๐ Documentation
|
|
128
|
+
|
|
129
|
+
### Main Functions
|
|
130
|
+
|
|
131
|
+
#### `calculate_self_noise()`
|
|
132
|
+
Computes RMS amplitude spectral density across channels.
|
|
133
|
+
|
|
134
|
+
**Parameters:**
|
|
135
|
+
- `sections` (list): List of 2D arrays (channels ร samples) for each test section
|
|
136
|
+
- `interrogation_rate` (float): Sampling frequency in Hz
|
|
137
|
+
- `gauge_length` (float): Gauge length in meters
|
|
138
|
+
- `window_function` (str): FFT window type ('blackman-harris', 'hann', 'none', etc.)
|
|
139
|
+
- `data_type` (str): Data unit ('pฮต', 'nฮต', 'rad', or custom)
|
|
140
|
+
|
|
141
|
+
**Returns:**
|
|
142
|
+
- List of tuples: `[(frequencies, asd), ...]` for each section
|
|
143
|
+
|
|
144
|
+
#### `plot_combined_self_noise_db()`
|
|
145
|
+
Creates publication-quality self-noise plots.
|
|
146
|
+
|
|
147
|
+
**Parameters:**
|
|
148
|
+
- `results`: Output from `calculate_self_noise()`
|
|
149
|
+
- `test_sections` (list): Section names
|
|
150
|
+
- `gauge_length` (float): Gauge length in meters
|
|
151
|
+
- `org_data_unit` (str): Display unit
|
|
152
|
+
- `title` (str): Plot title
|
|
153
|
+
- `sampling_freq` (float): Sampling rate (for metadata box)
|
|
154
|
+
- `n_channels` (int): Total channels (for metadata box)
|
|
155
|
+
- `duration` (float): Recording duration (for metadata box)
|
|
156
|
+
|
|
157
|
+
#### `report_self_noise()`
|
|
158
|
+
Prints formatted text report.
|
|
159
|
+
|
|
160
|
+
**Parameters:**
|
|
161
|
+
- `results`: Output from `calculate_self_noise()`
|
|
162
|
+
- `gauge_length` (float): Gauge length in meters
|
|
163
|
+
- `test_sections` (list): Section names
|
|
164
|
+
- `band_frequencies` (list): Frequency bands for averaging, e.g., `[(1, 100), (100, 1000)]`
|
|
165
|
+
- `report_in_db` (bool): Use dB scale or linear units
|
|
166
|
+
- `org_data_unit` (str): Display unit
|
|
167
|
+
|
|
168
|
+
## ๐งช Example Notebook
|
|
169
|
+
|
|
170
|
+
See `self_noise_test.ipynb` for a complete example using synthetic data:
|
|
171
|
+
- Generates known ASD synthetic signals
|
|
172
|
+
- Validates calculation accuracy
|
|
173
|
+
- Demonstrates all visualization options
|
|
174
|
+
|
|
175
|
+
## ๐ Typical Workflow
|
|
176
|
+
|
|
177
|
+
1. **Prepare Data**: Load DAS measurements (channels ร samples)
|
|
178
|
+
2. **Define Sections**: Select channel ranges for analysis
|
|
179
|
+
3. **Calculate Self-Noise**: Use `calculate_self_noise()` with appropriate parameters
|
|
180
|
+
4. **Visualize**: Create plots with `plot_combined_self_noise_db()`
|
|
181
|
+
5. **Report**: Generate text summaries with `report_self_noise()`
|
|
182
|
+
|
|
183
|
+
## ๐ง Development Setup
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
# Clone the repository
|
|
187
|
+
git clone https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM.git
|
|
188
|
+
cd pySEAFOM
|
|
189
|
+
|
|
190
|
+
# Install in development mode
|
|
191
|
+
pip install -e .
|
|
192
|
+
|
|
193
|
+
# Install development dependencies
|
|
194
|
+
pip install -e ".[dev]"
|
|
195
|
+
|
|
196
|
+
# Run tests (if available)
|
|
197
|
+
pytest tests/
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## ๐ฆ Package Structure
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
pySEAFOM/
|
|
204
|
+
โโโ self_noise - Self-noise analysis module
|
|
205
|
+
โ โโโ calculate_self_noise()
|
|
206
|
+
โ โโโ plot_combined_self_noise_db()
|
|
207
|
+
โ โโโ report_self_noise()
|
|
208
|
+
โโโ (future modules) - Additional analysis engines
|
|
209
|
+
โโโ examples/ - Example notebooks
|
|
210
|
+
โโโ self_noise_test.ipynb
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## ๐ Adding New Modules
|
|
214
|
+
|
|
215
|
+
To add a new analysis module:
|
|
216
|
+
|
|
217
|
+
1. Create `source/your_module.py` with your functions
|
|
218
|
+
2. Update `source/__init__.py`:
|
|
219
|
+
```python
|
|
220
|
+
from . import self_noise, your_module
|
|
221
|
+
```
|
|
222
|
+
3. Add documentation to README
|
|
223
|
+
4. Create example notebook in root directory
|
|
224
|
+
|
|
225
|
+
See the existing `self_noise.py` module as a template.
|
|
226
|
+
|
|
227
|
+
## ๐ค Contributing
|
|
228
|
+
|
|
229
|
+
We welcome contributions from researchers, engineers, and developers working in the fiber optic sensing space. Please see our [contribution guidelines](CONTRIBUTING.md) to get started.
|
|
230
|
+
|
|
231
|
+
## ๐ License
|
|
232
|
+
|
|
233
|
+
This project is licensed under the MIT License โ see the [LICENSE](LICENSE) file for details.
|
|
234
|
+
|
|
235
|
+
This repository follows the [SEAFOM Governance Policy](https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/governance/blob/main/GOVERNANCE.md).
|
pyseafom-0.1.0/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# pySEAFOM
|
|
4
|
+
|
|
5
|
+
A Python library for performance analysis and testing of Distributed Acoustic Sensing (DAS) interrogators, developed by SEAFOM's Measuring Sensor Performance group. This package provides standardized tools for testing, benchmarking, and performance evaluation of DAS systems following SEAFOM recommended procedures.
|
|
6
|
+
|
|
7
|
+
## ๐ Purpose
|
|
8
|
+
|
|
9
|
+
To promote transparency, consistency, and collaboration in the evaluation of DAS interrogator performance by providing open-source tools and standardized workflows.
|
|
10
|
+
|
|
11
|
+
## โก Quick Start
|
|
12
|
+
|
|
13
|
+
### Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install pySEAFOM
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Basic Usage
|
|
20
|
+
|
|
21
|
+
**Option 1: Import specific functions directly**
|
|
22
|
+
```python
|
|
23
|
+
from pySEAFOM import calculate_self_noise, plot_combined_self_noise_db
|
|
24
|
+
import numpy as np
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Option 2: Import modules (recommended when using multiple engines)**
|
|
28
|
+
```python
|
|
29
|
+
import pySEAFOM
|
|
30
|
+
import numpy as np
|
|
31
|
+
|
|
32
|
+
# Load your DAS data (channels ร time samples)
|
|
33
|
+
data = np.load('your_das_data.npy') # Shape: (n_channels, n_samples)
|
|
34
|
+
|
|
35
|
+
# Define test sections (channel ranges to analyze)
|
|
36
|
+
sections = [data[0:50, :], data[100:150, :]] # Two cable sections
|
|
37
|
+
section_names = ['Section A', 'Section B']
|
|
38
|
+
|
|
39
|
+
# Calculate self-noise for each section (using direct import)
|
|
40
|
+
results = calculate_self_noise(
|
|
41
|
+
sections,
|
|
42
|
+
interrogation_rate=10000, # Hz
|
|
43
|
+
gauge_length=10.0, # meters
|
|
44
|
+
window_function='blackman-harris',
|
|
45
|
+
data_type='pฮต' # picostrain
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
# OR using module import:
|
|
49
|
+
# results = pySEAFOM.self_noise.calculate_self_noise(
|
|
50
|
+
sections,
|
|
51
|
+
interrogation_rate=10000, # Hz
|
|
52
|
+
gauge_length=10.0, # meters
|
|
53
|
+
window_function='blackman-harris',
|
|
54
|
+
data_type='pฮต' # picostrain
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Visualize results
|
|
58
|
+
plot_combined_self_noise_db(
|
|
59
|
+
results=results,
|
|
60
|
+
test_sections=section_names,
|
|
61
|
+
gauge_length=10.0,
|
|
62
|
+
org_data_unit='pฮต',
|
|
63
|
+
title='DAS Self-Noise Test Results'
|
|
64
|
+
)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## ๐ Features & Modules
|
|
68
|
+
|
|
69
|
+
### Current Modules
|
|
70
|
+
|
|
71
|
+
#### `pySEAFOM.self_noise`
|
|
72
|
+
Self-noise analysis tools for DAS interrogators:
|
|
73
|
+
- **Self-Noise Calculation**: RMS amplitude spectral density across multiple channels
|
|
74
|
+
- **Multi-Section Analysis**: Compare different cable sections or spatial locations
|
|
75
|
+
- **Publication-Ready Plots**: dB-scale visualization with metadata and frequency bands
|
|
76
|
+
- **Text Reports**: Generate formatted reports of key frequencies and band statistics
|
|
77
|
+
- **Flexible Units**: Support for picostrain (pฮต), nanostrain (nฮต), radians, and arbitrary units
|
|
78
|
+
- **Window Functions**: Multiple FFT window options (Blackman-Harris, Hann, Hamming, etc.)
|
|
79
|
+
|
|
80
|
+
### Future Modules (Planned)
|
|
81
|
+
- **Linearity Analysis**: Dynamic range and linearity testing
|
|
82
|
+
- **Frequency Response**: Frequency-dependent sensitivity
|
|
83
|
+
- **Spatial Resolution**: Gauge length verification
|
|
84
|
+
- **Noise Floor**: System noise characterization
|
|
85
|
+
- *(Add your modules here)*
|
|
86
|
+
|
|
87
|
+
## ๐ Documentation
|
|
88
|
+
|
|
89
|
+
### Main Functions
|
|
90
|
+
|
|
91
|
+
#### `calculate_self_noise()`
|
|
92
|
+
Computes RMS amplitude spectral density across channels.
|
|
93
|
+
|
|
94
|
+
**Parameters:**
|
|
95
|
+
- `sections` (list): List of 2D arrays (channels ร samples) for each test section
|
|
96
|
+
- `interrogation_rate` (float): Sampling frequency in Hz
|
|
97
|
+
- `gauge_length` (float): Gauge length in meters
|
|
98
|
+
- `window_function` (str): FFT window type ('blackman-harris', 'hann', 'none', etc.)
|
|
99
|
+
- `data_type` (str): Data unit ('pฮต', 'nฮต', 'rad', or custom)
|
|
100
|
+
|
|
101
|
+
**Returns:**
|
|
102
|
+
- List of tuples: `[(frequencies, asd), ...]` for each section
|
|
103
|
+
|
|
104
|
+
#### `plot_combined_self_noise_db()`
|
|
105
|
+
Creates publication-quality self-noise plots.
|
|
106
|
+
|
|
107
|
+
**Parameters:**
|
|
108
|
+
- `results`: Output from `calculate_self_noise()`
|
|
109
|
+
- `test_sections` (list): Section names
|
|
110
|
+
- `gauge_length` (float): Gauge length in meters
|
|
111
|
+
- `org_data_unit` (str): Display unit
|
|
112
|
+
- `title` (str): Plot title
|
|
113
|
+
- `sampling_freq` (float): Sampling rate (for metadata box)
|
|
114
|
+
- `n_channels` (int): Total channels (for metadata box)
|
|
115
|
+
- `duration` (float): Recording duration (for metadata box)
|
|
116
|
+
|
|
117
|
+
#### `report_self_noise()`
|
|
118
|
+
Prints formatted text report.
|
|
119
|
+
|
|
120
|
+
**Parameters:**
|
|
121
|
+
- `results`: Output from `calculate_self_noise()`
|
|
122
|
+
- `gauge_length` (float): Gauge length in meters
|
|
123
|
+
- `test_sections` (list): Section names
|
|
124
|
+
- `band_frequencies` (list): Frequency bands for averaging, e.g., `[(1, 100), (100, 1000)]`
|
|
125
|
+
- `report_in_db` (bool): Use dB scale or linear units
|
|
126
|
+
- `org_data_unit` (str): Display unit
|
|
127
|
+
|
|
128
|
+
## ๐งช Example Notebook
|
|
129
|
+
|
|
130
|
+
See `self_noise_test.ipynb` for a complete example using synthetic data:
|
|
131
|
+
- Generates known ASD synthetic signals
|
|
132
|
+
- Validates calculation accuracy
|
|
133
|
+
- Demonstrates all visualization options
|
|
134
|
+
|
|
135
|
+
## ๐ Typical Workflow
|
|
136
|
+
|
|
137
|
+
1. **Prepare Data**: Load DAS measurements (channels ร samples)
|
|
138
|
+
2. **Define Sections**: Select channel ranges for analysis
|
|
139
|
+
3. **Calculate Self-Noise**: Use `calculate_self_noise()` with appropriate parameters
|
|
140
|
+
4. **Visualize**: Create plots with `plot_combined_self_noise_db()`
|
|
141
|
+
5. **Report**: Generate text summaries with `report_self_noise()`
|
|
142
|
+
|
|
143
|
+
## ๐ง Development Setup
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Clone the repository
|
|
147
|
+
git clone https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM.git
|
|
148
|
+
cd pySEAFOM
|
|
149
|
+
|
|
150
|
+
# Install in development mode
|
|
151
|
+
pip install -e .
|
|
152
|
+
|
|
153
|
+
# Install development dependencies
|
|
154
|
+
pip install -e ".[dev]"
|
|
155
|
+
|
|
156
|
+
# Run tests (if available)
|
|
157
|
+
pytest tests/
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## ๐ฆ Package Structure
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
pySEAFOM/
|
|
164
|
+
โโโ self_noise - Self-noise analysis module
|
|
165
|
+
โ โโโ calculate_self_noise()
|
|
166
|
+
โ โโโ plot_combined_self_noise_db()
|
|
167
|
+
โ โโโ report_self_noise()
|
|
168
|
+
โโโ (future modules) - Additional analysis engines
|
|
169
|
+
โโโ examples/ - Example notebooks
|
|
170
|
+
โโโ self_noise_test.ipynb
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## ๐ Adding New Modules
|
|
174
|
+
|
|
175
|
+
To add a new analysis module:
|
|
176
|
+
|
|
177
|
+
1. Create `source/your_module.py` with your functions
|
|
178
|
+
2. Update `source/__init__.py`:
|
|
179
|
+
```python
|
|
180
|
+
from . import self_noise, your_module
|
|
181
|
+
```
|
|
182
|
+
3. Add documentation to README
|
|
183
|
+
4. Create example notebook in root directory
|
|
184
|
+
|
|
185
|
+
See the existing `self_noise.py` module as a template.
|
|
186
|
+
|
|
187
|
+
## ๐ค Contributing
|
|
188
|
+
|
|
189
|
+
We welcome contributions from researchers, engineers, and developers working in the fiber optic sensing space. Please see our [contribution guidelines](CONTRIBUTING.md) to get started.
|
|
190
|
+
|
|
191
|
+
## ๐ License
|
|
192
|
+
|
|
193
|
+
This project is licensed under the MIT License โ see the [LICENSE](LICENSE) file for details.
|
|
194
|
+
|
|
195
|
+
This repository follows the [SEAFOM Governance Policy](https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/governance/blob/main/GOVERNANCE.md).
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pySEAFOM"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Performance analysis and testing tools for Distributed Acoustic Sensing (DAS) systems"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = {text = "MIT"} # Update if different
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "SEAFOM Fiber Optic Monitoring Group", email = "your.email@example.com"}
|
|
14
|
+
]
|
|
15
|
+
keywords = ["DAS", "distributed acoustic sensing", "self-noise", "fiber optic", "seismic"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
dependencies = [
|
|
30
|
+
"numpy>=1.20.0",
|
|
31
|
+
"scipy>=1.7.0",
|
|
32
|
+
"matplotlib>=3.3.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
dev = [
|
|
37
|
+
"pytest>=7.0",
|
|
38
|
+
"pytest-cov>=3.0",
|
|
39
|
+
"black>=22.0",
|
|
40
|
+
"flake8>=4.0",
|
|
41
|
+
"jupyter>=1.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.urls]
|
|
45
|
+
Homepage = "https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM"
|
|
46
|
+
Documentation = "https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM"
|
|
47
|
+
Repository = "https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM"
|
|
48
|
+
Issues = "https://github.com/SEAFOM-Fiber-Optic-Monitoring-Group/pySEAFOM/issues"
|
|
49
|
+
|
|
50
|
+
[tool.setuptools]
|
|
51
|
+
package-dir = {"" = "source"}
|
|
52
|
+
|
|
53
|
+
[tool.setuptools.packages.find]
|
|
54
|
+
where = ["source"]
|