hvseispy


Namehvseispy JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryA Python package for Horizontal-to-Vertical Spectral Ratio (HVSR) analysis of seismic data.
upload_time2025-02-19 00:26:38
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT
keywords seismic hvsr signal-processing geophysics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # HVSeisPy - Horizontal-to-Vertical Spectral Ratio (HVSR) Analysis Tool

## Overview

HVSeisPy is a Python package designed for performing Horizontal-to-Vertical Spectral Ratio (HVSR) analysis on seismic data. The package provides tools for reading seismic data, processing it, and calculating the HVSR, which is commonly used in seismology for site characterization and estimating the fundamental frequency of soil layers.

The package includes functionalities for:
- Reading seismic data from various file formats (e.g., SAC, MSEED, ASCII).
- Windowing and tapering seismic signals.
- Computing Fourier spectra and smoothing them using the Konno-Ohmachi algorithm.
- Calculating the HVSR and visualizing the results.

## Installation

Install HVSeisPy using `pip`:

```bash
pip install hvseispy
```

To install HVSeisPy, ensure you have Python 3.7 or later installed. You can install the required dependencies using `pip`:

```bash
pip install numpy scipy obspy matplotlib pykooh
```

Alternatively, clone the repository or download the scripts to your local machine:

```bash
git clone https://github.com/JOchoa51/HVSeisPy.git
cd HVSeisPy
```

## Usage

### Reading Seismic Data

HVSeisPy supports reading seismic data from SAC, MSEED, and ASCII files. Use the `read_sac`, `read_mseed`, or `read_file` functions from the `IO` module to load your data.

```python
from hvseispy.IO import read_sac, read_mseed, read_file

# Example: Reading SAC files
north, vertical, east = read_sac(['path_to_sac_file1', 'path_to_sac_file2'])

# Example: Reading MSEED files
north, vertical, east = read_mseed('path_to_mseed_file')

# Example: Reading ASCII files
north, vertical, east = read_file('path_to_ascii_file', skiprows=0)
```

### Processing Seismic Data

The `seismic` module provides functions for processing seismic data, including windowing, tapering, and calculating the HVSR.

```python
from hvseispy.seismic import hvsr

# Example: Calculating HVSR
hv_mean, hv, freq = hvsr(
    acc_data=[north, vertical, east],  # Input data as a list of numpy arrays
    dt=0.01,  # Sampling period in seconds
    win_len=20.0,  # Window length in seconds
    taper=('cosine', 0.05),  # Taper type and amount
    smooth_bandwidth=40.0,  # Smoothing bandwidth for Konno-Ohmachi smoothing
    overlap=0.5,  # Overlap between windows (0 to 1)
    fftmin=0.1,  # Minimum frequency for FFT
    fftmax=50.0,  # Maximum frequency for FFT
    hvmin=0.1,  # Minimum frequency for HVSR
    hvmax=10.0  # Maximum frequency for HVSR
)
```

### Plotting Results

The `plot_tools` module provides functions for visualizing seismic signals, FFT spectra, and HVSR results.

```python
from hvseispy.plot_tools import plot_signal, plot_fft, plot_hv

# Example: Plotting the seismic signal
fig = plot_signal(north, vertical, east, dt=0.01, name='Station_Name')

# Example: Plotting the FFT spectrum
fig = plot_fft([north, vertical, east], freq, name='Station_Name', fmin=0.1, fmax=50.0)

# Example: Plotting the HVSR
fig = plot_hv(hv_mean, hv, freq, fmin=0.1, fmax=10.0, name='Station_Name', plot_windows=True)
```

## Modules

### `IO.py`

This module contains functions for reading seismic data from different file formats:
- `read_sac`: Reads SAC files.
- `read_mseed`: Reads MSEED files.
- `read_file`: Reads ASCII files.
- `read_cires`: Reads specific CIRES format files (this is for a very specific file format, use `read_file` instead).

### `specsignal.py`

This module contains signal processing functions:
- `taper`: Applies a taper to the signal.
- `window`: Splits the signal into windows.
- `spectrum`: Computes the Fourier spectrum of the signal.
- `konnoohmachi_smoothing`: Smooths the spectrum using the Konno-Ohmachi algorithm.
- `konnoohmachi_smoothing_opt`: Optimized version of the Konno-Ohmachi smoothing function.

### `seismic.py`

