Skip to content

Commit c2aeb71

Browse files
committed
test
1 parent de21a19 commit c2aeb71

File tree

6 files changed

+110
-14
lines changed

6 files changed

+110
-14
lines changed

examples/1-import-data.ipynb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,19 @@
3434
},
3535
{
3636
"cell_type": "code",
37-
"execution_count": 3,
37+
"execution_count": 1,
3838
"metadata": {},
3939
"outputs": [
4040
{
41-
"data": {
42-
"text/plain": [
43-
"<lightguide.blast.Blast at 0x7fde7e1681c0>"
44-
]
45-
},
46-
"execution_count": 3,
47-
"metadata": {},
48-
"output_type": "execute_result"
41+
"ename": "ModuleNotFoundError",
42+
"evalue": "No module named 'lightguide.blast'",
43+
"output_type": "error",
44+
"traceback": [
45+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
46+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
47+
"Cell \u001b[0;32mIn[1], line 2\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mpathlib\u001b[39;00m \u001b[39mimport\u001b[39;00m Path\n\u001b[0;32m----> 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mlightguide\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mblast\u001b[39;00m \u001b[39mimport\u001b[39;00m Blast\n\u001b[1;32m 3\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mlightguide\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mutils\u001b[39;00m \u001b[39mimport\u001b[39;00m download_http\n\u001b[1;32m 5\u001b[0m file \u001b[39m=\u001b[39m Path(\u001b[39m\"\u001b[39m\u001b[39m/tmp/vsp-data.mseed\u001b[39m\u001b[39m\"\u001b[39m)\n",
48+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'lightguide.blast'"
49+
]
4950
}
5051
],
5152
"source": [
@@ -80,7 +81,7 @@
8081
"name": "python",
8182
"nbconvert_exporter": "python",
8283
"pygments_lexer": "ipython3",
83-
"version": "3.9.2"
84+
"version": "3.8.10"
8485
},
8586
"orig_nbformat": 4
8687
},

examples/2-data-processing.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
"name": "python",
133133
"nbconvert_exporter": "python",
134134
"pygments_lexer": "ipython3",
135-
"version": "3.9.2"
135+
"version": "3.8.10"
136136
},
137137
"orig_nbformat": 4,
138138
"vscode": {

examples/3-event-analysis.ipynb

Lines changed: 10 additions & 3 deletions
Large diffs are not rendered by default.

examples/my_test.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# %config InlineBackend.figure_format = 'jpg'
2+
import matplotlib.pyplot as plt
3+
from datetime import timedelta
4+
from lightguide.client import ExampleData
5+
from lightguide.blast import Blast
6+
7+
8+
# # This will download example data
9+
# blast = ExampleData.vsp_shot()
10+
11+
# # Pre-Processing
12+
# blast = blast.trim_channels(begin=120, end=550)
13+
# blast = blast.trim_time(begin=1.5, end=2.5)
14+
# blast.lowpass(70.0)
15+
# blast.afk_filter()
16+
17+
18+
# pick_time = blast.start_time + timedelta(seconds=0.573)
19+
20+
# pick_channel = 350
21+
22+
# # Follow the phase from initial pick
23+
# pick_channels, pick_times, pick_correlation = blast.follow_phase(
24+
# pick_time, pick_channel, window_size=10, max_shift=100, threshold=1e-2
25+
# )
26+
27+
# fig = plt.figure(figsize=(12, 6))
28+
# ax = fig.gca()
29+
30+
# blast.plot(axes=ax, cmap="binary", show_date=True)
31+
# ax.scatter(pick_channels, pick_times, s=4, c="fuchsia", alpha=0.6)
32+
33+
# # Plot initial pick
34+
# ax.scatter(pick_channel, pick_time, marker="x", c="limegreen")
35+
# plt.show()

examples/my_tests.ipynb

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 8,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"#from lightguide.utils import download_numpy, ExampleData\n",
10+
"# from lightguide.blast\n",
11+
"#from lightguide.blast import Blast\n",
12+
"#import lightguide.blast\n",
13+
"\n",
14+
"from collections import deque"
15+
]
16+
},
17+
{
18+
"cell_type": "code",
19+
"execution_count": null,
20+
"metadata": {},
21+
"outputs": [],
22+
"source": []
23+
}
24+
],
25+
"metadata": {
26+
"kernelspec": {
27+
"display_name": "Python 3",
28+
"language": "python",
29+
"name": "python3"
30+
},
31+
"language_info": {
32+
"codemirror_mode": {
33+
"name": "ipython",
34+
"version": 3
35+
},
36+
"file_extension": ".py",
37+
"mimetype": "text/x-python",
38+
"name": "python",
39+
"nbconvert_exporter": "python",
40+
"pygments_lexer": "ipython3",
41+
"version": "3.8.10"
42+
},
43+
"orig_nbformat": 4
44+
},
45+
"nbformat": 4,
46+
"nbformat_minor": 2
47+
}

lightguide/blast.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ def follow_phase(
330330
window_size: int | tuple[int, int] = 50,
331331
threshold: float = 5e-1,
332332
max_shift: int = 20,
333+
stack_traces: int = 1,
333334
) -> tuple[np.ndarray, list[datetime], np.ndarray]:
334335
"""Follow a phase pick through a Blast.
335336
@@ -375,6 +376,10 @@ def follow_phase(
375376
def prepare_template(data: np.ndarray) -> np.ndarray:
376377
return data * template_taper
377378

379+
# def stack_n_straces(data: np.ndarray,stack_traces) -> np.ndarray:
380+
381+
# return stacked_data
382+
378383
def correlate(data: np.ndarray, direction: Literal[1, -1] = 1) -> None:
379384
template = root_template.copy()
380385
index = root_idx
@@ -416,6 +421,7 @@ def correlate(data: np.ndarray, direction: Literal[1, -1] = 1) -> None:
416421

417422
pick_channels = np.array(pick_channels) + self.start_channel
418423
pick_correlations = np.array(pick_correlations)
424+
print("aa")
419425

420426
return pick_channels, pick_times, pick_correlations
421427

0 commit comments

Comments
 (0)