quick-pp 0.2.51__tar.gz → 0.2.52__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.
Files changed (77) hide show
  1. quick_pp-0.2.52/PKG-INFO +145 -0
  2. quick_pp-0.2.52/README.md +112 -0
  3. {quick_pp-0.2.51 → quick_pp-0.2.52}/pyproject.toml +1 -1
  4. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/__init__.py +1 -1
  5. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/plotter/plotter.py +8 -24
  6. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/plotter/well_log.py +81 -0
  7. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/rock_physics/rpm.py +70 -17
  8. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/rock_type.py +1 -1
  9. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/utils.py +2 -2
  10. quick_pp-0.2.51/PKG-INFO +0 -119
  11. quick_pp-0.2.51/README.md +0 -86
  12. {quick_pp-0.2.51 → quick_pp-0.2.52}/.gitignore +0 -0
  13. {quick_pp-0.2.51 → quick_pp-0.2.52}/LICENSE +0 -0
  14. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/__init__.py +0 -0
  15. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/exceptions.py +0 -0
  16. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/__init__.py +0 -0
  17. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/_mlflow_types.py +0 -0
  18. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/applications.py +0 -0
  19. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/exceptions.py +0 -0
  20. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/fastapi_mlflow/predictors.py +0 -0
  21. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/main.py +0 -0
  22. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/mlflow_model_deployment.py +0 -0
  23. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/router.py +0 -0
  24. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_hc_correction.py +0 -0
  25. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_ssc.py +0 -0
  26. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/lithology_vsh_gr.py +0 -0
  27. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/permeability_choo.py +0 -0
  28. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/permeability_others.py +0 -0
  29. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/porosity.py +0 -0
  30. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/ressum.py +0 -0
  31. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_archie.py +0 -0
  32. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_b.py +0 -0
  33. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_qv.py +0 -0
  34. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_rw.py +0 -0
  35. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_temp_grad.py +0 -0
  36. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/schemas/saturation_waxman_smits.py +0 -0
  37. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/chat.py +0 -0
  38. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/las_handler.py +0 -0
  39. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/lithology.py +0 -0
  40. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/permeability.py +0 -0
  41. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/porosity.py +0 -0
  42. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/reservoir_summary.py +0 -0
  43. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/services/saturation.py +0 -0
  44. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/static/favicon.ico +0 -0
  45. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/static/logo.png +0 -0
  46. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/template/chat.html +0 -0
  47. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/api/template/home.html +0 -0
  48. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/cli.py +0 -0
  49. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/config.py +0 -0
  50. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/core_calibration.py +0 -0
  51. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/fluid_type.py +0 -0
  52. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/las_handler.py +0 -0
  53. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/__init__.py +0 -0
  54. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/carbonate.py +0 -0
  55. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/multi_mineral.py +0 -0
  56. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/sand_shale.py +0 -0
  57. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/sand_silt_clay.py +0 -0
  58. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/lithology/thin_beds.py +0 -0
  59. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/__init__.py +0 -0
  60. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/config.py +0 -0
  61. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/feature_engineering.py +0 -0
  62. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/mock_data/mock_data.parquet +0 -0
  63. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/predict_pipeline.py +0 -0
  64. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/train_pipeline.py +0 -0
  65. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/machine_learning/utils.py +0 -0
  66. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/objects.py +0 -0
  67. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/permeability.py +0 -0
  68. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/plotter/__init__.py +0 -0
  69. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/plotter/well_log_config.py +0 -0
  70. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/plotter/xplots.py +0 -0
  71. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/porosity.py +0 -0
  72. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/qaqc.py +0 -0
  73. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/ressum.py +0 -0
  74. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/rock_physics/__init__.py +0 -0
  75. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/rock_physics/geomechanics.py +0 -0
  76. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/rock_physics/geophysics.py +0 -0
  77. {quick_pp-0.2.51 → quick_pp-0.2.52}/quick_pp/saturation.py +0 -0
