Package {qtsa}


Title: Quantum Time Series Analysis: Drift, Noise Spectroscopy and Calibration Forecasting
Version: 0.1.1
Author: Leila Marvian Mashhad [aut, cre]
Maintainer: Leila Marvian Mashhad <leila.marveian@gmail.com>
Description: Tools for exploratory statistical analysis of quantum-hardware calibration time series. The package provides simulators for random telegraph noise (RTN), power-law noise, and Ornstein-Uhlenbeck dephasing; Welch and sine-multitaper power spectral density estimators; a lightweight two-state hidden Markov model for switching signals; cumulative sum (CUSUM) and binary-segmentation diagnostics for calibration drift; residual-quantile interval forecasts; and filter-function calculations for illustrative coherence curves. The package includes a reproducible generator of simulated superconducting-qubit calibration records; it does not retrieve authenticated live provider data. Methodological background is provided by Welch (1967) <doi:10.1109/TAU.1967.1161901>, Thomson (1982) <doi:10.1109/PROC.1982.12433>, Rabiner (1989) <doi:10.1109/5.18626>, Page (1954) <doi:10.1093/biomet/41.1-2.100>, Paladino et al. (2014) <doi:10.1103/RevModPhys.86.361>, and Cywinski et al. (2008) <doi:10.1103/PhysRevB.77.174509>.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.2
Depends: R (≥ 4.1.0)
Imports: stats, graphics, utils
NeedsCompilation: no
Packaged: 2026-07-28 17:03:42 UTC; user
Repository: CRAN
Date/Publication: 2026-08-06 13:10:09 UTC

Compute an illustrative coherence value from a PSD

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

compute_Wt(psd, filter)

Arguments

psd

data frame with f and S columns

filter

output from filter_function_q

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list with chi, W, interpolated spectrum, filter values, and frequency.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Binary-segmentation drift diagnostic

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

cp_qdrift(x, pen = NULL, min_seg = 20)

Arguments

x

numeric time series

pen

penalty for adding a changepoint

min_seg

minimum segment length

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list with changepoints, segment means, and the number of segments.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

CUSUM drift diagnostic

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

cusum_q(x, target = NULL, k = NULL, h = NULL, sigma = NULL)

Arguments

x

numeric time series

target

in-control target mean; default uses early observations

k

reference value

h

decision interval

sigma

in-control standard deviation

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list containing CUSUM paths, parameter values, and alarm indices.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Compute an illustrative decoherence curve

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

decoherence_curve(psd, t_grid = seq(0.1, 10, length.out = 100), n_pulses = 1)

Arguments

psd

data frame with f and S columns

t_grid

times at which to evaluate coherence

n_pulses

number of idealized pi pulses

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A data frame with t, W, and chi.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Estimate a two-state switching model

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

estimate_rtn_hmm(x, n_states = 2, max_iter = 50, seed = NULL)

Arguments

x

numeric time series

n_states

number of states; the implementation is intended for two states

max_iter

maximum number of hard-EM refinement iterations

seed

optional random-number seed for k-means initialization; NULL leaves the current random-number stream unchanged

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list containing state means, standard deviations, transition matrix, decoded states, dwell summaries, and amplitude.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Generate simulated IBM-like calibration data

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

fetch_ibm_calib(n = 500, backend = "ibmq_manila_sim", seed = NULL, simulate = TRUE)

Arguments

n

number of time points

backend

label included in the output; no network request is made

seed

optional random-number seed; NULL leaves the current random-number stream unchanged

simulate

retained for backward compatibility; only simulated data are produced

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A data frame with time, backend, T1, T2, freq_GHz, and readout_err columns.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Compute a simple fidelity proxy

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

fidelity_ts(T1, T2, gate_time = 0.05)

Arguments

T1

numeric relaxation-time series

T2

numeric dephasing-time series

gate_time

gate duration in the same time units as T1 and T2

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A numeric vector of bounded fidelity-proxy values.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Construct a simple dynamical-decoupling filter function

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

filter_function_q(t, n_pulses = 1, f, dt = NULL)

Arguments

t

total evolution time

n_pulses

number of idealized pi pulses

f

numeric frequency vector

dt

reserved time-resolution argument

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list with frequency, angular frequency, filter values, time, and pulse count.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Alias for forecast_calib

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

