das2numpy 1.2.1__tar.gz → 1.2.2__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.
- {das2numpy-1.2.1/src/das2numpy.egg-info → das2numpy-1.2.2}/PKG-INFO +1 -1
- {das2numpy-1.2.1 → das2numpy-1.2.2}/pyproject.toml +1 -1
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/setups/hdas.py +1 -1
- {das2numpy-1.2.1 → das2numpy-1.2.2/src/das2numpy.egg-info}/PKG-INFO +1 -1
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy.egg-info/SOURCES.txt +1 -0
- das2numpy-1.2.2/src/das2numpy.egg-info/top_level.txt +3 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/example.py +30 -11
- das2numpy-1.2.2/src/example_spectrogram.py +80 -0
- das2numpy-1.2.1/src/das2numpy.egg-info/top_level.txt +0 -2
- {das2numpy-1.2.1 → das2numpy-1.2.2}/LICENSE +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/README.md +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/setup.cfg +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/__init__.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/__main__.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/chunk.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/filefinder.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/setups/flac_200hz.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/setups/light_tdms_reader.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/setups/optasense_b35idefix.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/setups/silixa.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy/utils.py +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy.egg-info/dependency_links.txt +0 -0
- {das2numpy-1.2.1 → das2numpy-1.2.2}/src/das2numpy.egg-info/requires.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: das2numpy
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: A simple and universal package for loading large amounts of distributed acoustic sensing (DAS) data.
|
|
5
5
|
Author-email: Erik Genthe <erik.genthe@desy.de>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.desy.de/wave-public/das2numpy
|
|
@@ -19,7 +19,7 @@ CALIBRATE = True
|
|
|
19
19
|
|
|
20
20
|
def init(root_path, num_worker_threads):
|
|
21
21
|
assert P.isdir(root_path)
|
|
22
|
-
file_finder = FileFinder(root_path, ".h5", filename_to_posix_timestamp)
|
|
22
|
+
file_finder = FileFinder(root_path, "_StrainRate_ch1.h5", filename_to_posix_timestamp)
|
|
23
23
|
assert num_worker_threads >= 1
|
|
24
24
|
multithreaded = num_worker_threads > 1
|
|
25
25
|
sample_rate = 1000
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: das2numpy
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: A simple and universal package for loading large amounts of distributed acoustic sensing (DAS) data.
|
|
5
5
|
Author-email: Erik Genthe <erik.genthe@desy.de>
|
|
6
6
|
Project-URL: Homepage, https://gitlab.desy.de/wave-public/das2numpy
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import numpy as NP
|
|
2
2
|
import sys
|
|
3
3
|
from datetime import datetime
|
|
4
|
+
import matplotlib as MPL
|
|
4
5
|
import matplotlib.pyplot as PP
|
|
5
6
|
from das2numpy import loader, utils
|
|
6
7
|
|
|
@@ -14,26 +15,35 @@ channel_end = -1
|
|
|
14
15
|
#loader = loader("/pnfs/desy.de/m/project/iDAS/raw/2026-DESY/2026_das_comparison/hdas", "HDAS", 1) # 1000 Hz
|
|
15
16
|
loader = loader("/pnfs/desy.de/m/project/iDAS/work/IDAS_200HZ/", "FLAC_200HZ", 1) # 200 Hz
|
|
16
17
|
data = loader.load_array(t_start, t_end, channel_start, channel_end)
|
|
18
|
+
sampling_hz = 200.0
|
|
19
|
+
channel_spacing = 1
|
|
17
20
|
|
|
18
|
-
print("Reduce data by binning (mean averaging)")
|
|
19
|
-
bin_factors = (100, 10)
|
|
20
|
-
data = utils.bin(data, bin_factors) # Reduce time sampling and spatial sampling by averaging.
|
|
21
|
-
sampling_hz = 200.0 / bin_factors[0]
|
|
22
|
-
channel_spacing = 1.0 * bin_factors[1]
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
print("Downsample")
|
|
23
|
+
downsample_factors = [100, 10]
|
|
24
|
+
# Use binning to reduce the channel dimension. Binning is faster than IIR-filtering
|
|
25
|
+
data = utils.bin(data, [1, downsample_factors[1]])
|
|
26
|
+
nyquist_freq = sampling_hz // downsample_factors[0] // 2
|
|
27
|
+
# IIR Anti-alias filter: No phase shift, due to forward-and-backward application of the filter
|
|
28
|
+
data = utils.butterworth_filter(data, freq=nyquist_freq, order=2, btype="lowpass", fs=sampling_hz)
|
|
29
|
+
data = data[::downsample_factors[0]] # Decimation
|
|
30
|
+
sampling_hz //= downsample_factors[0]
|
|
31
|
+
channel_spacing = int(channel_spacing * downsample_factors[1])
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
print("Saving loaded (and downsampled) data to numpy file")
|
|
25
35
|
NP.save("data.npy", data)
|
|
26
36
|
|
|
27
|
-
|
|
28
|
-
print("Create plot with pyplot")
|
|
37
|
+
|
|
38
|
+
print("Create waterfall plot with pyplot")
|
|
29
39
|
PP.title(f"{t_start.isoformat()}")
|
|
30
40
|
PP.imshow(
|
|
31
41
|
data,
|
|
32
42
|
cmap = "seismic",
|
|
33
43
|
aspect = "auto",
|
|
34
44
|
interpolation = "nearest",
|
|
35
|
-
vmin = -
|
|
36
|
-
vmax = +
|
|
45
|
+
vmin = -2e-8,
|
|
46
|
+
vmax = +2e-8,
|
|
37
47
|
extent = (
|
|
38
48
|
channel_start, channel_start + (data.shape[1] * channel_spacing),
|
|
39
49
|
data.shape[0] / sampling_hz, 0
|
|
@@ -42,4 +52,13 @@ PP.imshow(
|
|
|
42
52
|
PP.xlabel("Position [m]")
|
|
43
53
|
PP.ylabel("Time [s]")
|
|
44
54
|
PP.colorbar(label="Strain-rate [$\\frac{m}{m \\cdot s}$]")
|
|
45
|
-
PP.savefig("waterfall.png")
|
|
55
|
+
PP.savefig("waterfall.png", dpi=300)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import numpy as NP
|
|
2
|
+
import sys
|
|
3
|
+
from datetime import datetime, timedelta
|
|
4
|
+
import matplotlib as MPL
|
|
5
|
+
import matplotlib.pyplot as PP
|
|
6
|
+
import scipy
|
|
7
|
+
import scipy.signal as sig
|
|
8
|
+
from das2numpy import loader, utils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
print("Load data to numpy-array")
|
|
12
|
+
t_start = datetime(2024, 11, 26, 1, 0, 0)
|
|
13
|
+
t_end = datetime(2024, 11, 26, 9, 0, 0)
|
|
14
|
+
CHANNELS_XTL_2024 = [6268+50, 8364-50]
|
|
15
|
+
#loader = loader("/pnfs/desy.de/m/project/iDAS/raw/2024-DESY/2024-07-23-desy", "SILIXA", 1) # 1000 Hz
|
|
16
|
+
#loader = loader("/pnfs/desy.de/m/project/iDAS/raw/2026-DESY/2026_das_comparison/hdas", "HDAS", 1) # 1000 Hz
|
|
17
|
+
loader = loader("/pnfs/desy.de/m/project/iDAS/work/IDAS_200HZ/", "FLAC_200HZ", 8) # 200 Hz
|
|
18
|
+
data = loader.load_array(t_start, t_end, CHANNELS_XTL_2024[0], CHANNELS_XTL_2024[1])
|
|
19
|
+
sampling_hz = 200.0
|
|
20
|
+
channel_spacing = 1
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
print("Create spectrogram with pyplot")
|
|
24
|
+
fft_len = 4096*2*2
|
|
25
|
+
print("SSS", data.shape)
|
|
26
|
+
selected_data = data.mean(axis=1)
|
|
27
|
+
print("SSS", selected_data.shape)
|
|
28
|
+
freq, time, spectrogram = sig.spectrogram(
|
|
29
|
+
selected_data * 1e9, # Convert to nano-strain
|
|
30
|
+
fs=sampling_hz,
|
|
31
|
+
window="hann",
|
|
32
|
+
nperseg=fft_len,
|
|
33
|
+
noverlap=fft_len//2, nfft=None, detrend=None,
|
|
34
|
+
scaling='density', axis=-1, mode='psd'
|
|
35
|
+
)
|
|
36
|
+
df = freq[1] - freq[0] # Hz
|
|
37
|
+
print(" spectrogram.shape, freq.shape", spectrogram.shape, freq.shape)
|
|
38
|
+
print(" RMS timedomain", NP.sqrt((data**2).mean()))
|
|
39
|
+
print(" RMS spectrum", NP.sqrt((spectrogram.sum(axis=1) * df).mean()))
|
|
40
|
+
|
|
41
|
+
# This removes ugly stripes from the spectrogram where there is no data.
|
|
42
|
+
spectrogram = NP.nan_to_num(spectrogram, nan=0.0)
|
|
43
|
+
spectrogram[spectrogram < 1e-30] = 0.0
|
|
44
|
+
|
|
45
|
+
PP.clf()
|
|
46
|
+
fig, ax = PP.subplots()
|
|
47
|
+
PP.imshow(
|
|
48
|
+
NP.sqrt(spectrogram.transpose()),
|
|
49
|
+
cmap="viridis",
|
|
50
|
+
extent=(
|
|
51
|
+
freq[0], freq[-1],
|
|
52
|
+
MPL.dates.date2num(t_start+timedelta(seconds=time[-1])), MPL.dates.date2num(t_start)
|
|
53
|
+
),
|
|
54
|
+
aspect="auto",
|
|
55
|
+
norm=MPL.colors.LogNorm(vmin=1e-4, vmax=1e2),
|
|
56
|
+
interpolation_stage='rgba', # Fixes white pixel bug
|
|
57
|
+
interpolation='nearest'
|
|
58
|
+
)
|
|
59
|
+
PP.xlim(freq[3], freq[-1])
|
|
60
|
+
PP.colorbar(label="ASD [$\\frac{nm}{m \\cdot s \\cdot \\sqrt{Hz}}$]")
|
|
61
|
+
PP.xlabel("Frequency [Hz]")
|
|
62
|
+
PP.ylabel("Time UTC")
|
|
63
|
+
PP.xscale("log")
|
|
64
|
+
ax.yaxis_date()
|
|
65
|
+
date_format = MPL.dates.DateFormatter('%Y-%m-%d %H:%M')
|
|
66
|
+
ax.yaxis.set_major_formatter(date_format)
|
|
67
|
+
PP.yticks(rotation=45)
|
|
68
|
+
#fig.autofmt_ydate()
|
|
69
|
+
PP.tight_layout()
|
|
70
|
+
PP.savefig("spectrogram.png")
|
|
71
|
+
PP.close()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|