{"id":16742483,"url":"https://github.com/leonard-seydoux/arrayprocessing","last_synced_at":"2025-03-16T00:25:49.538Z","repository":{"id":128902136,"uuid":"117096890","full_name":"leonard-seydoux/arrayprocessing","owner":"leonard-seydoux","description":"Array processing","archived":false,"fork":false,"pushed_at":"2018-03-19T08:49:50.000Z","size":975,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T13:26:18.794Z","etag":null,"topics":["coherence","detection","eigenvalues","eigenvectors","pca-analysis","python3","seismology","signal-processing","spatial-data-analysis"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonard-seydoux.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-11T12:23:53.000Z","updated_at":"2023-12-26T00:39:29.000Z","dependencies_parsed_at":"2023-04-04T05:14:21.519Z","dependency_job_id":null,"html_url":"https://github.com/leonard-seydoux/arrayprocessing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonard-seydoux%2Farrayprocessing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonard-seydoux%2Farrayprocessing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonard-seydoux%2Farrayprocessing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonard-seydoux%2Farrayprocessing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonard-seydoux","download_url":"https://codeload.github.com/leonard-seydoux/arrayprocessing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809584,"owners_count":20351390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["coherence","detection","eigenvalues","eigenvectors","pca-analysis","python3","seismology","signal-processing","spatial-data-analysis"],"created_at":"2024-10-13T01:23:53.900Z","updated_at":"2025-03-16T00:25:49.508Z","avatar_url":"https://github.com/leonard-seydoux.png","language":"Python","readme":"# Array processing\n\nAnalaysing seismic data with array processing tools.\n\n## Get and pre-process seismic data\n\n### Read\n\nThe package provides a top-level function `read` (module: `data.py`) based on the Obspy's read function. It returns a object of class `stream` with all the useful tools provided by Obspy. It can read almost all file formats (`.sac`, `.mseed`, ...). \n\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\n```\n\n### Pre-processing methods\n\nIn addition to the original methods attached to Obspy's `stream` class, some new methods are defined. \n\n#### Trim the data without using `UTCDateTime` in the main code\n\nThis method simply allows not to import `obspy.UTCDateTime` in the main script in order to trim the data with the `trim` method. Additional kwargs to `starttime` and `endtime` are passed to the `trim` method of `obspy.core.stream.Stream` class.\n\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\nstream.cut(starttime='2017-01-01 01:34', endtime='2017-01-01 01:34')\n```\n\n#### Binarize the traces in the temporal domain\n\nDivides each trace by its envelope. In order not to divide by 0, a regularization kwarg `epsilon` is define by default to `1e-10`.\n\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\nstream.binarize()\n```\n\n#### Stationarize in the temporal domain\n\nDivides each trace by their smooth envelopes. The smoothing is calculated with the Savitzky-Golay algorithm. The `window` kwargs controls the length of smoothing window, and the `order` controls the order of the method. Defaults are `window=11, order=1`. As with the binarization methods, a default `epsilon` is defined to `1e-10`.\n\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\nstream.binarize()\n```\n#### Whiten each trace in the frequency domain\n\nDivides each trace spectrum with its amplitude. if the `method` kwarg is set to `onebit`, no smoothing is applied to the amplitude. Otherwise, the amplitude is smoothed with the Savitzky-Golay algorithm, with a window of length `smooth` and a order 1.\n\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\nstream.whiten(method='smooth, smooth=11)\n```\n\n### Show data\n\nYou can use the methods provided by obspy in order to show the data. Also, a `show` method is defined, currently under tests.\n\n## Calculate spectrograms\n\nThe spectrograms are calculated with the short-time Fourier transform function provided by Scipy (`scipy.stft`). This function is computationally efficient. The parameters are `segment_duration_sec` which defines the duration of the window in seconds onto which the spectra are calculated. The `bandwidth` kwarg is usedful to cut the spectra within a frequency band (in Hz), and therefore to reduce the memory usage.\n\nOther keyword arguments are passed to the `scipy.stft` function. Default are: \n- Sampling rate `fs` (obtained from the stream directly)\n- Number of dots per segments `nperseg` (obtained from the stream directly)\n- Overlapping between segments `noverlap`: by default 50%\n- Number of frequency points for calculating the Fourier transform `nfft` (by default next power of two of the segments length)\n- Window shape `window` (by default Hanning)\n- Calculate one side of the spectra `return_onesided` (by default `true` because signals are real, we do not need both parts because of hermitian symmetry)\n\nThe function returns three variables: the spectrograms (`shape = [n_traces, n_frequencies, n_times]`), the frequncies in Hz, and the times in absolute `matplotlib.dates format`.\n```\nimport arrayprocessing as ap\n\nstream = ap.read('/path/to/traces/*.sac')\n# some preprocessing\n\nspectrogram, frequencies, times = stream.stft(segment_duration_sec=16, bandwidth=[3, 10])\n```\n\n\n### Show speectrograms\n\nYou can show the spectrograms with the `spectrogram` method. Doc will come soon.\n\n![](https://github.com/leonard-seydoux/arrayprocessing/blob/master/arrayprocessing_mindmap_data.png)\n\n## Show speectrograms\n\nYou can show the spectrograms with the `spectrogram` method. Doc will come soon.\n\n\n\n![](https://github.com/leonard-seydoux/arrayprocessing/blob/master/arrayprocessing_mindmap_covariance.png)\n\n## correlation.py\n\n![](https://github.com/leonard-seydoux/arrayprocessing/blob/master/arrayprocessing_mindmap_correlation.png)\n\n## antenna.py\n\n## synthetic.py\n\n# To-do list\n\n- Create a `calculate_coherence()` method with a kwarg `shanon_index` or `spectral_width`\n- Enrich the `get_eigenvectors()` method with datetime selection and frequency range selection\n- Create `self.z` set to 0 when antenna is 2D, otherwise set to th values available in txt or csv file.\n- Add a warning message in synthetic.spherical if none of the `xyz` or `llz` kwargs is set. Clarify `spheri al` function.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonard-seydoux%2Farrayprocessing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonard-seydoux%2Farrayprocessing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonard-seydoux%2Farrayprocessing/lists"}