series#
Series of scans: follow regions of the spectrum across scans and fit rate laws or your own formula.
analyze
#
analyze(
definition: SeriesDefinition, scans: Sequence[Scan]
) -> SeriesAnalysisResponse
Measure each region across the scans and fit every model to each trend.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
definition
|
SeriesDefinition
|
From |
required |
scans
|
Sequence[Scan]
|
The scans of the series. |
required |
Returns:
| Type | Description |
|---|---|
SeriesAnalysisResponse
|
One trend per region with all its fits (parameters, standard errors, R², fitter used, starts used and |
SeriesAnalysisResponse
|
fitted values), the best model, and the scans that were skipped with the reason. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no scan could be used. |
define
#
define(
regions: Sequence[SeriesRegion],
variable: SeriesVariable = TIME,
time_unit: SeriesTimeUnit = UNSPECIFIED,
x: Sequence[tuple[Scan, float]] | None = None,
variable_label: str = "",
variable_unit: str = "",
normalise_to: str = "",
model: SeriesModel = FIRST_ORDER,
custom_formula: str = "",
parameters: Sequence[SeriesCustomParameter] = ...,
weighting: SeriesWeighting = WEIGHTED,
fitter: SeriesFitter = AUTO,
) -> SeriesDefinition
Define a series: the regions followed, the variable they are followed against, and how they are fitted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
regions
|
Sequence[SeriesRegion]
|
The regions, each with an |
required |
variable
|
SeriesVariable
|
What the scans are ordered by: acquisition time, a custom value per scan, the array of an arrayed scan, or their order. |
TIME
|
time_unit
|
SeriesTimeUnit
|
Unit of a time variable; chosen from the span when unspecified. |
UNSPECIFIED
|
x
|
Sequence[tuple[Scan, float]] | None
|
With a custom |
None
|
variable_label
|
str
|
Name of a custom variable. |
''
|
variable_unit
|
str
|
Unit of a custom variable. |
''
|
normalise_to
|
str
|
Id of a region the other regions are divided by. |
''
|
model
|
SeriesModel
|
The model fitted; |
FIRST_ORDER
|
custom_formula
|
str
|
A formula in |
''
|
parameters
|
Sequence[SeriesCustomParameter]
|
Name, start value and bounds of each parameter of |
...
|
weighting
|
SeriesWeighting
|
Whether points are weighted by their standard errors. |
WEIGHTED
|
fitter
|
SeriesFitter
|
The algorithm fitting |
AUTO
|
Returns:
| Type | Description |
|---|---|
SeriesDefinition
|
The definition, to pass to |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no region is given, a custom variable has no |
fit
#
fit(
scans: Sequence[Scan],
regions: Sequence[SeriesRegion],
model: SeriesModel = FIRST_ORDER,
custom_formula: str = "",
parameters: Sequence[SeriesCustomParameter] = ...,
weighting: SeriesWeighting = WEIGHTED,
fitter: SeriesFitter = AUTO,
variable: SeriesVariable = TIME,
x: Sequence[tuple[Scan, float]] | None = None,
normalise_to: str = "",
) -> list[SeriesRegionFit]
Fit a model, or a formula of your own, to the trend of each region across the scans.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scans
|
Sequence[Scan]
|
The scans of the series. |
required |
regions
|
Sequence[SeriesRegion]
|
The regions, each with an |
required |
model
|
SeriesModel
|
The model fitted; |
FIRST_ORDER
|
custom_formula
|
str
|
A formula in |
''
|
parameters
|
Sequence[SeriesCustomParameter]
|
Name, start value and bounds of each parameter of |
...
|
weighting
|
SeriesWeighting
|
Whether points are weighted by their standard errors. |
WEIGHTED
|
fitter
|
SeriesFitter
|
The algorithm fitting |
AUTO
|
variable
|
SeriesVariable
|
What the scans are ordered by. |
TIME
|
x
|
Sequence[tuple[Scan, float]] | None
|
With a custom |
None
|
normalise_to
|
str
|
Id of a region the other regions are divided by. |
''
|
Returns:
| Type | Description |
|---|---|
list[SeriesRegionFit]
|
One result per region, with the trend and the model's fit: parameters, standard errors, R², the fitter |
list[SeriesRegionFit]
|
used, the starts used and the fitted value at each point. |
Raises:
| Type | Description |
|---|---|
ValueError
|
When no scan could be used, no region or an unusable formula is given, or |