This module contains the main functions for HVSR analysis:
- `hv_ratio`: Calculates the HVSR.
- `_process_hvsr`: Processes the seismic data and computes the HVSR.
- `hvsr`: High-level function for calculating HVSR from seismic data.

### `plot_tools.py`

This module contains functions for plotting seismic data and results:
- `plot_signal`: Plots the seismic signal.
- `plot_windows`: Plots the seismic signal with analysis windows.
- `plot_fft`: Plots the FFT spectrum.
- `plot_hv`: Plots the HVSR.

### `misc.py`

This module contains utility functions:
- `save_results`: Saves the HVSR and FFT results to a text file.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes.

## License

This project is licensed under the MIT License. See the [LICENSE](https://mit-license.org/) file for details.

## Acknowledgments

- The Konno-Ohmachi smoothing algorithm is implemented using the `pykooh` library.
- The ObsPy library is used for reading seismic data formats.

## Contact

For any questions or feedback, please contact the maintainer at [ochoacontrerasjesus8@gmail.com].

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "hvseispy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "seismic, HVSR, signal-processing, geophysics",
    "author": null,
    "author_email": "Jes\u00fas Ochoa <ochoacontrerasjesus8@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/0e/79/cf93c0f58dcb6e607ad7fab23ad85abafc0b837e7bc6801346ad01d42dcf/hvseispy-1.0.2.tar.gz",
    "platform": null,
    "description": "# HVSeisPy - Horizontal-to-Vertical Spectral Ratio (HVSR) Analysis Tool\n\n## Overview\n\nHVSeisPy is a Python package designed for performing Horizontal-to-Vertical Spectral Ratio (HVSR) analysis on seismic data. The package provides tools for reading seismic data, processing it, and calculating the HVSR, which is commonly used in seismology for site characterization and estimating the fundamental frequency of soil layers.\n\nThe package includes functionalities for:\n- Reading seismic data from various file formats (e.g., SAC, MSEED, ASCII).\n- Windowing and tapering seismic signals.\n- Computing Fourier spectra and smoothing them using the Konno-Ohmachi algorithm.\n- Calculating the HVSR and visualizing the results.\n\n## Installation\n\nInstall HVSeisPy using `pip`:\n\n```bash\npip install hvseispy\n```\n\nTo install HVSeisPy, ensure you have Python 3.7 or later installed. You can install the required dependencies using `pip`:\n\n```bash\npip install numpy scipy obspy matplotlib pykooh\n```\n\nAlternatively, clone the repository or download the scripts to your local machine:\n\n```bash\ngit clone https://github.com/JOchoa51/HVSeisPy.git\ncd HVSeisPy\n```\n\n## Usage\n\n### Reading Seismic Data\n\nHVSeisPy supports reading seismic data from SAC, MSEED, and ASCII files. Use the `read_sac`, `read_mseed`, or `read_file` functions from the `IO` module to load your data.\n\n```python\nfrom hvseispy.IO import read_sac, read_mseed, read_file\n\n# Example: Reading SAC files\nnorth, vertical, east = read_sac(['path_to_sac_file1', 'path_to_sac_file2'])\n\n# Example: Reading MSEED files\nnorth, vertical, east = read_mseed('path_to_mseed_file')\n\n# Example: Reading ASCII files\nnorth, vertical, east = read_file('path_to_ascii_file', skiprows=0)\n```\n\n### Processing Seismic Data\n\nThe `seismic` module provides functions for processing seismic data, including windowing, tapering, and calculating the HVSR.\n\n```python\nfrom hvseispy.seismic import hvsr\n\n# Example: Calculating HVSR\nhv_mean, hv, freq = hvsr(\n    acc_data=[north, vertical, east],  # Input data as a list of numpy arrays\n    dt=0.01,  # Sampling period in seconds\n    win_len=20.0,  # Window length in seconds\n    taper=('cosine', 0.05),  # Taper type and amount\n    smooth_bandwidth=40.0,  # Smoothing bandwidth for Konno-Ohmachi smoothing\n    overlap=0.5,  # Overlap between windows (0 to 1)\n    fftmin=0.1,  # Minimum frequency for FFT\n    fftmax=50.0,  # Maximum frequency for FFT\n    hvmin=0.1,  # Minimum frequency for HVSR\n    hvmax=10.0  # Maximum frequency for HVSR\n)\n```\n\n### Plotting Results\n\nThe `plot_tools` module provides functions for visualizing seismic signals, FFT spectra, and HVSR results.\n\n```python\nfrom hvseispy.plot_tools import plot_signal, plot_fft, plot_hv\n\n# Example: Plotting the seismic signal\nfig = plot_signal(north, vertical, east, dt=0.01, name='Station_Name')\n\n# Example: Plotting the FFT spectrum\nfig = plot_fft([north, vertical, east], freq, name='Station_Name', fmin=0.1, fmax=50.0)\n\n# Example: Plotting the HVSR\nfig = plot_hv(hv_mean, hv, freq, fmin=0.1, fmax=10.0, name='Station_Name', plot_windows=True)\n```\n\n## Modules\n\n### `IO.py`\n\nThis module contains functions for reading seismic data from different file formats:\n- `read_sac`: Reads SAC files.\n- `read_mseed`: Reads MSEED files.\n- `read_file`: Reads ASCII files.\n- `read_cires`: Reads specific CIRES format files (this is for a very specific file format, use `read_file` instead).\n\n### `specsignal.py`\n\nThis module contains signal processing functions:\n- `taper`: Applies a taper to the signal.\n- `window`: Splits the signal into windows.\n- `spectrum`: Computes the Fourier spectrum of the signal.\n- `konnoohmachi_smoothing`: Smooths the spectrum using the Konno-Ohmachi algorithm.\n- `konnoohmachi_smoothing_opt`: Optimized version of the Konno-Ohmachi smoothing function.\n\n### `seismic.py`\n\nThis module contains the main functions for HVSR analysis:\n- `hv_ratio`: Calculates the HVSR.\n- `_process_hvsr`: Processes the seismic data and computes the HVSR.\n- `hvsr`: High-level function for calculating HVSR from seismic data.\n\n### `plot_tools.py`\n\nThis module contains functions for plotting seismic data and results:\n- `plot_signal`: Plots the seismic signal.\n- `plot_windows`: Plots the seismic signal with analysis windows.\n- `plot_fft`: Plots the FFT spectrum.\n- `plot_hv`: Plots the HVSR.\n\n### `misc.py`\n\nThis module contains utility functions:\n- `save_results`: Saves the HVSR and FFT results to a text file.\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](https://mit-license.org/) file for details.\n\n## Acknowledgments\n\n- The Konno-Ohmachi smoothing algorithm is implemented using the `pykooh` library.\n- The ObsPy library is used for reading seismic data formats.\n\n## Contact\n\nFor any questions or feedback, please contact the maintainer at [ochoacontrerasjesus8@gmail.com].\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python package for Horizontal-to-Vertical Spectral Ratio (HVSR) analysis of seismic data.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://github.com/JOchoa51/HVSeisPy",
        "Repository": "https://github.com/JOchoa51/HVSeisPy"
    },
    "split_keywords": [
        "seismic",
        " hvsr",
        " signal-processing",
        " geophysics"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7c67669cc5b9aa287ba89e44b8549097c5d69eca5bf8018956044e3d6edd568f",
                "md5": "25da1e95018845331839f7d03fdc5c91",
                "sha256": "f990a347ba5bf8572a173811937654e3fcb483f0763b8ce6fa5958096ad315ef"
            },
            "downloads": -1,
            "filename": "hvseispy-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "25da1e95018845331839f7d03fdc5c91",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 19300,
            "upload_time": "2025-02-19T00:26:36",
            "upload_time_iso_8601": "2025-02-19T00:26:36.112601Z",
            "url": "https://files.pythonhosted.org/packages/7c/67/669cc5b9aa287ba89e44b8549097c5d69eca5bf8018956044e3d6edd568f/hvseispy-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0e79cf93c0f58dcb6e607ad7fab23ad85abafc0b837e7bc6801346ad01d42dcf",
                "md5": "43fe8e9ed43ca678bdfc29b8cefdde5e",
                "sha256": "bf603c82d6dfd4812bd2fdfd258e28c069caef79f0fe1df7673c368488f8f3dd"
            },
            "downloads": -1,
            "filename": "hvseispy-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "43fe8e9ed43ca678bdfc29b8cefdde5e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 18631,
            "upload_time": "2025-02-19T00:26:38",
            "upload_time_iso_8601": "2025-02-19T00:26:38.347558Z",
            "url": "https://files.pythonhosted.org/packages/0e/79/cf93c0f58dcb6e607ad7fab23ad85abafc0b837e7bc6801346ad01d42dcf/hvseispy-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-19 00:26:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "JOchoa51",
    "github_project": "HVSeisPy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "hvseispy"
}
        
Elapsed time: 0.43707s