Skip to content

Commit 7b1b1a7

Browse files
committed
Merge branch 'SC-1126' into 'master'
SC-1126 Python SDK: Draw last point of ROP in TVT-ROP HeatMap script See merge request SOLO-band/python-sdk!50
2 parents 0f48ced + fefd258 commit 7b1b1a7

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
repos:
2-
- repo: https://gitlab.com/pycqa/flake8
2+
- repo: https://github.com/PyCQA/flake8
33
rev: 4.0.1
44
hooks:
55
- id: flake8

examples/tvt_rop_heatmap/tvt_rop_heatmap.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def get_heatmap_data(trajectory: List[Dict[str, float]],
132132
tvt_min: int,
133133
tvt_max: int,
134134
bins: int
135-
) -> Tuple[Any, Any, Any]:
135+
) -> Tuple[Any, Any, Any, float, float]:
136136
x, y = [], []
137137

138138
for i in range(filter_window, len(x_log) - 1 - filter_window):
@@ -166,7 +166,7 @@ def get_heatmap_data(trajectory: List[Dict[str, float]],
166166
for j in range(bins):
167167
histogram2d[i][j] = histogram2d[i][j] / max_val
168168

169-
return histogram2d, xedges2, yedges2
169+
return histogram2d, xedges2, yedges2, x[-1], y[-1]
170170

171171

172172
def get_horizon_scatters(xedges2: Any,
@@ -207,6 +207,20 @@ def get_horizon_scatters(xedges2: Any,
207207
return data
208208

209209

210+
def get_last_rop_point_scatter(last_x: float, last_y: float) -> go.Scatter:
211+
return go.Scatter(
212+
x=[last_x, ],
213+
y=[last_y, ],
214+
mode='markers',
215+
marker={
216+
'color': 'White',
217+
'size': 20,
218+
'line': {'width': 2, 'color': 'Red'},
219+
},
220+
showlegend=False
221+
)
222+
223+
210224
def refine_log_points(log_points: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
211225
return [point for point in log_points if point['data'] is not None]
212226

@@ -252,7 +266,7 @@ def build_tvt_rop_heatmap(script_settings: Dict[str, Any]):
252266

253267
# start plotting
254268
data = []
255-
histogram2d, xedges2, yedges2 = get_heatmap_data(
269+
histogram2d, xedges2, yedges2, last_x, last_y = get_heatmap_data(
256270
trajectory=trajectory,
257271
filter_window=filter_window,
258272
x_log=refine_log_points(x_log.to_dict()['points']),
@@ -270,6 +284,10 @@ def build_tvt_rop_heatmap(script_settings: Dict[str, Any]):
270284
zero_horizon_uuid=interpretation_data['meta']['properties']['zero_horizon_uuid']
271285
)
272286
data.extend(horizon_scatters)
287+
288+
last_rop_point_scatter = get_last_rop_point_scatter(last_x, last_y)
289+
data.append(last_rop_point_scatter)
290+
273291
layout = go.Layout(
274292
font={'size': 16},
275293
yaxis={

0 commit comments

Comments
 (0)