Metadata-Version: 2.4
Name: pta-learn
Version: 0.1.3
Summary: A Python library for automated feature extraction and pattern recognition in Pressure Transient Analysis (PTA) workflows.
Project-URL: Homepage, https://github.com/vitaliistarr/pta-learn
Project-URL: Repository, https://github.com/vitaliistarr/pta-learn.git
Project-URL: Bug Tracker, https://github.com/vitaliistarr/pta-learn/issues
Author-email: "V. Starikov" <starikovv98@gmail.com>
License: MIT License
        
        Copyright (c) 2025 [AutoWell](https://www.norceresearch.no/en/projects/autowell-automated-well-monitoring-and-control) project team including [Vitaly Starikov](https://www.linkedin.com/in/vitalystarikov/).
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: feature-extraction,pattern-recognition,pressure-transient-analysis,well-testing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Requires-Dist: matplotlib>=3.4.0
Requires-Dist: numba>=0.53.0
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: plotly>=5.0.0
Requires-Dist: scikit-learn>=0.24.0
Requires-Dist: scikit-optimize>=0.9.0
Requires-Dist: scipy>=1.7.0
Provides-Extra: dev
Requires-Dist: black>=22.0; extra == 'dev'
Requires-Dist: isort>=5.0; extra == 'dev'
Requires-Dist: pytest-cov>=2.0; extra == 'dev'
Requires-Dist: pytest>=6.0; extra == 'dev'
Description-Content-Type: text/markdown

# pta-learn

A Python library for automated feature extraction and pattern recognition for Pressure Transient Analysis (PTA) workflows. The library provides tools to detect flow regime features and recognize stable patterns in time-lapse pressure transient responses. The library is based on the methodology described in the peer-reviewed paper: [Feature extraction and pattern recognition in time-lapse pressure transient responses](https://doi.org/10.1016/j.geoen.2024.213160).

Usage examples provided in:

<a href="https://colab.research.google.com/drive/1ioJiNM5xpNyP1NoVpBrQp1qr1u94Knlz?usp=sharing"> PTA flow regime feature extraction example <img src="https://colab.research.google.com/assets/colab-badge.svg" height=16px></a> <br>
<a href="https://colab.research.google.com/drive/1_ASQ8nmRewhCZmNSMPcs3WBmBFFGiSs6?usp=sharing"> Time-lapse PTA pattern recognition example <img src="https://colab.research.google.com/assets/colab-badge.svg" height=16px></a>


## Installation

Install the package using pip:

```bash
pip install pta-learn
```


## Usage

### Feature Extraction

- Automated flow regime feature detection
- Parameter optimization
- Visualization tools
- Multiple export formats (Excel, CSV)


The `PTAClassifier` class provides automated flow regime detection for single pressure transient analysis:

```python
from pta_learn import PTAClassifier
import numpy as np

# Prepare your data as a 2D numpy array with columns: [time, pressure, pressure_derivative]
data = np.array([
    [time_values],
    [pressure_values],
    [pressure_derivative_values]
]).T

# Initialize classifier
clf = PTAClassifier()

# Option 1: Fit and predict separately
clf.fit(data)
output, distance = clf.predict()

# Option 2: Fit and predict in one step
output, distance = clf.fit_predict(data)

# Option 3: Optimize parameters and predict
output, distance, optimization_result = clf.predict_optimize()

# Plot results
fig = clf.plot(industry_chart=True)

# Export results
clf.to_excel("results")  # or
clf.to_csv("results")
```

### Pattern Recognition
- Multi-transient analysis
- Stable pattern recognition
- Confidence estimation
- Result visualization

The `PatternRecognition` class enables multi-transient analysis to identify stable patterns:

```python
from pta_learn import PatternRecognition
import pandas as pd

# Prepare list of dataframes, each containing [time, pressure, pressure_derivative]
transient1 = pd.DataFrame({
    'time': time_values1,
    'pressure': pressure_values1,
    'pressure_derivative': pressure_derivative_values1
})
transient2 = pd.DataFrame({...})
data = [transient1, transient2]

# Initialize pattern recognition
pr = PatternRecognition()

# Fit data
pr.fit(data)

# Detect features
pr.detect_features()

# Get stable pattern
fig = pr.get_stable_pattern()

# Export results
pr.to_excel("pattern_results")
```

## Citation

If you use this library in your research, please cite:

```
@article{starikov2024feature,
  title={Feature extraction and pattern recognition in time-lapse pressure transient responses},
  author={Starikov, V. and Shchipanov, A. and Demyanov, V. and Muradov, K.},
  journal={Geoenergy Science and Engineering},
  volume={242},
  pages={213160},
  year={2024},
  publisher={Elsevier},
  doi={10.1016/j.geoen.2024.213160},
  url={https://www.sciencedirect.com/science/article/pii/S294989102400530X}
}

@conference{starikov2023unsupervised,
  title={Unsupervised Classification of Flow Regime Features in Pressure Transient Responses},
  author={Starikov, V. and Demyanov, V. and Muradov, K. and Shchipanov, A.},
  booktitle={Fifth EAGE Conference on Petroleum Geostatistics},
  year={2023},
  month={Nov},
  pages={1-5},
  publisher={European Association of Geoscientists & Engineers},
  doi={10.3997/2214-4609.202335019}
}
```
## Acknowledgements

This research code was developed within the AutoWell research and development project funded by the Research Council of Norway and the industry partners including ConocoPhillips Skandinavia, Sumitomo Corporation Europe Norway Branch, Harbour Energy and Aker BP (grant no. 326580, PETROMAKS2 programme)​

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