forecast_T1(x, h = 20, window = 100, alpha = 0.1, method = "ets")

Arguments

x

numeric T1 series

h

forecast horizon

window

rolling window length

alpha

nominal miscoverage level

method

forecast method

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list returned by forecast_calib.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Rolling residual interval forecast

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

forecast_calib(x, h = 20, window = 100, alpha = 0.1, method = "ets")

Arguments

x

numeric time series

h

forecast horizon

window

length of the rolling training window

alpha

nominal miscoverage level used for the residual quantile

method

one of "mean", "ets", or "arima"; the current implementation uses lightweight baseline forecasts

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list with point forecast, lower and upper interval limits, residuals, and residual quantile.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Alias for estimate_rtn_hmm

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

hmm_rtn_fit(x, n_states = 2, max_iter = 50, seed = NULL)

Arguments

x

numeric time series

n_states

number of states

max_iter

maximum number of iterations

seed

optional random-number seed for k-means initialization; NULL leaves the current random-number stream unchanged

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list returned by estimate_rtn_hmm.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Plot calibration drift diagnostics

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

plot_drift(x, metric = "T1", ...)

Arguments

x

data frame returned by fetch_ibm_calib or a numeric series

metric

column to plot when x is a data frame

...

additional arguments reserved for future use

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

Invisibly, a list containing CUSUM and changepoint diagnostics.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Alias for psd_multitaper_q

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

psd_mtm_q(x, fs = 1, nw = 3, k = 5)

Arguments

x

numeric time series

fs

sampling frequency in Hz

nw

nominal time-bandwidth parameter

k

number of sine tapers

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A data frame with f, S, S_low, and S_high.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Sine-multitaper power spectral density estimator

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

psd_multitaper_q(x, fs = 1, nw = 3, k = 5)

Arguments

x

numeric time series

fs

sampling frequency in Hz

nw

nominal time-bandwidth parameter used to choose a conventional taper count

k

number of sine tapers

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A data frame with f, S, S_low, and S_high.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Welch power spectral density estimator

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

psd_welch(x, fs = 1, nperseg = 256, noverlap = NULL, window = "hann")

Arguments

x

numeric time series

fs

sampling frequency in Hz

nperseg

segment length

noverlap

number of overlapping observations

window

window type; currently "hann" is supported

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A data frame with frequency f and one-sided spectral density S.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Power-law noise simulator

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

r_oneoverf(n, alpha = 1, fs = 1, f_low = NULL)

Arguments

n

positive number of samples

alpha

power-law exponent

fs

sampling frequency in Hz

f_low

optional low-frequency cutoff

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A list with time vector, simulated signal, sampling frequency, and exponent.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Ornstein-Uhlenbeck dephasing simulator

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

r_ou_dephasing(n, tau_c = 10, sigma = 1, dt = 1)

Arguments

n

positive number of samples

tau_c

correlation time

sigma

stationary standard deviation

dt

time increment

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A numeric vector containing a simulated process.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

Random Telegraph Noise simulator

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

r_rtn(n, fs = 1, amplitude = 1, tau_up = 50, tau_down = 50, p0 = 0.5)

Arguments

n

positive number of samples

fs

sampling frequency in Hz

amplitude

difference between the two signal levels

tau_up

mean dwell time in the upper state, in samples

tau_down

mean dwell time in the lower state, in samples

p0

probability of starting in the upper state

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

A numeric vector containing the simulated RTN signal.

Author(s)

Leila Marvian Mashhad

Examples

set.seed(1)
x <- r_rtn(100)
head(x)

Viterbi decoder for a switching model

Description

Part of the qtsa toolkit for exploratory analysis of quantum-hardware calibration time series.

Usage

viterbi_rtn(log_emission, log_trans)

Arguments

log_emission

matrix of log emission probabilities with observations in rows

log_trans

matrix of log transition probabilities

Details

This function is intended for exploratory analysis. Interpret physically meaningful results only after checking sampling frequency, units, and model assumptions.

Value

An integer vector giving the most likely state path.

Author(s)

Leila Marvian Mashhad

Examples

x <- rnorm(100)
# See the package vignette or help pages for a complete workflow.

mirror server hosted at Truenetwork, Russian Federation.