Browse Source

renaming package

master
Marius Isken 1 month ago
parent
commit
e6c3b8c733
  1. 22
      Cargo.lock
  2. 4
      Cargo.toml
  3. 0
      lightguide/__init__.py
  4. 0
      lightguide/data/das-data.npy
  5. 0
      lightguide/data/data-DAS-gfz2020wswf.npy
  6. 0
      lightguide/filter.py
  7. 0
      lightguide/gf.py
  8. 24
      lightguide/goldstein.py
  9. 0
      lightguide/io/__init__.py
  10. 0
      lightguide/restitution.py
  11. 0
      lightguide/utils.py
  12. 8
      setup.py
  13. 2
      tests/test_gf.py
  14. 6
      tests/test_goldstein.py
  15. 2
      tests/test_restitution.py

22
Cargo.lock

@ -283,6 +283,17 @@ version = "0.2.105"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "869d572136620d55835903746bcb5cdc54cb2851fd0aeec53220b4bb65ef3013"
[[package]]
name = "lightguide"
version = "0.1.0"
dependencies = [
"fftw",
"ndarray 0.15.3",
"numpy",
"pyo3",
"rayon",
]
[[package]]
name = "lock_api"
version = "0.4.5"
@ -566,17 +577,6 @@ dependencies = [
"syn",
]
[[package]]
name = "pyrocko-das"
version = "0.1.0"
dependencies = [
"fftw",
"ndarray 0.15.3",
"numpy",
"pyo3",
"rayon",
]
[[package]]
name = "quote"
version = "1.0.10"

4
Cargo.toml

@ -1,12 +1,12 @@
[package]
name = "pyrocko-das"
name = "lightguide"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[lib]
name = "pyrocko_das"
name = "lightguide"
crate-type = ["cdylib"]
[dependencies]

0
pyrocko_das/__init__.py → lightguide/__init__.py

0
pyrocko_das/data/das-data.npy → lightguide/data/das-data.npy

0
pyrocko_das/data/data-DAS-gfz2020wswf.npy → lightguide/data/data-DAS-gfz2020wswf.npy

0
pyrocko_das/filter.py → lightguide/filter.py

0
pyrocko_das/gf.py → lightguide/gf.py

24
pyrocko_das/goldstein.py → lightguide/goldstein.py

@ -13,7 +13,6 @@ from scipy.signal import butter, lfilter
from .utils import timeit
data = num.load(op.join(op.dirname(__file__), "data", "data-DAS-gfz2020wswf.npy"))
data = num.load("/home/marius/Downloads/sample_data.npy").astype(num.float32)
def butter_bandpass_filter(data, lowcut, highcut, fs, order=4):
@ -96,7 +95,7 @@ def normalize_diff(data, filtered_data):
return Normalize()(data) - Normalize()(filtered_data)
def plot_goldstein():
def plot_goldstein(data):
def r(data):
v = num.std(data)
return -v, v
@ -111,15 +110,13 @@ def plot_goldstein():
imshow_kwargs = dict(aspect=5, cmap="viridis", vmin=-1.0, vmax=1.0)
data_bp = butter_bandpass_filter(data, 1.0, 10.0, 50.0).astype(num.float32)
fig, (ax1, ax3, ax4) = plt.subplots(1, 3, sharex=True, sharey=True)
ax1.imshow(data, **imshow_kwargs)
# image_python = ax2.imshow(data, **imshow_kwargs)
image_rust = ax3.imshow(data, **imshow_kwargs)
image_diff = ax4.imshow(data, **imshow_kwargs)
ax_slider = plt.axes((0.25, 0.1, 0.65, 0.03))
ax_slider = plt.axes((0.25, 0.05, 0.65, 0.03))
ax1.set_title("Data Input")
# ax2.set_title("Data Filtered (Python)")
@ -151,11 +148,12 @@ def plot_goldstein():
# image_python.set_norm(Normalize(*r(data_filtered)))
image_rust.set_data(data_filtered)
image_rust.set_norm(Normalize(*r(data_filtered)))
image_rust.set_norm(None)
norm_diff = normalize_diff(data, data_filtered)
image_diff.set_data(norm_diff)
image_diff.set_norm(Normalize(*r(norm_diff)))
image_diff.set_norm(None)
fig.canvas.draw_idle()
update(exponent)
@ -171,5 +169,13 @@ def plot_taper():
if __name__ == "__main__":
# print(goldstein_rust())
plot_goldstein()
import argparse
import pathlib
parser = argparse.ArgumentParser()
parser.add_argument("npy_file", type=pathlib.Path)
args = parser.parse_args()
data = num.load(args.npy_file).astype(num.float32)
plot_goldstein(data)

0
pyrocko_das/io/__init__.py → lightguide/io/__init__.py

0
pyrocko_das/restitution.py → lightguide/restitution.py

0
pyrocko_das/utils.py → lightguide/utils.py

8
setup.py

@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="pyrocko_das",
name="lightguide",
version="0.0.1",
author="Marius Paul Isken",
author_email="mi@gfz-potsdam.de",
@ -24,13 +24,13 @@ setuptools.setup(
],
rust_extensions=[
RustExtension(
"pyrocko_das.rust",
"lightguide.rust",
path="Cargo.toml",
binding=Binding.PyO3,
debug=False,
)
],
package_data={"pyrocko_das": ["data/*.npy"]},
packages=["pyrocko_das"],
package_data={"lightguide": ["data/*.npy"]},
packages=["lightguide"],
python_requires=">=3.6",
)

2
tests/test_gf.py

@ -4,7 +4,7 @@ import numpy as num
from copy import deepcopy
from pyrocko_das import gf
from lightguide import gf
from pyrocko.model import Location
from pyrocko import trace

6
tests/test_goldstein.py

@ -2,14 +2,14 @@ import os.path as op
import numpy as num
import pytest
from pyrocko_das import goldstein, rust
from lightguide import goldstein, rust
@pytest.fixture
def data():
import pyrocko_das
import lightguide
das_dir = pyrocko_das.__file__
das_dir = lightguide.__file__
return num.load(op.join(op.dirname(das_dir), "data", "data-DAS-gfz2020wswf.npy"))

2
tests/test_restitution.py

@ -1,5 +1,5 @@
import numpy as num
from pyrocko_das import restitution as res
from lightguide import restitution as res
from pyrocko import trace

Loading…
Cancel
Save