SegmentSignalPy 0.1.2__tar.gz → 0.1.3__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.
- segmentsignalpy-0.1.3/MANIFEST.in +1 -0
- segmentsignalpy-0.1.3/PKG-INFO +70 -0
- segmentsignalpy-0.1.3/README.md +41 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/pyproject.toml +1 -1
- segmentsignalpy-0.1.3/src/C DLL/DLLExport.h +11 -0
- segmentsignalpy-0.1.3/src/CPP Static Library/NoiseVarianceEstimateMethod.h +17 -0
- segmentsignalpy-0.1.3/src/CPP Static Library/SegmentSignal.h +195 -0
- segmentsignalpy-0.1.3/src/CPP Static Library/SegmentSignalFunctions.h +52 -0
- segmentsignalpy-0.1.3/src/CPP Static Library/SegmentationResults.h +101 -0
- segmentsignalpy-0.1.3/src/CPP Unit Tests/InputDataEnum.h +14 -0
- segmentsignalpy-0.1.3/src/CPP Unit Tests/stdafx.h +13 -0
- segmentsignalpy-0.1.3/src/CPP Unit Tests/targetver.h +8 -0
- segmentsignalpy-0.1.3/src/Python Extension/SegmentationResultsPy.h +119 -0
- segmentsignalpy-0.1.3/src/Python Extension/setup.py +26 -0
- segmentsignalpy-0.1.3/src/SegmentSignalPy.egg-info/PKG-INFO +70 -0
- segmentsignalpy-0.1.3/src/SegmentSignalPy.egg-info/SOURCES.txt +24 -0
- segmentsignalpy-0.1.2/PKG-INFO +0 -34
- segmentsignalpy-0.1.2/README.md +0 -5
- segmentsignalpy-0.1.2/src/SegmentSignalPy.egg-info/PKG-INFO +0 -34
- segmentsignalpy-0.1.2/src/SegmentSignalPy.egg-info/SOURCES.txt +0 -13
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/License.txt +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/setup.cfg +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/setup.py +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/CPP Static Library/SegmentSignal.cpp +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/CPP Static Library/SegmentSignalFunctions.cpp +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/CPP Static Library/SegmentationResults.cpp +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/Python Extension/SegmentationResultsPy.cpp +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/Python Extension/module.cpp +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/SegmentSignalPy.egg-info/dependency_links.txt +0 -0
- {segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/SegmentSignalPy.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
recursive-include src *.h
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SegmentSignalPy
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Signal segmentation algorithm by S. Radhakrishnan, et al. This is a Python interface for the C++ algorithm.
|
|
5
|
+
License: Copyright (c) 2021-2024 Lance A. Endres
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
Project-URL: homepage, https://github.com/lendres/Segment-Signals
|
|
27
|
+
Requires-Python: >=3.11.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Segment Signals
|
|
31
|
+
A signal segmentation algorithm.
|
|
32
|
+
|
|
33
|
+
## Introduction
|
|
34
|
+
This library implements the algorithm found in:
|
|
35
|
+
[_Segmentation of well logs by maximum likelihood estimation: the algorithm and FORTRAN-77 implementation_](https://www.sciencedirect.com/science/article/pii/0098300491900237) by S.Radhakrishnan, G.Srikanth, and C.H.Mehta
|
|
36
|
+
|
|
37
|
+
The original algorithm was written in Fortran. This version converts it to C++ and C#. In addition, the following changes have been made:
|
|
38
|
+
- Converted the binary event array (Q) from double to int. Likely, the original was a double to keep all options as floats and prevent accidental round off. C/C++ automatically perform calculations as doubles when any of the parameters is a double. The binary event sequence is, of course, meant to be binary, so conversion to int is logical. This also meant a few lines could be simplified (such as comparisons). E.g. you could directly test "if (Q[i])" rather than requiring the inequality.
|
|
39
|
+
- Removed a bug from the GETSPK/GetSpikeyZone function. The fix prevents over running the end of an array.
|
|
40
|
+
- Addition of `FindSignificantZones` to allow simple filtering (removal) of small zones.
|
|
41
|
+
|
|
42
|
+
## Organization
|
|
43
|
+
A high-level view of the organization is as follows.
|
|
44
|
+
|
|
45
|
+
- CPP Static Library
|
|
46
|
+
- SegmentSignalFunctions.
|
|
47
|
+
- **It is suggested not to use these directly, but to use the class `SegmentSignal` instead.**
|
|
48
|
+
These files implement the original algorithm in C++. The function names have changed to something more readable. The original function names can be found in the comments in
|
|
49
|
+
the .cpp file. The functions have otherwise been directly converted from Fortran and should be easily comparable to those in the source paper.
|
|
50
|
+
- SegmentSignal.*
|
|
51
|
+
- A class interface to the functions that makes use of the algorithm easier.
|
|
52
|
+
- SegmentationResults.*
|
|
53
|
+
- Small class to return results of the algorithm.
|
|
54
|
+
- NoiseVarianceEstimateMethod.h
|
|
55
|
+
- Enumeration for the noise variance estimation method.
|
|
56
|
+
|
|
57
|
+
- C DLL
|
|
58
|
+
- DLL wrapper around the main SegmentSignal function. The DLL exposes a C function for calling.
|
|
59
|
+
|
|
60
|
+
- C Sharp DLL Wrapper
|
|
61
|
+
- C# interface to the DLL. Classes mirror those in C++.
|
|
62
|
+
|
|
63
|
+
- Unit Tests
|
|
64
|
+
- Testing projects. Also provides examples. See the "LogSeparateTest" functions for a basic example.
|
|
65
|
+
|
|
66
|
+
- Python Extensions
|
|
67
|
+
- Builds a library for use with Python. See the `src/Python Extensions/Read Me.txt` file in that project for more information.
|
|
68
|
+
|
|
69
|
+
## Compiling
|
|
70
|
+
The Python Extension library requires knowledge of your local Python. See the `src/Python Extensions/Read Me.txt` file in that directory for more information.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Segment Signals
|
|
2
|
+
A signal segmentation algorithm.
|
|
3
|
+
|
|
4
|
+
## Introduction
|
|
5
|
+
This library implements the algorithm found in:
|
|
6
|
+
[_Segmentation of well logs by maximum likelihood estimation: the algorithm and FORTRAN-77 implementation_](https://www.sciencedirect.com/science/article/pii/0098300491900237) by S.Radhakrishnan, G.Srikanth, and C.H.Mehta
|
|
7
|
+
|
|
8
|
+
The original algorithm was written in Fortran. This version converts it to C++ and C#. In addition, the following changes have been made:
|
|
9
|
+
- Converted the binary event array (Q) from double to int. Likely, the original was a double to keep all options as floats and prevent accidental round off. C/C++ automatically perform calculations as doubles when any of the parameters is a double. The binary event sequence is, of course, meant to be binary, so conversion to int is logical. This also meant a few lines could be simplified (such as comparisons). E.g. you could directly test "if (Q[i])" rather than requiring the inequality.
|
|
10
|
+
- Removed a bug from the GETSPK/GetSpikeyZone function. The fix prevents over running the end of an array.
|
|
11
|
+
- Addition of `FindSignificantZones` to allow simple filtering (removal) of small zones.
|
|
12
|
+
|
|
13
|
+
## Organization
|
|
14
|
+
A high-level view of the organization is as follows.
|
|
15
|
+
|
|
16
|
+
- CPP Static Library
|
|
17
|
+
- SegmentSignalFunctions.
|
|
18
|
+
- **It is suggested not to use these directly, but to use the class `SegmentSignal` instead.**
|
|
19
|
+
These files implement the original algorithm in C++. The function names have changed to something more readable. The original function names can be found in the comments in
|
|
20
|
+
the .cpp file. The functions have otherwise been directly converted from Fortran and should be easily comparable to those in the source paper.
|
|
21
|
+
- SegmentSignal.*
|
|
22
|
+
- A class interface to the functions that makes use of the algorithm easier.
|
|
23
|
+
- SegmentationResults.*
|
|
24
|
+
- Small class to return results of the algorithm.
|
|
25
|
+
- NoiseVarianceEstimateMethod.h
|
|
26
|
+
- Enumeration for the noise variance estimation method.
|
|
27
|
+
|
|
28
|
+
- C DLL
|
|
29
|
+
- DLL wrapper around the main SegmentSignal function. The DLL exposes a C function for calling.
|
|
30
|
+
|
|
31
|
+
- C Sharp DLL Wrapper
|
|
32
|
+
- C# interface to the DLL. Classes mirror those in C++.
|
|
33
|
+
|
|
34
|
+
- Unit Tests
|
|
35
|
+
- Testing projects. Also provides examples. See the "LogSeparateTest" functions for a basic example.
|
|
36
|
+
|
|
37
|
+
- Python Extensions
|
|
38
|
+
- Builds a library for use with Python. See the `src/Python Extensions/Read Me.txt` file in that project for more information.
|
|
39
|
+
|
|
40
|
+
## Compiling
|
|
41
|
+
The Python Extension library requires knowledge of your local Python. See the `src/Python Extensions/Read Me.txt` file in that directory for more information.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#include <stdio.h>
|
|
2
|
+
#include "SegmentSignalFunctions.h"
|
|
3
|
+
|
|
4
|
+
extern "C"
|
|
5
|
+
{
|
|
6
|
+
// Export our function to a DLL and handle some pointer/addresses handling.
|
|
7
|
+
__declspec(dllexport) void SegmentSignalWrapper(double LOG[], int NSAMPS, double F, int ORDER, int ORDER1, int RMODE, int NITER, int Q[], int* NQ, double FLTLOG[], double SEGLOG[], double R[], double* C, double* D, int* NACT, int* IER)
|
|
8
|
+
{
|
|
9
|
+
SegmentSignal(LOG, NSAMPS, F, ORDER, ORDER1, RMODE, NITER, Q, *NQ, FLTLOG, SEGLOG, R, *C, *D, *NACT, *IER);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifndef NOISEVARIANCEESTIMATEMETHOD_H
|
|
2
|
+
#define NOISEVARIANCEESTIMATEMETHOD_H
|
|
3
|
+
|
|
4
|
+
enum class NoiseVarianceEstimateMethod
|
|
5
|
+
{
|
|
6
|
+
/// <summary>Point estimate.</summary>
|
|
7
|
+
Point = 0,
|
|
8
|
+
|
|
9
|
+
/// <summary>Smoothed estimate.</summary>
|
|
10
|
+
Smoothed = 1,
|
|
11
|
+
|
|
12
|
+
/// <summary>The number of types/items in the enumeration.</summary>
|
|
13
|
+
Length
|
|
14
|
+
|
|
15
|
+
}; // End enum.
|
|
16
|
+
|
|
17
|
+
#endif
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#ifndef SEGMENTSIGNAL_H
|
|
2
|
+
#define SEGMENTSIGNAL_H
|
|
3
|
+
|
|
4
|
+
#include "NoiseVarianceEstimateMethod.h"
|
|
5
|
+
#include "SegmentationResults.h"
|
|
6
|
+
#include <vector>
|
|
7
|
+
#include <array>
|
|
8
|
+
|
|
9
|
+
using namespace std;
|
|
10
|
+
|
|
11
|
+
namespace Algorithms
|
|
12
|
+
{
|
|
13
|
+
/// <summary>
|
|
14
|
+
/// C++ interface for the C code.
|
|
15
|
+
/// </summary>
|
|
16
|
+
class SegmentSignal
|
|
17
|
+
{
|
|
18
|
+
public:
|
|
19
|
+
/// <summary>
|
|
20
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
21
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
22
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
23
|
+
///
|
|
24
|
+
/// Assumes a point estimate of the noise variance and an upper bound of 300 on the number of Single Most Likelihood Replacement iterations.
|
|
25
|
+
/// </summary>
|
|
26
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
27
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
28
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
29
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
30
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
31
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
32
|
+
/// Noise variance estimate option.
|
|
33
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
34
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
35
|
+
/// </param>
|
|
36
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
37
|
+
static SegmentationResults* Segment(double signal[], int signalLength, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize);
|
|
38
|
+
|
|
39
|
+
/// <summary>
|
|
40
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
41
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
42
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
43
|
+
///
|
|
44
|
+
/// Assumes an upper bound of 300 on the number of Single Most Likelihood Replacement iterations.
|
|
45
|
+
/// </summary>
|
|
46
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
47
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
48
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
49
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
50
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
51
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
52
|
+
/// Noise variance estimate option.
|
|
53
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
54
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
55
|
+
/// </param>
|
|
56
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
57
|
+
static SegmentationResults* Segment(double signal[], int signalLength, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize, NoiseVarianceEstimateMethod noiseVarianceEstimateMethod);
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
61
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
62
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
63
|
+
/// </summary>
|
|
64
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
65
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
66
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
67
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
68
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
69
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
70
|
+
/// Noise variance estimate option.
|
|
71
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
72
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
73
|
+
/// </param>
|
|
74
|
+
/// <param name="maxSMLRIterations">Upper bound on the number of Single Most Likelihood Replacement iterations.</param>
|
|
75
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
76
|
+
static SegmentationResults* Segment(double signal[], int signalLength, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize, NoiseVarianceEstimateMethod noiseVarianceEstimateMethod, int maxSMLRIterations);
|
|
77
|
+
|
|
78
|
+
/// <summary>
|
|
79
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
80
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
81
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
82
|
+
///
|
|
83
|
+
/// Assumes a point estimate of the noise variance and an upper bound of 300 on the number of Single Most Likelihood Replacement iterations.
|
|
84
|
+
/// </summary>
|
|
85
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
86
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
87
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
88
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
89
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
90
|
+
/// Noise variance estimate option.
|
|
91
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
92
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
93
|
+
/// </param>
|
|
94
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
95
|
+
static SegmentationResults* Segment(vector<double> signal, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize);
|
|
96
|
+
|
|
97
|
+
/// <summary>
|
|
98
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
99
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
100
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
101
|
+
///
|
|
102
|
+
/// Assumes an upper bound of 300 on the number of Single Most Likelihood Replacement iterations.
|
|
103
|
+
/// </summary>
|
|
104
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
105
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
106
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
107
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
108
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
109
|
+
/// Noise variance estimate option.
|
|
110
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
111
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
112
|
+
/// </param>
|
|
113
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
114
|
+
static SegmentationResults* Segment(vector<double> signal, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize, NoiseVarianceEstimateMethod noiseVarianceEstimateMethod);
|
|
115
|
+
|
|
116
|
+
/// <summary>
|
|
117
|
+
/// Segment a signal using the Maximum Likelihood Estimation of Radhakrishnan, et al, 1991. Attempts to identify regions of the signal that are
|
|
118
|
+
/// considered "consistent." Assumes a signal that has a state which changes only at segment boundaries. The state change can be random and the
|
|
119
|
+
/// noise on top of the signal is modeled as Gaussian, but not necessarily stationary.
|
|
120
|
+
/// </summary>
|
|
121
|
+
/// <param name="signal">Input signal to be segmented.</param>
|
|
122
|
+
/// <param name="threshold">Segmentation threshold.</param>
|
|
123
|
+
/// <param name="jumpSequenceWindowSize">Length of the moving average window sized used for smoothing the input well log to arrive at an initial estimate of the jump sequence variance.</param>
|
|
124
|
+
/// <param name="noiseVarianceWindowSize">Length of the moving average window used for smoothing the noise variances.</param>
|
|
125
|
+
/// <param name="noiseVarianceEstimateMethod">
|
|
126
|
+
/// Noise variance estimate option.
|
|
127
|
+
// rmode = 0 ==> Point estimate of noise variance.
|
|
128
|
+
// rmode = 1 ==> Noise estimates smoothed within segments.
|
|
129
|
+
/// </param>
|
|
130
|
+
/// <param name="maxSMLRIterations">Upper bound on the number of Single Most Likelihood Replacement iterations.</param>
|
|
131
|
+
/// <returns>A SegmentationResults instance which contains the algorithm output of binary events, segmented log, filtered log, et cetera.</returns>
|
|
132
|
+
static SegmentationResults* Segment(vector<double> signal, double threshold, int jumpSequenceWindowSize, int noiseVarianceWindowSize, NoiseVarianceEstimateMethod noiseVarianceEstimateMethod, int maxSMLRIterations);
|
|
133
|
+
|
|
134
|
+
/// <summary>
|
|
135
|
+
/// Creates a list of indexes which indicate where the "significant zones" are in the results of the segmentation. A significant
|
|
136
|
+
/// zone is defined as a region between binary events (for example 1,0,0,0,1 is a region/zone of 3) that are longer than the
|
|
137
|
+
/// specified threshold.
|
|
138
|
+
///
|
|
139
|
+
/// An example use for this algorithm would to be to first run the segmentation algorithm on the log/signal to get the results, then
|
|
140
|
+
/// use this algorithm to find the regions of interest.
|
|
141
|
+
///
|
|
142
|
+
/// Since a log/signal fed to the segmentation algorithm is the dependent values (y values of a plot), the independent (x values)
|
|
143
|
+
/// must be supplied to this algorithm to enable evaluate the "length" of each zone.
|
|
144
|
+
/// </summary>
|
|
145
|
+
/// <param name="binaryEvents">Array of binary events (1s and 0s) which specify the boundaries of each zone.</param>
|
|
146
|
+
/// <param name="xData">Independent values associated with the log/signal fed to the Segment algorithm and produced the SegmentationResults.</param>
|
|
147
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
148
|
+
/// <param name="threshold">Length a zone must be to be consider "significant." Zones shorter than this are ignored.</param>
|
|
149
|
+
/// <returns>A vector of arrays of length 2 indicating the zones. Each entry in the List is a pair indicating the starting and ending index of one significant zone.</returns>
|
|
150
|
+
static vector<array<int, 2>>* FindSignificantZones(int binaryEvents[], double xData[], int signalLength, double threshold);
|
|
151
|
+
|
|
152
|
+
/// <summary>
|
|
153
|
+
/// Creates a list of indexes which indicate where the "significant zones" are in the results of the segmentation. A significant
|
|
154
|
+
/// zone is defined as a region between binary events (for example 1,0,0,0,1 is a region/zone of 3) that are longer than the
|
|
155
|
+
/// specified threshold.
|
|
156
|
+
///
|
|
157
|
+
/// An example use for this algorithm would to be to first run the segmentation algorithm on the log/signal to get the results, then
|
|
158
|
+
/// use this algorithm to find the regions of interest.
|
|
159
|
+
///
|
|
160
|
+
/// Since a log/signal fed to the segmentation algorithm is the dependent values (y values of a plot), the independent (x values)
|
|
161
|
+
/// must be supplied to this algorithm to enable evaluate the "length" of each zone.
|
|
162
|
+
/// </summary>
|
|
163
|
+
/// <param name="binaryEvents">Array of binary events (1s and 0s) which specify the boundaries of each zone.</param>
|
|
164
|
+
/// <param name="xData">Independent values associated with the log/signal fed to the Segment algorithm and produced the SegmentationResults.</param>
|
|
165
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
166
|
+
/// <param name="threshold">Length a zone must be to be consider "significant." Zones shorter than this are ignored.</param>
|
|
167
|
+
/// <param name="includeBoundaries">If true, the end data points are added as part of the zone. Does not change how zones are found.</param>
|
|
168
|
+
/// <returns>A vector of arrays of length 2 indicating the zones. Each entry in the List is a pair indicating the starting and ending index of one significant zone.</returns>
|
|
169
|
+
static vector<array<int, 2>>* FindSignificantZones(int binaryEvents[], double xData[], int signalLength, double threshold, bool includeBoundaries);
|
|
170
|
+
|
|
171
|
+
private:
|
|
172
|
+
/// <summary>
|
|
173
|
+
/// Scans the binary events for the next zero. Helper function to FindSignificantZones.
|
|
174
|
+
/// </summary>
|
|
175
|
+
/// <param name="binaryEvents">Binary event sequence array.</param>
|
|
176
|
+
/// <param name="signalLength">Input signal to be segmented.</param>
|
|
177
|
+
/// <param name="currentIndex">Index to start scanning from.</param>
|
|
178
|
+
/// <returns>Index of next zero.</returns>
|
|
179
|
+
static int FindNextZero(int binaryEvents[], int signalLength, int currentIndex);
|
|
180
|
+
|
|
181
|
+
/// <summary>
|
|
182
|
+
/// Checks to see if the threshold for being a significant zone is met. If it is, it is added to the list of significant zones.
|
|
183
|
+
/// </summary>
|
|
184
|
+
/// <param name="xData">Independent values associated with the log/signal fed to the Segment algorithm and produced the SegmentationResults.</param>
|
|
185
|
+
/// <param name="threshold">Length a zone must be to be consider "significant." Zones shorter than this are ignored.</param>
|
|
186
|
+
/// <param name="includeBoundaries">If true, the end data points are added as part of the zone. Does not change how zones are found.</param>
|
|
187
|
+
/// <param name="significantZones">List of significant zones.</param>
|
|
188
|
+
/// <param name="startIndex">Starting index of zone.</param>
|
|
189
|
+
/// <param name="endIndex">Ending index of the zone.</param>
|
|
190
|
+
static void CheckIfValidZone(double xData[], double threshold, bool includeBoundaries, vector<array<int, 2>>* significantZones, int startIndex, int endIndex);
|
|
191
|
+
|
|
192
|
+
}; // End class.
|
|
193
|
+
} // End namespace.
|
|
194
|
+
|
|
195
|
+
#endif
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#ifndef SEGMENTSIGNALFUNCTIONS_H
|
|
2
|
+
#define SEGMENTSIGNALFUNCTIONS_H
|
|
3
|
+
/*
|
|
4
|
+
C function calls for the signal segmentation libary.
|
|
5
|
+
These functions are where the work is performed.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// MAIN FUNCTION
|
|
9
|
+
// In Out
|
|
10
|
+
void SegmentSignal(double LOG[], int NSAMPS, double F, int ORDER, int ORDER1, int RMODE, int NITER, int Q[], int& NQ, double FLTLOG[], double SEGLOG[], double R[], double& C, double& D, int& NACT, int& IER);
|
|
11
|
+
|
|
12
|
+
// HELPER FUNCTIONS
|
|
13
|
+
// In Out
|
|
14
|
+
void SingleMostLikelihoodReplacement(double G[], double S[], double C, int NSAMPS, double D, int Q[], bool& CONV, int& IER);
|
|
15
|
+
|
|
16
|
+
// In Out
|
|
17
|
+
void Threshold(double JMPSEQ[], double C, double F, int NSAMPS, int Q[], double& D);
|
|
18
|
+
|
|
19
|
+
// In Out
|
|
20
|
+
void MovingAverage(double ARR1[], int NSAMPS, int ORDER, double ARR2[]);
|
|
21
|
+
|
|
22
|
+
// In Out
|
|
23
|
+
void KalmanFilter(double LOG[], int Q[], double C, double R[], int NSAMPS, double GAIN[], double ZTLT[], double ETA[], double STATE[]);
|
|
24
|
+
|
|
25
|
+
// In In/Out
|
|
26
|
+
void FixedIntervalOptimalSmoother(int Q[], int NSAMPS, double C, double ARR1[], double ARR2[], double ARR3[]);
|
|
27
|
+
|
|
28
|
+
// In Out
|
|
29
|
+
void AverageArraySegments(double ARR[], int Q[], int NSAMPS, double AVGOUT[]);
|
|
30
|
+
|
|
31
|
+
// In Intermediate Out
|
|
32
|
+
void DeglitchAndEstimateNoiseVariance(double LOG[], int Q[], int NSAMPS, int RMODE, double WORK1[], double R[]);
|
|
33
|
+
|
|
34
|
+
// In Out
|
|
35
|
+
void GetSegment(double LOG[], int Q[], int NSAMPS, int SEGSTR, int& SEGEND, int& SEGLEN, double& SEGAVG, bool& endofarray);
|
|
36
|
+
|
|
37
|
+
// In In/Out
|
|
38
|
+
void Deglitch(int NSAMPS, int Q[]);
|
|
39
|
+
|
|
40
|
+
// In Out
|
|
41
|
+
void GetSpikeyZone(int Q[], int NSAMPS, int SEGSTR, int& SEGEND, bool& endofarray);
|
|
42
|
+
|
|
43
|
+
// In Out
|
|
44
|
+
void EstimateEventDensity(int Q[], int NSAMPS, double& D, int& NQ);
|
|
45
|
+
|
|
46
|
+
// In Intermediate Out
|
|
47
|
+
void EstimateVarianceOfJumpSequence(double LOG[], int NSAMPS, double WORK1[], double& C);
|
|
48
|
+
|
|
49
|
+
// In Out
|
|
50
|
+
void CalculateMeanAndVariance(double ARRAY[], int NSAMPS, int MODE, double& MEAN, double& VAR);
|
|
51
|
+
|
|
52
|
+
#endif
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#ifndef SEGMENTATIONRESULTS_H
|
|
2
|
+
#define SEGMENTATIONRESULTS_H
|
|
3
|
+
|
|
4
|
+
namespace Algorithms
|
|
5
|
+
{
|
|
6
|
+
class SegmentationResults
|
|
7
|
+
{
|
|
8
|
+
private:
|
|
9
|
+
int _signalLength;
|
|
10
|
+
int* _binaryEventSequence = 0;
|
|
11
|
+
int _numberOfBinaryEvents;
|
|
12
|
+
double* _filteredSignal = 0;
|
|
13
|
+
double* _segmentedLog = 0;
|
|
14
|
+
double* _noiseVariance = 0;
|
|
15
|
+
double _jumpSequenceVariance;
|
|
16
|
+
double _segmentDensity;
|
|
17
|
+
int _iterations;
|
|
18
|
+
int _error;
|
|
19
|
+
|
|
20
|
+
public:
|
|
21
|
+
/// <summary>
|
|
22
|
+
/// Constructor.
|
|
23
|
+
/// </summary>
|
|
24
|
+
/// <param name="signalLength">Length of the input signal. The output sequences are the name length.</param>
|
|
25
|
+
/// <param name="binaryEventSequence">Binary event sequence.</param>
|
|
26
|
+
/// <param name="numberOfBinaryEvents">Number of binary events found (number of "1"s found in binary event sequence).</param>
|
|
27
|
+
/// <param name="filteredSignal">Filtered signal.</param>
|
|
28
|
+
/// <param name="segmentedLog">Segmented log.</param>
|
|
29
|
+
/// <param name="noiseVariance">Noise variance.</param>
|
|
30
|
+
/// <param name="jumpSequenceVariance">Jump sequence variance.</param>
|
|
31
|
+
/// <param name="segmentDensity">Segment density (ratio of events to total entries in binary event sequence).</param>
|
|
32
|
+
/// <param name="iterations">Number of iterations performed.</param>
|
|
33
|
+
/// <param name="error">Error flag.</param>
|
|
34
|
+
SegmentationResults(int signalLength, int binaryEventSequence[], int numberOfBinaryEvents, double filteredSignal[], double segmentedLog[], double noiseVariance[], double jumpSequenceVariance, double segmentDensity, int iterations, int error);
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// destructor.
|
|
38
|
+
/// </summary>
|
|
39
|
+
~SegmentationResults();
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Length of the input signal. The output sequences are the name length.
|
|
44
|
+
/// </summary>
|
|
45
|
+
int GetSignalLength();
|
|
46
|
+
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Array that contains 1s at segmented log boundaries and 0s elsewhere.
|
|
49
|
+
/// </summary>
|
|
50
|
+
int* GetBinaryEventSequence();
|
|
51
|
+
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Number of binary event sequences detected (number of "1"s in the BinaryEventSequence array).
|
|
54
|
+
/// </summary>
|
|
55
|
+
int GetNumberOfBinaryEvents();
|
|
56
|
+
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Filtered estimate of the signal.
|
|
59
|
+
/// </summary>
|
|
60
|
+
double* GetFilteredSignal();
|
|
61
|
+
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Average of filter log for each segment.
|
|
64
|
+
/// </summary>
|
|
65
|
+
double* GetSegmentedLog();
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// Estimate noise variance.
|
|
69
|
+
/// </summary>
|
|
70
|
+
double* GetNoiseVariance();
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// Estimated variance of the jump sequence.
|
|
74
|
+
/// </summary>
|
|
75
|
+
double GetJumpSequenceVariance();
|
|
76
|
+
|
|
77
|
+
/// <summary>
|
|
78
|
+
/// Estimate segment density.
|
|
79
|
+
/// </summary>
|
|
80
|
+
double GetSegmentDensity();
|
|
81
|
+
|
|
82
|
+
/// <summary>
|
|
83
|
+
/// SMLR iteration count.
|
|
84
|
+
/// </summary>
|
|
85
|
+
int GetIterations();
|
|
86
|
+
|
|
87
|
+
/// <summary>
|
|
88
|
+
/// Error flag.
|
|
89
|
+
/// Zero - no error.
|
|
90
|
+
/// Less than zero - invalid event density estimated after threshold. Reduce/increase
|
|
91
|
+
/// threshold and rerun.
|
|
92
|
+
/// Greater than zero - logarithm argument became zero at sample number returned in error during
|
|
93
|
+
/// the calculation of likelihood ratios in SMLR. There may be more samples of this type which
|
|
94
|
+
/// may give rise to this problem. Edit/rescale data values and rerun.
|
|
95
|
+
/// </summary>
|
|
96
|
+
int GetError();
|
|
97
|
+
|
|
98
|
+
}; // End class.
|
|
99
|
+
} // End namespace.
|
|
100
|
+
|
|
101
|
+
#endif
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// stdafx.h : include file for standard system include files,
|
|
2
|
+
// or project specific include files that are used frequently, but
|
|
3
|
+
// are changed infrequently
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "targetver.h"
|
|
9
|
+
|
|
10
|
+
// Headers for CppUnitTest
|
|
11
|
+
#include "CppUnitTest.h"
|
|
12
|
+
|
|
13
|
+
// TODO: reference additional headers your program requires here
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// Including SDKDDKVer.h defines the highest available Windows platform.
|
|
4
|
+
|
|
5
|
+
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
|
|
6
|
+
// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
|
|
7
|
+
|
|
8
|
+
#include <SDKDDKVer.h>
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
#ifndef SEGMENTATIONRESULTSPY_H
|
|
2
|
+
#define SEGMENTATIONRESULTSPY_H
|
|
3
|
+
|
|
4
|
+
#include <pybind11/pybind11.h>
|
|
5
|
+
#include <pybind11/numpy.h>
|
|
6
|
+
#include "SegmentationResults.h"
|
|
7
|
+
|
|
8
|
+
namespace py = pybind11;
|
|
9
|
+
|
|
10
|
+
namespace PythonAlgorithms
|
|
11
|
+
{
|
|
12
|
+
class SegmentationResults
|
|
13
|
+
{
|
|
14
|
+
private:
|
|
15
|
+
int _signalLength;
|
|
16
|
+
py::array_t<int> _binaryEventSequence;
|
|
17
|
+
int _numberOfBinaryEvents;
|
|
18
|
+
py::array_t<double> _filteredSignal;
|
|
19
|
+
py::array_t<double> _segmentedLog;
|
|
20
|
+
py::array_t<double> _noiseVariance;
|
|
21
|
+
double _jumpSequenceVariance;
|
|
22
|
+
double _segmentDensity;
|
|
23
|
+
int _iterations;
|
|
24
|
+
int _error;
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Default constructor.
|
|
29
|
+
/// </summary>
|
|
30
|
+
SegmentationResults();
|
|
31
|
+
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Constructor.
|
|
34
|
+
/// </summary>
|
|
35
|
+
/// <param name="segmentationResults">SegmentationResults which will be converted for use in Python.</param>
|
|
36
|
+
SegmentationResults(Algorithms::SegmentationResults* segmentationResults);
|
|
37
|
+
|
|
38
|
+
/// <summary>
|
|
39
|
+
/// Constructor for calling from Python.
|
|
40
|
+
/// </summary>
|
|
41
|
+
/// <param name="signalLength">Length of the signal/binary event sequence/filtered signal/et cetera.</param>
|
|
42
|
+
/// <param name="binaryEventSequence">Binary event sequence.</param>
|
|
43
|
+
/// <param name="numberOfBinaryEvents">Number of binary events found (number of "1"s found in binary event sequence).</param>
|
|
44
|
+
/// <param name="filteredSignal">Filtered signal.</param>
|
|
45
|
+
/// <param name="segmentedLog">Segmented log.</param>
|
|
46
|
+
/// <param name="noiseVariance">Noise variance.</param>
|
|
47
|
+
/// <param name="jumpSequenceVariance">Jump sequence variance.</param>
|
|
48
|
+
/// <param name="segmentDensity">Segment density (ratio of events to total entries in binary event sequence).</param>
|
|
49
|
+
/// <param name="iterations">Number of iterations performed.</param>
|
|
50
|
+
/// <param name="error">Error flag.</param>
|
|
51
|
+
SegmentationResults(int signalLength, py::array_t<int> binaryEventSequence, int numberOfBinaryEvents, py::array_t<double> filteredSignal, py::array_t<double> segmentedLog,
|
|
52
|
+
py::array_t<double> noiseVariance, double jumpSequenceVariance, double segmentDensity, int iterations, int error);
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
/// destructor.
|
|
56
|
+
/// </summary>
|
|
57
|
+
~SegmentationResults();
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// Length of the input signal. The output sequences are the name length.
|
|
62
|
+
/// </summary>
|
|
63
|
+
int GetSignalLength() const;
|
|
64
|
+
|
|
65
|
+
/// <summary>
|
|
66
|
+
/// Array that contains 1s at segmented log boundaries and 0s elsewhere.
|
|
67
|
+
/// </summary>
|
|
68
|
+
py::array_t<int> GetBinaryEventSequence() const;
|
|
69
|
+
|
|
70
|
+
/// <summary>
|
|
71
|
+
/// Number of binary event sequences detected (number of "1"s in the BinaryEventSequence array).
|
|
72
|
+
/// </summary>
|
|
73
|
+
int GetNumberOfBinaryEvents() const;
|
|
74
|
+
|
|
75
|
+
/// <summary>
|
|
76
|
+
/// Filtered estimate of the signal.
|
|
77
|
+
/// </summary>
|
|
78
|
+
py::array_t<double> GetFilteredSignal() const;
|
|
79
|
+
|
|
80
|
+
/// <summary>
|
|
81
|
+
/// Average of filter log for each segment.
|
|
82
|
+
/// </summary>
|
|
83
|
+
py::array_t<double> GetSegmentedLog() const;
|
|
84
|
+
|
|
85
|
+
/// <summary>
|
|
86
|
+
/// Estimate noise variance.
|
|
87
|
+
/// </summary>
|
|
88
|
+
py::array_t<double> GetNoiseVariance() const;
|
|
89
|
+
|
|
90
|
+
/// <summary>
|
|
91
|
+
/// Estimated variance of the jump sequence.
|
|
92
|
+
/// </summary>
|
|
93
|
+
double GetJumpSequenceVariance() const;
|
|
94
|
+
|
|
95
|
+
/// <summary>
|
|
96
|
+
/// Estimate segment density.
|
|
97
|
+
/// </summary>
|
|
98
|
+
double GetSegmentDensity() const;
|
|
99
|
+
|
|
100
|
+
/// <summary>
|
|
101
|
+
/// SMLR iteration count.
|
|
102
|
+
/// </summary>
|
|
103
|
+
int GetIterations() const;
|
|
104
|
+
|
|
105
|
+
/// <summary>
|
|
106
|
+
/// Error flag.
|
|
107
|
+
/// Zero - no error.
|
|
108
|
+
/// Less than zero - invalid event density estimated after threshold. Reduce/increase
|
|
109
|
+
/// threshold and rerun.
|
|
110
|
+
/// Greater than zero - logarithm argument became zero at sample number returned in error during
|
|
111
|
+
/// the calculation of likelihood ratios in SMLR. There may be more samples of this type which
|
|
112
|
+
/// may give rise to this problem. Edit/rescale data values and rerun.
|
|
113
|
+
/// </summary>
|
|
114
|
+
int GetError() const;
|
|
115
|
+
|
|
116
|
+
}; // End class.
|
|
117
|
+
} // End namespace.
|
|
118
|
+
|
|
119
|
+
#endif
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
from setuptools import Extension
|
|
4
|
+
from pybind11 import get_include
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
sourceDirectory = os.path.join("src", "CPP Static Library")
|
|
8
|
+
pythonDirectory = os.path.join("src", "Python Extension")
|
|
9
|
+
|
|
10
|
+
setup(
|
|
11
|
+
ext_modules=[
|
|
12
|
+
Extension(
|
|
13
|
+
name="SegmentSignalPy",
|
|
14
|
+
sources=[
|
|
15
|
+
os.path.join(pythonDirectory, file)
|
|
16
|
+
for file in ["module.cpp", "SegmentationResultsPy.cpp"]
|
|
17
|
+
] + [
|
|
18
|
+
os.path.join(sourceDirectory, file)
|
|
19
|
+
for file in ["SegmentSignalFunctions.cpp", "SegmentationResults.cpp", "SegmentSignal.cpp"]
|
|
20
|
+
],
|
|
21
|
+
include_dirs=[get_include(), sourceDirectory],
|
|
22
|
+
language="c++",
|
|
23
|
+
extra_compile_args=[]
|
|
24
|
+
)
|
|
25
|
+
]
|
|
26
|
+
)
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: SegmentSignalPy
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Signal segmentation algorithm by S. Radhakrishnan, et al. This is a Python interface for the C++ algorithm.
|
|
5
|
+
License: Copyright (c) 2021-2024 Lance A. Endres
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
|
|
26
|
+
Project-URL: homepage, https://github.com/lendres/Segment-Signals
|
|
27
|
+
Requires-Python: >=3.11.0
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# Segment Signals
|
|
31
|
+
A signal segmentation algorithm.
|
|
32
|
+
|
|
33
|
+
## Introduction
|
|
34
|
+
This library implements the algorithm found in:
|
|
35
|
+
[_Segmentation of well logs by maximum likelihood estimation: the algorithm and FORTRAN-77 implementation_](https://www.sciencedirect.com/science/article/pii/0098300491900237) by S.Radhakrishnan, G.Srikanth, and C.H.Mehta
|
|
36
|
+
|
|
37
|
+
The original algorithm was written in Fortran. This version converts it to C++ and C#. In addition, the following changes have been made:
|
|
38
|
+
- Converted the binary event array (Q) from double to int. Likely, the original was a double to keep all options as floats and prevent accidental round off. C/C++ automatically perform calculations as doubles when any of the parameters is a double. The binary event sequence is, of course, meant to be binary, so conversion to int is logical. This also meant a few lines could be simplified (such as comparisons). E.g. you could directly test "if (Q[i])" rather than requiring the inequality.
|
|
39
|
+
- Removed a bug from the GETSPK/GetSpikeyZone function. The fix prevents over running the end of an array.
|
|
40
|
+
- Addition of `FindSignificantZones` to allow simple filtering (removal) of small zones.
|
|
41
|
+
|
|
42
|
+
## Organization
|
|
43
|
+
A high-level view of the organization is as follows.
|
|
44
|
+
|
|
45
|
+
- CPP Static Library
|
|
46
|
+
- SegmentSignalFunctions.
|
|
47
|
+
- **It is suggested not to use these directly, but to use the class `SegmentSignal` instead.**
|
|
48
|
+
These files implement the original algorithm in C++. The function names have changed to something more readable. The original function names can be found in the comments in
|
|
49
|
+
the .cpp file. The functions have otherwise been directly converted from Fortran and should be easily comparable to those in the source paper.
|
|
50
|
+
- SegmentSignal.*
|
|
51
|
+
- A class interface to the functions that makes use of the algorithm easier.
|
|
52
|
+
- SegmentationResults.*
|
|
53
|
+
- Small class to return results of the algorithm.
|
|
54
|
+
- NoiseVarianceEstimateMethod.h
|
|
55
|
+
- Enumeration for the noise variance estimation method.
|
|
56
|
+
|
|
57
|
+
- C DLL
|
|
58
|
+
- DLL wrapper around the main SegmentSignal function. The DLL exposes a C function for calling.
|
|
59
|
+
|
|
60
|
+
- C Sharp DLL Wrapper
|
|
61
|
+
- C# interface to the DLL. Classes mirror those in C++.
|
|
62
|
+
|
|
63
|
+
- Unit Tests
|
|
64
|
+
- Testing projects. Also provides examples. See the "LogSeparateTest" functions for a basic example.
|
|
65
|
+
|
|
66
|
+
- Python Extensions
|
|
67
|
+
- Builds a library for use with Python. See the `src/Python Extensions/Read Me.txt` file in that project for more information.
|
|
68
|
+
|
|
69
|
+
## Compiling
|
|
70
|
+
The Python Extension library requires knowledge of your local Python. See the `src/Python Extensions/Read Me.txt` file in that directory for more information.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
License.txt
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
setup.py
|
|
6
|
+
src/C DLL/DLLExport.h
|
|
7
|
+
src/CPP Static Library/NoiseVarianceEstimateMethod.h
|
|
8
|
+
src/CPP Static Library/SegmentSignal.cpp
|
|
9
|
+
src/CPP Static Library/SegmentSignal.h
|
|
10
|
+
src/CPP Static Library/SegmentSignalFunctions.cpp
|
|
11
|
+
src/CPP Static Library/SegmentSignalFunctions.h
|
|
12
|
+
src/CPP Static Library/SegmentationResults.cpp
|
|
13
|
+
src/CPP Static Library/SegmentationResults.h
|
|
14
|
+
src/CPP Unit Tests/InputDataEnum.h
|
|
15
|
+
src/CPP Unit Tests/stdafx.h
|
|
16
|
+
src/CPP Unit Tests/targetver.h
|
|
17
|
+
src/Python Extension/SegmentationResultsPy.cpp
|
|
18
|
+
src/Python Extension/SegmentationResultsPy.h
|
|
19
|
+
src/Python Extension/module.cpp
|
|
20
|
+
src/Python Extension/setup.py
|
|
21
|
+
src/SegmentSignalPy.egg-info/PKG-INFO
|
|
22
|
+
src/SegmentSignalPy.egg-info/SOURCES.txt
|
|
23
|
+
src/SegmentSignalPy.egg-info/dependency_links.txt
|
|
24
|
+
src/SegmentSignalPy.egg-info/top_level.txt
|
segmentsignalpy-0.1.2/PKG-INFO
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: SegmentSignalPy
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Signal segmentation algorithm by S. Radhakrishnan, et al. This is a Python interface for the C++ algorithm.
|
|
5
|
-
License: Copyright (c) 2021-2024 Lance A. Endres
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
-
a copy of this software and associated documentation files (the
|
|
9
|
-
"Software"), to deal in the Software without restriction, including
|
|
10
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
-
the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
-
|
|
26
|
-
Project-URL: homepage, https://github.com/lendres/Segment-Signals
|
|
27
|
-
Requires-Python: >=3.11.0
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
|
|
30
|
-
# Segment Signals
|
|
31
|
-
A signal segmentation algorithm.
|
|
32
|
-
|
|
33
|
-
## Compiling
|
|
34
|
-
The Python Extension library requires the knowledge of your local Python. See the *Read Me.txt* file in that directory for more information.
|
segmentsignalpy-0.1.2/README.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: SegmentSignalPy
|
|
3
|
-
Version: 0.1.2
|
|
4
|
-
Summary: Signal segmentation algorithm by S. Radhakrishnan, et al. This is a Python interface for the C++ algorithm.
|
|
5
|
-
License: Copyright (c) 2021-2024 Lance A. Endres
|
|
6
|
-
|
|
7
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
-
a copy of this software and associated documentation files (the
|
|
9
|
-
"Software"), to deal in the Software without restriction, including
|
|
10
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
-
the following conditions:
|
|
14
|
-
|
|
15
|
-
The above copyright notice and this permission notice shall be
|
|
16
|
-
included in all copies or substantial portions of the Software.
|
|
17
|
-
|
|
18
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
-
|
|
26
|
-
Project-URL: homepage, https://github.com/lendres/Segment-Signals
|
|
27
|
-
Requires-Python: >=3.11.0
|
|
28
|
-
Description-Content-Type: text/markdown
|
|
29
|
-
|
|
30
|
-
# Segment Signals
|
|
31
|
-
A signal segmentation algorithm.
|
|
32
|
-
|
|
33
|
-
## Compiling
|
|
34
|
-
The Python Extension library requires the knowledge of your local Python. See the *Read Me.txt* file in that directory for more information.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
License.txt
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
setup.py
|
|
5
|
-
src/CPP Static Library/SegmentSignal.cpp
|
|
6
|
-
src/CPP Static Library/SegmentSignalFunctions.cpp
|
|
7
|
-
src/CPP Static Library/SegmentationResults.cpp
|
|
8
|
-
src/Python Extension/SegmentationResultsPy.cpp
|
|
9
|
-
src/Python Extension/module.cpp
|
|
10
|
-
src/SegmentSignalPy.egg-info/PKG-INFO
|
|
11
|
-
src/SegmentSignalPy.egg-info/SOURCES.txt
|
|
12
|
-
src/SegmentSignalPy.egg-info/dependency_links.txt
|
|
13
|
-
src/SegmentSignalPy.egg-info/top_level.txt
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/CPP Static Library/SegmentSignalFunctions.cpp
RENAMED
|
File without changes
|
{segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/CPP Static Library/SegmentationResults.cpp
RENAMED
|
File without changes
|
{segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/Python Extension/SegmentationResultsPy.cpp
RENAMED
|
File without changes
|
|
File without changes
|
{segmentsignalpy-0.1.2 → segmentsignalpy-0.1.3}/src/SegmentSignalPy.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|