@@ -0,0 +1,145 @@
1
+ Metadata-Version: 2.4
2
+ Name: quick-pp
3
+ Version: 0.2.52
4
+ Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
5
+ Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
6
+ Author-email: Imran Fadhil <imranfadhil@gmail.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Keywords: analysis,geoscience,log,petrophysics,quick_pp,well
10
+ Classifier: Development Status :: 2 - Pre-Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: click>=7.0
17
+ Requires-Dist: fastapi
18
+ Requires-Dist: loguru
19
+ Requires-Dist: matplotlib==3.8.0
20
+ Requires-Dist: mlflow
21
+ Requires-Dist: orjson
22
+ Requires-Dist: pandas
23
+ Requires-Dist: psycopg2-binary
24
+ Requires-Dist: ptitprince
25
+ Requires-Dist: python-multipart
26
+ Requires-Dist: ruptures
27
+ Requires-Dist: salib==1.5.1
28
+ Requires-Dist: scikit-learn
29
+ Requires-Dist: setuptools<81
30
+ Requires-Dist: statsmodels
31
+ Requires-Dist: welly
32
+ Description-Content-Type: text/markdown
33
+
34
+ # quick_pp
35
+
36
+ A Python package for quick-look preliminary petrophysical estimations.
37
+
38
+ ![quick_pp demo](docs/static/quick_pp_demo.gif)
39
+
40
+ ## Installation
41
+
42
+ You can install `quick_pp` directly from PyPI:
43
+
44
+ ```bash
45
+ pip install quick_pp
46
+ ```
47
+
48
+ For development or to use the `qpp_assistant`, you'll need to clone the repository and install dependencies:
49
+
50
+ 1. **Clone the repository:**
51
+ ```bash
52
+ git clone https://github.com/imranfadhil/quick_pp.git
53
+ cd quick_pp
54
+ ```
55
+
56
+ 2. **Create and activate a virtual environment** (tested with Python 3.11):
57
+ ```bash
58
+ uv venv --python 3.11
59
+ source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
60
+ ```
61
+
62
+ 3. **Install the required packages:**
63
+ ```bash
64
+ uv pip install -r requirements.txt
65
+ ```
66
+
67
+ ## Quick Start
68
+
69
+ ### Jupyter Notebook Examples
70
+
71
+ The included notebooks demonstrate the core functionalities:
72
+
73
+ - `01_data_handler`: Create a MOCK `qppp` project file.
74
+ - `02_EDA`: Perform a quick exploratory data analysis.
75
+ - `03_*`: Carry out petrophysical interpretation of the MOCK wells.
76
+
77
+ > **Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
78
+
79
+ ### `qpp_assistant` Setup
80
+
81
+ To use the `qpp_assistant`, follow these steps after the development installation:
82
+
83
+ 1. Specify the required credentials in a `.env` file (you can use `.env copy` as a template).
84
+ 2. Run Docker Compose: `docker-compose up -d`.
85
+ 3. Build your flow in Langflow at `http://localhost:7860`.
86
+ 4. Run the main application: `python main.py app`.
87
+ 5. Test your flow in the qpp Assistant at `http://localhost:8888/qpp_assistant`.
88
+
89
+ ## CLI
90
+
91
+ ### Train a Machine Learning Model
92
+
93
+ **Requirements:**
94
+ - The input data must be a Parquet file located at `/data/input/<data_hash>___.parquet`.
95
+ - The Parquet file must contain the input and target features as specified in `MODELLING_CONFIG` in `config.py`.
96
+
97
+ **Command:**
98
+
99
+ > quick_pp train <model_config> <data_hash>
100
+
101
+ quick_pp train mock mock
102
+
103
+ ### Run the MLflow Server
104
+
105
+ **Command:**
106
+ ```bash
107
+ quick_pp mlflow-server
108
+ ```
109
+ You can access the MLflow UI at `http://localhost:5015`.
110
+
111
+ ### Run Predictions
112
+
113
+ > **Note:** Trained models must be registered in MLflow before running predictions.
114
+
115
+ > quick_pp predict <model_config> <data_hash>
116
+
117
+ **Example:**
118
+ ```bash
119
+ quick_pp predict mock mock
120
+ ```
121
+
122
+ ### Deploy Trained Models as an API
123
+
124
+ ```bash
125
+ quick_pp model-deployment
126
+ ```
127
+ You can access the deployed model's Swagger UI at `http://localhost:5555/docs`.
128
+
129
+ ### Start the Main Application
130
+
131
+ ```bash
132
+ quick_pp app
133
+ ```
134
+ - **API Docs:** `http://localhost:8888/docs`
135
+ - **qpp_assistant:** `http://localhost:8888/qpp_assistant` (you can log in with any username and password).
136
+
137
+ To use the mcp tools, you would need to first add the following SSE URLS through the interface;
138
+ http://localhost:8888/mcp - quick_pp tools.
139
+
140
+ http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
141
+
142
+ ## Documentation
143
+
144
+ Documentation is available at:
145
+ <https://quick-pp.readthedocs.io/en/latest/index.html>
@@ -0,0 +1,112 @@
1
+ # quick_pp
2
+
3
+ A Python package for quick-look preliminary petrophysical estimations.
4
+
5
+ ![quick_pp demo](docs/static/quick_pp_demo.gif)
6
+
7
+ ## Installation
8
+
9
+ You can install `quick_pp` directly from PyPI:
10
+
11
+ ```bash
12
+ pip install quick_pp
13
+ ```
14
+
15
+ For development or to use the `qpp_assistant`, you'll need to clone the repository and install dependencies:
16
+
17
+ 1. **Clone the repository:**
18
+ ```bash
19
+ git clone https://github.com/imranfadhil/quick_pp.git
20
+ cd quick_pp
21
+ ```
22
+
23
+ 2. **Create and activate a virtual environment** (tested with Python 3.11):
24
+ ```bash
25
+ uv venv --python 3.11
26
+ source .venv/bin/activate # On Windows, use: .venv\Scripts\activate
27
+ ```
28
+
29
+ 3. **Install the required packages:**
30
+ ```bash
31
+ uv pip install -r requirements.txt
32
+ ```
33
+
34
+ ## Quick Start
35
+
36
+ ### Jupyter Notebook Examples
37
+
38
+ The included notebooks demonstrate the core functionalities:
39
+
40
+ - `01_data_handler`: Create a MOCK `qppp` project file.
41
+ - `02_EDA`: Perform a quick exploratory data analysis.
42
+ - `03_*`: Carry out petrophysical interpretation of the MOCK wells.
43
+
44
+ > **Note:** For the API notebook, you need to run `python main.py app` before executing the cells.
45
+
46
+ ### `qpp_assistant` Setup
47
+
48
+ To use the `qpp_assistant`, follow these steps after the development installation:
49
+
50
+ 1. Specify the required credentials in a `.env` file (you can use `.env copy` as a template).
51
+ 2. Run Docker Compose: `docker-compose up -d`.
52
+ 3. Build your flow in Langflow at `http://localhost:7860`.
53
+ 4. Run the main application: `python main.py app`.
54
+ 5. Test your flow in the qpp Assistant at `http://localhost:8888/qpp_assistant`.
55
+
56
+ ## CLI
57
+
58
+ ### Train a Machine Learning Model
59
+
60
+ **Requirements:**
61
+ - The input data must be a Parquet file located at `/data/input/<data_hash>___.parquet`.
62
+ - The Parquet file must contain the input and target features as specified in `MODELLING_CONFIG` in `config.py`.
63
+
64
+ **Command:**
65
+
66
+ > quick_pp train <model_config> <data_hash>
67
+
68
+ quick_pp train mock mock
69
+
70
+ ### Run the MLflow Server
71
+
72
+ **Command:**
73
+ ```bash
74
+ quick_pp mlflow-server
75
+ ```
76
+ You can access the MLflow UI at `http://localhost:5015`.
77
+
78
+ ### Run Predictions
79
+
80
+ > **Note:** Trained models must be registered in MLflow before running predictions.
81
+
82
+ > quick_pp predict <model_config> <data_hash>
83
+
84
+ **Example:**
85
+ ```bash
86
+ quick_pp predict mock mock
87
+ ```
88
+
89
+ ### Deploy Trained Models as an API
90
+
91
+ ```bash
92
+ quick_pp model-deployment
93
+ ```
94
+ You can access the deployed model's Swagger UI at `http://localhost:5555/docs`.
95
+
96
+ ### Start the Main Application
97
+
98
+ ```bash
99
+ quick_pp app
100
+ ```
101
+ - **API Docs:** `http://localhost:8888/docs`
102
+ - **qpp_assistant:** `http://localhost:8888/qpp_assistant` (you can log in with any username and password).
103
+
104
+ To use the mcp tools, you would need to first add the following SSE URLS through the interface;
105
+ http://localhost:8888/mcp - quick_pp tools.
106
+
107
+ http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
108
+
109
+ ## Documentation
110
+
111
+ Documentation is available at:
112
+ <https://quick-pp.readthedocs.io/en/latest/index.html>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "quick-pp"
7
- version = "0.2.51"
7
+ version = "0.2.52"
8
8
  description = "Python package to assist in providing quick-look/ preliminary petrophysical estimation."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -20,4 +20,4 @@ logging.getLogger("mlflow").setLevel(logging.WARNING)
