fitRecordFactor: Fit the suite record-scaling factors

fitRecordFactorR Documentation

Fit the suite record-scaling factors

Description

Suite-level record scaling of the spectral-match workflow: one scale coefficient per record (shape.recordFactor in the batch JSON contract), solved as a bounded quadratic program against the target band (global band-conditioned objective).

Usage

fitRecordFactor(
  .x,
  target,
  records,
  factorMin = 0,
  factorMax = Inf,
  bandWeight = 2,
  deficitWeight = 1
)

Arguments

.x

data.table. Suite PSA long table with columns RecordID, Tn, Sa, kind; the kind == "final" curves are scaled.

target

data.table. Target band with columns Tn, Sa.low, Sa.mean, Sa.high, in the same units as .x.

records

character. RecordIDs of the completed records to scale (at least two).

factorMin

numeric. Lower bound of the record factors (shape.recordFactor.min). Default 0.

factorMax

numeric. Upper bound of the record factors (shape.recordFactor.max). Default Inf.

bandWeight

numeric. Weight of the band-violation term. Default 2.

deficitWeight

numeric. Extra weight of the suite-mean deficit below the target. Default 1.

Value

list with scale (data.table RecordID, scaleFactor) and stage (one-row solver diagnostics; the stage column keeps the frozen product label "B").

Examples

## Not run: 
Suite <- fitRecordFactor(.x = PSA, target = Band,
                         records = Metrics[status == "done", RecordID],
                         factorMin = 0.5, factorMax = 1.6)

## End(Not run)

gmsp documentation built on July 18, 2026, 5:07 p.m.