(quasiperiodic_squaredexponential_kernel)=

# Quasi-periodic plus squared-exponential kernel

```{warning}
This page is a stub generated by Codex. The content has been verified, but important information (references, links to external packages) may be missing  
```

The quasi-periodic plus squared-exponential kernel combines the usual stellar-rotation term with an additional long-timescale squared-exponential component. It is intended for activity signals where the rotationally modulated covariance and a slower cycle-like covariance should be fitted together.

```{math}
\gamma(t_i,t_j) =
H_\mathrm{amp}^2 G_\mathrm{QP}(t_i,t_j) +
C_\mathrm{amp}^2 G_\mathrm{SE}(t_i,t_j; P_\mathrm{cyc})
```

where `G_QP` is the quasi-periodic kernel and `G_SE` is a squared-exponential kernel with scale `Pcyc`.

## Model definition and requirements

**model name**: `tinygp_quasiperiodicsquaredexponential`
- required common object: `activity`
- implemented with `tinygp`
- read [Caveats on the use of `tinyGP`](../running_pyorbit/tinygp_caveats) carefully

**model alias**
- `tinygp_quasiperiodic_squaredexponential`

## Keywords

Model-wide keywords, with the default value in boldface.

**hyperparameters_condition**
* accepted values: `True` | **`False`**
* activates the quasi-periodic hyperparameter condition described in the [quasi-periodic kernel](quasiperiodic_kernel).

**rotation_decay_condition**
* accepted values: `True` | **`False`**
* if activated, requires `Pdec > 2 Prot`.

**halfrotation_decay_condition**
* accepted values: `True` | **`False`**
* if activated, requires `Pdec > 0.5 Prot`.

**decay_rotation_factor** or **rotation_decay_factor**
* accepted values: float | **not used**
* if provided, requires `Pdec` to be larger than the specified factor times `Prot`.

**use_stellar_rotation_period**
* accepted values: `True` | **`False`**
* replaces `Prot` with `rotation_period` from `star_parameters`.

**use_stellar_activity_decay**
* accepted values: `True` | **`False`**
* replaces `Pdec` with `activity_decay` from `star_parameters`.

## Example

```yaml
inputs:
  LCdata:
    file: datasets/lightcurve_PyORBIT.dat
    kind: Phot
    models:
      - gp_qp_cycle
common:
  activity:
    boundaries:
      Prot: [10.0, 20.0]
      Pdec: [20.0, 1000.0]
      Pcyc: [100.0, 5000.0]
      Oamp: [0.001, 1.0]
models:
  gp_qp_cycle:
    model: tinygp_quasiperiodicsquaredexponential
    common: activity
    hyperparameters_condition: True
    rotation_decay_condition: True
    boundaries:
      Hamp: [0.0, 1.0]
      Camp: [0.0, 1.0]
```

## Model parameters

| Name | Parameter | Common? | Definition | Notes |
| :--- | :-------- | :------ | :--------- | :---- |
| `Prot` | Rotational period of the star | common | `activity` | Replaced by `rotation_period` when `use_stellar_rotation_period: True` |
| `Pdec` | Decay timescale of active regions | common | `activity` | Replaced by `activity_decay` when `use_stellar_activity_decay: True` |
| `Pcyc` | Timescale of the squared-exponential component | common | `activity` | |
| `Oamp` | Coherence scale | common | `activity` | |
| `Hamp` | Amplitude of the quasi-periodic component | dataset | `activity` | |
| `Camp` | Amplitude of the squared-exponential component | dataset | `activity` | |