20
20
 
21
21
  __author__ = """Imran Fadhil"""
22
22
  __email__ = 'imranfadhil@gmail.com'
23
- __version__ = '0.2.5' # Need to be updated manually when releasing a new version/ change in pyproject.toml
23
+ __version__ = '0.2.52' # Need to be updated manually when releasing a new version/ change in pyproject.toml
@@ -18,7 +18,6 @@ plt.rcParams.update(
18
18
 
19
19
 
20
20
  def update_fluid_contacts(well_data, well_config: dict):
21
- logger.debug(f"Updating fluid contacts for well with config: {well_config}")
22
21
  """Update fluid flags based on fluid contacts.
23
22
 
24
23
  Args:
@@ -58,7 +57,6 @@ def update_fluid_contacts(well_data, well_config: dict):
58
57
 
59
58
 
60
59
  def generate_zone_config(zones: list = ['ALL']):
61
- logger.info(f"Generating zone config for zones: {zones}")
62
60
  """Generate zone configuration.
63
61
 
64
62
  Args:
@@ -67,6 +65,7 @@ def generate_zone_config(zones: list = ['ALL']):
67
65
  Returns:
68
66
  dict: Zone configuration
69
67
  """
68
+ logger.info(f"Generating zone config for zones: {zones}")
70
69
  zone_config = {}
71
70
  for zone in zones:
72
71
  zone_config[zone] = {
@@ -76,7 +75,6 @@ def generate_zone_config(zones: list = ['ALL']):
76
75
 
77
76
 
78
77
  def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
79
- logger.info(f"Updating zone config for zone: {zone} with contacts: {fluid_contacts}")
80
78
  """Update zone configuration with fluid contacts.
81
79
 
82
80
  Args:
@@ -87,6 +85,7 @@ def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
87
85
  Returns:
88
86
  dict: Updated zone configuration
89
87
  """
88
+ logger.info(f"Updating zone config for zone: {zone} with contacts: {fluid_contacts}")
90
89
  if zone in zone_config:
91
90
  zone_config[zone].update(fluid_contacts)
92
91
  else:
@@ -95,7 +94,6 @@ def update_zone_config(zone_config: dict, zone: str, fluid_contacts: dict):
95
94
 
96
95
 
97
96
  def generate_well_config(well_names: list = ['X']):
98
- logger.info(f"Generating well config for wells: {well_names}")
99
97
  """Generate well configuration.
100
98
 
101
99
  Args:
@@ -104,6 +102,7 @@ def generate_well_config(well_names: list = ['X']):
104
102
  Returns:
105
103
  dict: Well configuration
106
104
  """
105
+ logger.info(f"Generating well config for wells: {well_names}")
107
106
  well_config = {}
108
107
  for i, well in enumerate(well_names):
109
108
  well_config[well] = {
@@ -115,9 +114,7 @@ def generate_well_config(well_names: list = ['X']):
115
114
  return well_config
116
115
 
117
116
 
118
- def update_well_config(
119
- well_config: dict, well_name: str, zone: str = '', fluid_contacts: dict = {}, sorting: int = 0):
120
- logger.info(f"Updating well config for well: {well_name}, zone: {zone}, sorting: {sorting}")
117
+ def update_well_config(well_config: dict, well_name: str, zone: str = '', fluid_contacts: dict = {}, sorting: int = 0):
121
118
  """Update well configuration with fluid contacts.
122
119
 
123
120
  Args:
@@ -130,6 +127,7 @@ def update_well_config(
130
127
  Returns:
131
128
  dict: Updated well configuration
132
129
  """
130
+ logger.info(f"Updating well config for well: {well_name}, zone: {zone}, sorting: {sorting}")
133
131
  if zone in well_config[well_name]['zones']:
134
132
  well_config[well_name]['zones'][zone].update(fluid_contacts)
135
133
  elif zone:
@@ -141,12 +139,12 @@ def update_well_config(
141
139
 
142
140
 
143
141
  def assert_well_config_structure(well_config):
144
- logger.debug("Asserting well config structure.")
145
142
  """Assert well configuration structure.
146
143
 
147
144
  Args:
148
145
  well_config (dict): Dictionary containing well sorting and fluid contacts.
149
146
  """
147
+ logger.debug("Asserting well config structure.")
150
148
  required_keys = {'sorting', 'zones'}
151
149
  optional_keys = {'GUT', 'GDT', 'GOC', 'GWC', 'OUT', 'ODT', 'OWC', 'WUT'}
152
150
  for well, config in well_config.items():
@@ -160,7 +158,6 @@ def assert_well_config_structure(well_config):
160
158
 
161
159
 
162
160
  def stick_plot(data, well_config: dict, zone: str = 'ALL'):
163
- logger.info(f"Generating stick plot for zone: {zone}")
164
161
  """Generate stick plot with water saturation and fluid contacts for specified zone.
165
162
 
166
163
  Example of well_config:
@@ -188,6 +185,7 @@ def stick_plot(data, well_config: dict, zone: str = 'ALL'):
188
185
  data (pandas.DataFrame): Pandas dataframe containing well log data.
189
186
  well_config (dict): Dictionary containing well sorting and fluid contacts.
190
187
  """
188
+ logger.info(f"Generating stick plot for zone: {zone}")
191
189
  assert 'SWT' in data.columns, 'SWT column not found in data.'
192
190
  assert_well_config_structure(well_config)
193
191
 
@@ -235,7 +233,6 @@ def neutron_density_xplot(nphi, rhob,
235
233
  fluid_point: tuple = (1.0, 1.0),
236
234
  wet_clay_point: tuple = (),
237
235
  dry_silt_point: tuple = (), **kwargs):
238
- logger.info("Generating neutron-density crossplot.")
239
236
  """Neutron-Density crossplot with lithology lines based on specified end points.
240
237
 
241
238
  Args:
@@ -250,6 +247,7 @@ def neutron_density_xplot(nphi, rhob,
250
247
  Returns:
251
248
  matplotlib.pyplot.Figure: Neutron porosity and bulk density cross plot.
252
249
  """
250
+ logger.info("Generating neutron-density crossplot.")
253
251
  A = dry_min1_point
254
252
  C = dry_clay_point
255
253
  D = fluid_point
@@ -299,17 +297,3 @@ def neutron_density_xplot(nphi, rhob,
299
297
  fig.tight_layout()
300
298
 
301
299
  return fig
302
-
303
-
304
- def sonic_density_xplot():
305
- logger.info("Called sonic_density_xplot (not implemented)")
306
- """ TODO: Implement sonic density crossplot
307
- """
308
- pass
309
-
310
-
311
- def sonic_neutron_xplot():
312
- logger.info("Called sonic_neutron_xplot (not implemented)")
313
- """ TODO: Implement sonic neutron crossplot
314
- """
315
- pass
@@ -8,6 +8,25 @@ from quick_pp.plotter.well_log_config import COLOR_DICT, TRACE_DEFS, XAXIS_DEFS
8
8
 
9
9
  # --- Helper to add traces from trace_defs ---
10
10
  def add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs):
11
+ """Adds traces to the figure based on a definitions dictionary.
12
+
13
+ Args:
14
+ fig (plotly.graph_objects.Figure): The Plotly figure to add traces to.
15
+ df (pd.DataFrame): The DataFrame containing the log data.
16
+ index (pd.Series): The depth index for the y-axis.
17
+ no_of_track (int): The total number of tracks in the plot.
18
+ trace_defs (dict): A dictionary defining the traces to be plotted.
19
+ **kwargs: Additional keyword arguments to pass to `go.Scatter`.
20
+
21
+ Returns:
22
+ plotly.graph_objects.Figure: The figure with the added traces.
23
+
24
+ Notes:
25
+ - Skips 'COAL_FLAG' and 'ZONES' as they are handled separately.
26
+ - Updates trace styles from `trace_defs`.
27
+ - Manages x-axis visibility for overlapping traces.
28
+
29
+ """
11
30
  trace_ix = 0
12
31
  for col, trace_def in trace_defs.items():
13
32
  # Skip special cases handled separately
@@ -37,6 +56,20 @@ def add_defined_traces(fig, df, index, no_of_track, trace_defs, **kwargs):
37
56
 
38
57
 
39
58
  def add_crossover_traces(df):
59
+ """Calculates and adds gas crossover shading traces to the DataFrame.
60
+
61
+ If 'NPHI' and 'RHOB' are present, this function calculates the region
62
+ where neutron porosity crosses over bulk density, indicating potential
63
+ gas zones. It adds 'RHOB_ON_NPHI_SCALE', 'GAS_XOVER_TOP', and
64
+ 'GAS_XOVER_BOTTOM' columns to the DataFrame for plotting.
65
+
66
+ Args:
67
+ df (pd.DataFrame): The DataFrame containing log data.
68
+
69
+ Returns:
70
+ pd.DataFrame: The DataFrame with added crossover-related columns.
71
+
72
+ """
40
73
  if 'NPHI' in df.columns and 'RHOB' in df.columns and 'NPHI_XOVER_BOTTOM' not in df.columns:
41
74
  rhob_min, rhob_max = 1.95, 2.95
42
75
  nphi_min_scale, nphi_max_scale = 0.45, -0.15
@@ -54,6 +87,20 @@ def add_crossover_traces(df):
54
87
 
55
88
 
56
89
  def add_rock_flag_traces(df):
90
+ """Prepares rock flag data for plotting by one-hot encoding.
91
+
92
+ If a 'ROCK_FLAG' column exists, this function:
93
+ 1. Converts it to integer type.
94
+ 2. Assigns a unique color to each flag value in `COLOR_DICT`.
95
+ 3. One-hot encodes the 'ROCK_FLAG' column into separate 'ROCK_FLAG_X' columns.
96
+
97
+ Args:
98
+ df (pd.DataFrame): The DataFrame containing log data.
99
+
100
+ Returns:
101
+ pd.DataFrame: The DataFrame with one-hot encoded rock flag columns.
102
+
103
+ """
57
104
  if 'ROCK_FLAG' in df.columns:
58
105
  # Add ROCK_FLAG colors
59
106
  df['ROCK_FLAG'] = df['ROCK_FLAG'].fillna(0).astype(int)
@@ -75,6 +122,17 @@ def add_rock_flag_traces(df):
75
122
 
76
123
 
77
124
  def fix_missing_volumetrics(df):
125
+ """Ensures standard volumetric columns exist in the DataFrame.
126
+
127
+ Iterates through a predefined list of volumetric curve names. If a column
128
+ exists, it fills missing values with 0. If it doesn't exist, it is not added.
129
+
130
+ Args:
131
+ df (pd.DataFrame): The DataFrame containing log data.
132
+
133
+ Returns:
134
+ pd.DataFrame: The DataFrame with NaNs filled in volumetric columns.
135
+ """
78
136
  volumetrics = ['VCLAY', 'VSILT', 'VSAND', 'VCALC', 'VDOLO', 'VGAS', 'VOIL', 'VHC']
79
137
  for col in volumetrics:
80
138
  df[col] = df[col].fillna(0) if col in df.columns else None
@@ -82,6 +140,18 @@ def fix_missing_volumetrics(df):
82
140
 
83
141
 
84
142
  def fix_missing_depths(df):
143
+ """Resamples the DataFrame to a regular depth interval.
144
+
145
+ This function ensures the DataFrame has a consistent depth step by
146
+ creating a complete depth range and merging the original data onto it.
147
+ This prevents gaps in the final plot.
148
+
149
+ Args:
150
+ df (pd.DataFrame): The DataFrame containing log data with a 'DEPTH' column.
151
+
152
+ Returns:
153
+ pd.DataFrame: A resampled DataFrame with consistent depth steps.
154
+ """
85
155
  depth_min = df['DEPTH'].min()
86
156
  depth_max = df['DEPTH'].max()
87
157
  depth_step = df['DEPTH'].diff().mode()[0].round(4) # Most common depth step
@@ -206,6 +276,17 @@ def plotly_log(well_data, well_name: str = '', depth_uom="", trace_defs: dict =
206
276
  )
207
277
 
208
278
  def add_zone_markers(fig, df):
279
+ """Adds horizontal lines and labels for formation tops.
280
+
281
+ If a 'ZONES' column is present, this function identifies changes in
282
+ the zone names and adds a horizontal line and a text annotation to the
283
+ plot for each formation top.
284
+
285
+ Args:
286
+ fig (plotly.graph_objects.Figure): The figure to add markers to.
287
+ df (pd.DataFrame): The DataFrame containing 'DEPTH' and 'ZONES' columns.
288
+
289
+ """
209
290
  if 'ZONES' in df.columns:
210
291
  tops_df = df[['DEPTH', 'ZONES']].dropna().reset_index()
211
292
  if not tops_df.empty and sum([1 for c in tops_df.ZONES.unique() if 'ZONE_' in c]) < 30:
@@ -12,12 +12,19 @@ from quick_pp.config import Config
12
12
 
13
13
 
14
14
  def qaqc_xplots(rhob, vp=None, vs=None):
15
- """Create crossplots for rock physics QC.
15
+ """Create a series of crossplots for rock physics quality control (QC).
16
+
17
+ This function generates a 2x3 grid of common rock physics crossplots to
18
+ visually inspect the relationships between bulk density, P-wave velocity,
19
+ and S-wave velocity. If Vp or Vs are not provided, they are estimated
20
+ using empirical relationships.
16
21
 
17
22
  Args:
18
- rhob (numpy.ndarray): Bulk density in g/cm³
19
- vp (numpy.ndarray): P-wave velocity in m/s
20
- vs (numpy.ndarray): S-wave velocity in m/s
23
+ rhob (np.ndarray): Bulk density in g/cm³.
24
+ vp (np.ndarray, optional): P-wave velocity in m/s. If None, it will be
25
+ estimated from `rhob`. Defaults to None.
26
+ vs (np.ndarray, optional): S-wave velocity in m/s. If None, it will be
27
+ estimated from `vp`. Defaults to None.
21
28
 
22
29
  Returns:
23
30
  matplotlib.figure.Figure: Figure containing the QC crossplots
@@ -84,7 +91,20 @@ def qaqc_xplots(rhob, vp=None, vs=None):
84
91
 
85
92
 
86
93
  def fluid_typing_xplots(rhob, vp=None, vs=None):
87
- """Create crossplots for fluid typing.
94
+ """Create crossplots commonly used for fluid typing and lithology discrimination.
95
+
96
+ This function generates a 1x3 grid of crossplots including Vp-Vs,
97
+ Lambda-Rho vs. Mu-Rho, and AI vs. Vp/Vs. These plots help in
98
+ identifying fluid effects in reservoir rocks. If Vp or Vs are not
99
+ provided, they are estimated.
100
+
101
+ Args:
102
+ rhob (np.ndarray): Bulk density in g/cm³.
103
+ vp (np.ndarray, optional): P-wave velocity in m/s. If None, it will be
104
+ estimated from `rhob`. Defaults to None.
105
+ vs (np.ndarray, optional): S-wave velocity in m/s. If None, it will be
106
+ estimated from `vp`. Defaults to None.
107
+
88
108
  """
89
109
  if vs is None and vp is not None:
90
110
  vs = estimate_shear_velocity(vp)
@@ -128,6 +148,21 @@ def fluid_typing_xplots(rhob, vp=None, vs=None):
128
148
 
129
149
 
130
150
  def QI_screening(gr, rhob, vp):
151
+ """Perform Quantitative Interpretation (QI) screening.
152
+
153
+ This function uses the `rockphypy` library to create a Vp vs. Porosity
154
+ screening plot, overlaying the input data on theoretical rock physics model
155
+ lines. It helps to assess where the data lies with respect to different
156
+ lithology and fluid scenarios.
157
+
158
+ Args:
159
+ gr (np.ndarray): Gamma Ray log in API units.
160
+ rhob (np.ndarray): Bulk density in g/cm³.
161
+ vp (np.ndarray): P-wave velocity in m/s.
162
+
163
+ Returns:
164
+ matplotlib.figure.Figure: Figure containing the QI screening plot.
165
+ """
131
166
 
132
167
  # compute the elastic bounds
133
168
  Dqz = Config.GEOMECHANICS_VALUE['RHOB_QUARTZ']
@@ -170,19 +205,29 @@ def QI_screening(gr, rhob, vp):
170
205
 
171
206
 
172
207
  def rpt_plot(rhob, vp=None, vs=None, model='soft_sand', fluid_type='gas', sigma=20, phi_c=0.4, Cn=8.6, f=0.0, scheme=2):
173
- """Plot the RPT plot.
208
+ """Generate a Rock Physics Template (RPT) plot.
209
+
210
+ This function overlays well log data (AI vs. Vp/Vs) on a theoretical
211
+ Rock Physics Template (RPT) generated using models from the `rockphypy`
212
+ library. The template shows lines of constant porosity and water saturation
213
+ for a given rock and fluid model.
214
+
174
215
  Args:
175
- rhob (float): Bulk density in g/cm³
176
- vp (float): P-wave velocity in m/s
177
- vs (float): S-wave velocity in m/s
216
+ rhob (np.ndarray): Bulk density in g/cm³.
217
+ vp (np.ndarray, optional): P-wave velocity in m/s. Defaults to None.
218
+ vs (np.ndarray, optional): S-wave velocity in m/s. Defaults to None.
178
219
  model (str): Model to use for the RPT plot. Defaults to 'soft_sand'.
179
220
  Options are 'soft_sand', 'stiff_sand', 'contact_cement', 'hertz_mindlin'.
180
- fluid_type (str): Fluid type. Defaults to 'gas'. Options are 'water', 'gas', 'oil'.
181
- sigma (float): Effective stress. Defaults to 20.
221
+ fluid_type (str): Fluid type for the model. Defaults to 'gas'.
222
+ Options are 'water', 'gas', 'oil'.
223
+ sigma (float): Effective stress in MPa. Defaults to 20.
182
224
  phi_c (float): Critical porosity. Defaults to 0.4.
183
225
  Cn (float): Coordination number. Defaults to 8.6.
184
- f (float): Reduced shear factor. Defaults to 0.0.
185
- scheme (int): Scheme of cement deposition. Defaults to 2.
226
+ f (float): Shear modulus correction factor for unconsolidated sands. Defaults to 0.0.
227
+ scheme (int): Cement deposition scheme for contact cement model. Defaults to 2.
228
+
229
+ Returns:
230
+ matplotlib.figure.Figure: Figure containing the RPT plot.
186
231
  """
187
232
  model_options = ['soft_sand', 'stiff_sand', 'contact_cement', 'hertz_mindlin']
188
233
  assert model in model_options, f"Model must be one of {model_options}"
@@ -249,11 +294,19 @@ def rpt_plot(rhob, vp=None, vs=None, model='soft_sand', fluid_type='gas', sigma=
249
294
 
250
295
 
251
296
  def elastic_bounds_plot(rhob, vp=None, vs=None, phi_calc=None):
252
- """Plot the elastic bounds.
297
+ """Plot elastic moduli data against theoretical elastic bounds.
298
+
299
+ This function plots calculated Bulk (K) and Shear (G) moduli against
300
+ various theoretical bounds (Voigt, Reuss, Hashin-Shtrikman) and the
301
+ critical porosity model. It helps to validate the elastic properties
302
+ of the rock.
303
+
253
304
  Args:
254
- rhob (float): Bulk density in g/cm³
255
- vp (float): P-wave velocity in m/s
256
- vs (float): S-wave velocity in m/s
305
+ rhob (np.ndarray): Bulk density in g/cm³.
306
+ vp (np.ndarray, optional): P-wave velocity in m/s. Defaults to None.
307
+ vs (np.ndarray, optional): S-wave velocity in m/s. Defaults to None.
308
+ phi_calc (np.ndarray, optional): Calculated porosity. If None, it will be
309
+ estimated from `rhob`. Defaults to None.
257
310
 
258
311
  Returns:
259
312
  matplotlib.figure.Figure: Figure containing the elastic bounds plot
@@ -114,7 +114,7 @@ def plot_fzi(cpore, cperm, cut_offs=None, rock_type=None, title='Flow Zone Indic
114
114
  plt.xlabel('Porosity (frac)')
115
115
  plt.xlim(-.05, .5)
116
116
  plt.ylabel('Permeability (mD)')
117
- plt.ylim(1e-3, 1e4)
117
+ plt.ylim(1e-3, 1e5)
118
118
  plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left")
119
119
 
120
120
  plt.yscale('log')
@@ -108,12 +108,12 @@ def zone_flagging(data: pd.DataFrame, min_zone_thickness: int = 150):
108
108
  df = data.copy()
109
109
  if 'ZONES' not in df.columns:
110
110
  df['ZONES'] = 'FORMATION'
111
- df['ZONES'].fillna('FORMATION', inplace=True)
111
+ df['ZONES'] = df['ZONES'].fillna('FORMATION')
112
112
 
113
113
  return_df = pd.DataFrame()
114
114
  if 'WELL_NAME' not in df.columns:
115
115
  df['WELL_NAME'] = 'WELL'
116
- df['WELL_NAME'].fillna('WELL', inplace=True)
116
+ df['WELL_NAME'] = df['WELL_NAME'].fillna('WELL')
117
117
  for _, well_data in df.groupby('WELL_NAME'):
118
118
  # Using VSHALE if available otherwise calculate VSH_GR
119
119
  if 'VSHALE' in well_data.columns:
quick_pp-0.2.51/PKG-INFO DELETED
@@ -1,119 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: quick-pp
3
- Version: 0.2.51
4
- Summary: Python package to assist in providing quick-look/ preliminary petrophysical estimation.
5
- Project-URL: Homepage, https://github.com/imranfadhil/quick_pp
6
- Author-email: Imran Fadhil <imranfadhil@gmail.com>
7
- License-Expression: MIT
8
- License-File: LICENSE
9
- Keywords: analysis,geoscience,log,petrophysics,quick_pp,well
10
- Classifier: Development Status :: 2 - Pre-Alpha
11
- Classifier: Intended Audience :: Developers
12
- Classifier: License :: OSI Approved :: MIT License
13
- Classifier: Natural Language :: English
14
- Classifier: Programming Language :: Python :: 3.11
15
- Requires-Python: >=3.11
16
- Requires-Dist: click>=7.0
17
- Requires-Dist: fastapi
18
- Requires-Dist: loguru
19
- Requires-Dist: matplotlib==3.8.0
20
- Requires-Dist: mlflow
21
- Requires-Dist: orjson
22
- Requires-Dist: pandas
23
- Requires-Dist: psycopg2-binary
24
- Requires-Dist: ptitprince
25
- Requires-Dist: python-multipart
26
- Requires-Dist: ruptures
27
- Requires-Dist: salib==1.5.1
28
- Requires-Dist: scikit-learn
29
- Requires-Dist: setuptools<81
30
- Requires-Dist: statsmodels
31
- Requires-Dist: welly
32
- Description-Content-Type: text/markdown
33
-
34
- # quick_pp
35
-
36
- Python package to assist in providing quick-look/ preliminary petrophysical estimation.
37
- ![quick_pp demo](docs/static/quick_pp_demo.gif)
38
-
39
- ## Quick Start (Jupyter Notebook Examples)
40
- 1. Create virtual environment (tested working with Python3.11)
41
-
42
- python -m venv venv
43
-
44
- 2. Activate virtual environment
45
-
46
- > venv\Scripts\activate (Windows)
47
-
48
- > source venv/bin/activate (Linux)
49
-
50
- 3. Install requirements
51
-
52
- pip install -r requirements.txt
53
-
54
- 4. Launch the notebook and run the cells
55
- - 01_data_handler: create the MOCK qppp project file.
56
- - 02_EDA: quick look on the data
57
- - 03_*: quick petropohysical interpretation of the MOCK wells.
58
- - For API notebook, need to run the following before running the cells
59
-
60
- python main.py app
61
-
62
- ## Install
63
- To install, use the following command:
64
-
65
- `pip install quick_pp`
66
-
67
- To use qpp_assistant, you would need to;
68
- 1. Run `git clone https://github.com/imranfadhil/quick_pp.git`
69
- 2. Run `pip install -r requirements.txt`
70
- 3. Specify the required credentials in .env (based on `.env copy` file)
71
- 4. Run `docker-compose up -d`
72
- 5. Go to Langflow at http://localhost:7860 and build your flow.
73
- 6. Run `python main.py app` and go to the qpp Assistant at http://localhost:8888/qpp_assistant to test your flow.
74
-
75
- ## CLI
76
-
77
- To train an ML model, these are the requirements;
78
-
79
- 1. The input file in parquet format need to be available; /data/input/<data_hash>___.parquet
80
-
81
- 2. The parquet file need to have the input and target features as specified in MODELLING_CONFIG in config.py.
82
-
83
- > quick_pp train <model_config> <data_hash>
84
-
85
- quick_pp train mock mock
86
-
87
- To run the MLflow server
88
-
89
- quick_pp mlflow-server
90
-
91
- You can access the mlflow server at http://localhost:5015
92
-
93
- To run prediction, the trained models need to be registered in MLflow first.
94
-
95
- > quick_pp predict <model_config> <data_hash>
96
-
97
- quick_pp predict mock mock
98
-
99
- To deploy the trained ML models
100
-
101
- quick_pp model-deployment
102
-
103
- You can access the deployed model Swagger UI at http://localhost:5555/docs
104
-
105
- To start the App
106
-
107
- quick_pp app
108
-
109
- You can then access the Swagger UI at http://localhost:8888/docs and qpp_assistant at http://localhost:8888/qpp_assistant.
110
- You can enter any user name and password to login the qpp_assistant.
111
-
112
- To use the mcp tools, you would need to first add the following SSE URLS through the interface;
113
- http://localhost:8888/mcp - quick_pp tools.
114
-
115
- http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
116
-
117
- ## Documentation
118
- Documentation is available at:
119
- <https://quick-pp.readthedocs.io/en/latest/index.html>
quick_pp-0.2.51/README.md DELETED
@@ -1,86 +0,0 @@
1
- # quick_pp
2
-
3
- Python package to assist in providing quick-look/ preliminary petrophysical estimation.
4
- ![quick_pp demo](docs/static/quick_pp_demo.gif)
5
-
6
- ## Quick Start (Jupyter Notebook Examples)
7
- 1. Create virtual environment (tested working with Python3.11)
8
-
9
- python -m venv venv
10
-
11
- 2. Activate virtual environment
12
-
13
- > venv\Scripts\activate (Windows)
14
-
15
- > source venv/bin/activate (Linux)
16
-
17
- 3. Install requirements
18
-
19
- pip install -r requirements.txt
20
-
21
- 4. Launch the notebook and run the cells
22
- - 01_data_handler: create the MOCK qppp project file.
23
- - 02_EDA: quick look on the data
24
- - 03_*: quick petropohysical interpretation of the MOCK wells.
25
- - For API notebook, need to run the following before running the cells
26
-
27
- python main.py app
28
-
29
- ## Install
30
- To install, use the following command:
31
-
32
- `pip install quick_pp`
33
-
34
- To use qpp_assistant, you would need to;
35
- 1. Run `git clone https://github.com/imranfadhil/quick_pp.git`
36
- 2. Run `pip install -r requirements.txt`
37
- 3. Specify the required credentials in .env (based on `.env copy` file)
38
- 4. Run `docker-compose up -d`
39
- 5. Go to Langflow at http://localhost:7860 and build your flow.
40
- 6. Run `python main.py app` and go to the qpp Assistant at http://localhost:8888/qpp_assistant to test your flow.
41
-
42
- ## CLI
43
-
44
- To train an ML model, these are the requirements;
45
-
46
- 1. The input file in parquet format need to be available; /data/input/<data_hash>___.parquet
47
-
48
- 2. The parquet file need to have the input and target features as specified in MODELLING_CONFIG in config.py.
49
-
50
- > quick_pp train <model_config> <data_hash>
51
-
52
- quick_pp train mock mock
53
-
54
- To run the MLflow server
55
-
56
- quick_pp mlflow-server
57
-
58
- You can access the mlflow server at http://localhost:5015
59
-
60
- To run prediction, the trained models need to be registered in MLflow first.
61
-
62
- > quick_pp predict <model_config> <data_hash>
63
-
64
- quick_pp predict mock mock
65
-
66
- To deploy the trained ML models
67
-
68
- quick_pp model-deployment
69
-
70
- You can access the deployed model Swagger UI at http://localhost:5555/docs
71
-
72
- To start the App
73
-
74
- quick_pp app
75
-
76
- You can then access the Swagger UI at http://localhost:8888/docs and qpp_assistant at http://localhost:8888/qpp_assistant.
77
- You can enter any user name and password to login the qpp_assistant.
78
-
79
- To use the mcp tools, you would need to first add the following SSE URLS through the interface;
80
- http://localhost:8888/mcp - quick_pp tools.
81
-
82
- http://localhost:5555/mcp - quick_pp ML model prediction tools (need to run `quick_pp model-deployment` first).
83
-
84
- ## Documentation
85
- Documentation is available at:
86
- <https://quick-pp.readthedocs.io/en/latest/index.html>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes