Skip to main content

AcyclePy: Advanced cyclostratigraphy toolkit

Project description

AcyclePy — Advanced Cyclostratigraphy and Time Series Analysis Toolkit

PyPI Python License

AcyclePy is the Python library companion to the Acycle desktop application for cyclostratigraphy, time series analysis, and paleoclimate research. It provides both a programmatic API for scripting and batch processing, and the full suite of Acycle desktop GUI tools.

Reference: Li, M., Hinnov, L., & Kump, L. (2019). Acycle: Time-series analysis software for paleoclimate research and education. Computers & Geosciences, 127, 12-22.


Installation

ash pip install acycle

Requirements: Python >= 3.8, numpy, scipy, pandas, matplotlib, PySide6, scikit-image, scikit-learn, Pillow, qt-material, astropy.


Quick Start — Programmatic API

`python import acycle as ac import numpy as np

Read time series data

s = ac.read_series("data.txt") # auto-detect whitespace/tab/comma s = ac.read_series("data.csv", delimiter=",") # explicit delimiter

Chain operations (fluent API)

s2 = s.clean(sort=True)
.interpolate(step=0.33)
.detrend(window=80)
.standardize()

Spectral analysis

from acycle import spectral freq, power = spectral._periodogram(s2.y) freq, power = spectral._mtm_spectrum(s2.y) # multitaper freq, power = spectral._lomb_scargle_spectrum(s2.x, s2.y) # uneven spacing

Wavelet analysis

from acycle import wavelet period, power, coi, significance = wavelet.cwt(s2.y, dt=s2.dt) coherence = wavelet.wavelet_coherence(s1.y, s2.y, dt=s1.dt)

Filtering

from acycle import filter as ft result = ft.apply_filter(y, dt=0.2, kind="bandpass", flow=0.01, fhigh=0.05)

Age modeling

from acycle import age model = age.build_age_model(depth, y, cycle_period=405) depth, age = age.tune(depth, y, model)

Load built-in datasets

lr04 = ac.load_example("lr04") # LR04 benthic stack cenogrid = ac.load_example("cenogrid_d18o") # CENOGRID d18O `

Result Objects

All analysis functions return structured result objects with a consistent interface:

`python psd = PSD(frequency=freq, power=power) psd.to_dataframe() # export to pandas DataFrame psd.save("my_spectrum") # save to CSV (my_spectrum_spectrum.csv) psd.plot() # matplotlib figure

Same interface for all result types:

EvolutiveSpectrum, WaveletResult, FilterResult, AgeModel, CocoResult, SedNoiseResult

`


CLI Tools (Acycle Desktop GUI)

These commands launch the original Acycle desktop GUI tools bundled with the package:

ash acycle-imageprocessor # Image digitizing and data extraction acycle-plot # PlotPro — publication-quality plotting acycle-interpolation # Advanced interpolation with gap filling acycle-data-extractor # Extract data segments by range acycle-section-remover # Remove sections from time series acycle-gap-adder # Insert gaps into data acycle-data-clipper # Clip data by threshold acycle-image-analyzer # Advanced image analysis


API Reference

Series Operations

Method Description
Series.from_file(path) Read from a delimited text file
.clean(sort, duplicate, dropna) Sort, deduplicate, drop NaN
.interpolate(step, method) Interpolate to uniform grid
.interpolate_pro(step, method) Advanced interpolation with gap filling
.detrend(window, method) Remove trend (lowess, loess, polynomial, savgol, moving_mean)
.standardize() Z-score standardization
.log10(handle_nonpositive) Base-10 logarithm
.derivative(order) Numerical derivative
.prewhiten(method) Prewhitening
.select(start, stop) Sub-range selection
.moving_average(n) Moving average smoothing
.gaussian_smooth(n, sigma) Gaussian smoothing
.moving_median(n) Moving median smoothing
.multiply(other_series) Element-wise multiply with another series
.clip_by_threshold(threshold) Clip or remove data by threshold
.to_dataframe() Export to pandas DataFrame
.copy() Deep copy

Spectral Analysis (cycle.spectral)

Function Description
_periodogram(y, dt) Classical periodogram
_mtm_spectrum(y, dt, nw) Multitaper method
_lomb_scargle_spectrum(x, y) Lomb-Scargle (uneven spacing)
_estimate_ar1_rho(y) AR(1) lag-1 autocorrelation
_estimate_ar1_noise(y, dt) AR(1) noise background
_ftest_mtm(y, dt, nw) F-test for significant peaks

Wavelet Analysis (cycle.wavelet)

Function Description
cwt(y, dt) Continuous wavelet transform (Torrence & Compo 1998)
wavelet_coherence(y1, y2, dt) Wavelet coherence and phase

Filtering (cycle.filter)

Function Description
pply_filter(y, dt, kind) Bandpass/lowpass/highpass (gaussian, butterworth, etc.)
dynamic_filter(x, y, window) Sliding-window dynamic filtering
mplitude_modulation(x, y, flow, fhigh) Envelope extraction

Age Modeling (cycle.age)

Function Description
uild_age_model(x, y, cycle_period) Age model from cycle counting
sedrate_to_age_model(depth, sedrate) Convert sedimentation rate to age model
une(depth, y, age_model) Depth-to-time conversion
stratigraphic_correlation(ref, target, tie_points) Correlate two stratigraphic sections

Preprocessing (cycle.preprocess)

Function Description
detrend(x, y, window, method) Remove trend
clip_by_threshold(x, y, threshold) Clip by value

| emove_sections(x, y, sections) | Remove data ranges | | dd_gaps(x, y, gaps) | Insert NaN-filled gaps | | emove_peaks(y, ymin, ymax) | Remove or cap peaks | | multiply_series(x, y1, y2) | Element-wise multiply two series | | merge_series(series_list) | Merge multiple series by x grid | | pca(data, n_components) | Principal component analysis | | changepoint(y, method) | Changepoint detection | | ransform_xy(x, y, a, b, c, d) | Affine coordinate transform | | ind_extreme(x, y, kind) | Find max or min in range |


Author

Meng Wanggrampus90@gmail.com

Citation

If you use AcyclePy in your research, please cite:

Li, M., Hinnov, L., & Kump, L. (2019). Acycle: Time-series analysis software for paleoclimate research and education. Computers & Geosciences, 127, 12–22. https://doi.org/10.1016/j.cageo.2019.02.011

License

MIT License — see LICENSE file for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

acycle-0.6.5.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

acycle-0.6.5-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file acycle-0.6.5.tar.gz.

File metadata

  • Download URL: acycle-0.6.5.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for acycle-0.6.5.tar.gz
Algorithm Hash digest
SHA256 bec8203b3e41b1c08d18ed90def4fdae1e907e3f45ccaec303f5092512cf2491
MD5 8b7bb35e7750a75015c903ea66ebe6d4
BLAKE2b-256 adbb95045c28369d52b6e2c7b83706f2667be41c11a47fc8eb116cb83af61d26

See more details on using hashes here.

File details

Details for the file acycle-0.6.5-py3-none-any.whl.

File metadata

  • Download URL: acycle-0.6.5-py3-none-any.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for acycle-0.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f987d8e002d8606afe43a05dcbe5cc7242d0cade14f16925d8be9d9fe1fa4868
MD5 691d96e7ae6ea6c93dbcd47d51aec19e
BLAKE2b-256 e25de7c8e6a7308c18eb8d96ee8b1bb73d40e155873e745c89cd92ea99ddddad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page