Data I/O
Excel file format
Each sheet of the workbook must have exactly four columns and a header row:
| Column | Content | Unit |
|---|---|---|
| 1 | Temperature T | °C |
| 2 | Frequency f | Hz |
| 3 | Complex modulus norm |E*| | Pa or MPa |
| 4 | Phase angle φ | degrees (°) |
Isotherm layout (default): rows are grouped by temperature — all frequencies for one temperature appear consecutively.
Isochrone layout (Iso=true): rows are grouped by frequency — all temperatures for one frequency appear consecutively.
Multiple sheets in the same workbook are each loaded as an independent DataSeries.
Types
ViscoAnalysis.DataSeries — Type
DataSeriesContainer for complex-modulus measurements read from one Excel sheet.
Fields
data— Dict keyed by temperature (°C) or frequency (Hz in Iso mode). Each entry contains vectors for"f","omega","|M*|","delta","M*","M*_1","M*_2".MPa—trueif modulus values are already in MPa (no unit conversion).Iso—trueif data is organised by frequency (isochrone layout).name— Sheet name from the workbook.nb_sheet— Total number of sheets in the workbook.list_temp— Sorted vector of temperatures (°C).list_omega— Sorted vector of angular frequencies (rad/s).list_freq— Sorted vector of frequencies (Hz), or same aslist_omegain non-Iso mode.wlf— Fitted WLF functionT -> log10(aT), set after callingbuild_shift_factors!.C1,C2— WLF coefficients at the chosenTref._wlf,_C1,_C2— Internal WLF fit at the first temperature (used whenTrefis not inlist_temp).
ViscoAnalysis.AbstractFitResult — Type
AbstractFitResultAbstract supertype for all rheological model fit results. Every concrete subtype is callable: result(ω) returns E*(iω).
Concrete subtypes: FitResult2S2P1D, FitResult1S2P1D, FitResultHS.
ViscoAnalysis.FitResult2S2P1D — Type
FitResult2S2P1D <: AbstractFitResultResult of fitting the 2S2P1D model (2 Springs, 2 Parabolic, 1 Dashpot).
Fields
Einf,E0— Glassy / static modulus [MPa].delta— δ shape parameter.tauE— Relaxation time τ_E [s].k,h— Exponents (0 < k < h ≤ 1).beta— β dashpot coefficient.residual— Weighted least-squares objective at optimum.model—E*(p)function (callable).
r = fit2S2P1D(series[1], 10.0)
r(2π * 10.0) # E* at 10 HzViscoAnalysis.FitResult1S2P1D — Type
FitResult1S2P1D <: AbstractFitResultResult of fitting the 1S2P1D model (no glassy spring; E∞ is implicitly ∞).
Fields
E0— Static modulus [MPa].delta— δ shape parameter.tauE— Relaxation time τ_E [s].k,h— Exponents (0 < k < h ≤ 1).beta— β dashpot coefficient.residual— Weighted least-squares objective at optimum.model—E*(p)function (callable).
r = fit1S2P1D(series[1], 10.0)
r(2π * 10.0)ViscoAnalysis.FitResultHS — Type
FitResultHS <: AbstractFitResultResult of fitting the Huet-Sayegh model (no dashpot; β → ∞).
Fields
Einf,E0— Glassy / static modulus [MPa].delta— δ shape parameter.tauE— Relaxation time τ_E [s].k,h— Exponents (0 < k < h ≤ 1).residual— Weighted least-squares objective at optimum.model—E*(p)function (callable).
r = fitHS(series[1], 10.0)
r(2π * 10.0)ViscoAnalysis.model_name — Function
model_name(r::AbstractFitResult) -> StringReturn the name of the rheological model used for r.
Functions
ViscoAnalysis.load_data — Function
load_data(filename; MPa=false, Iso=false) -> Vector{DataSeries}Read all sheets of an Excel workbook and return one DataSeries per sheet.
Arguments
filename— Path to the.xlsxfile.MPa— Settrueif the modulus column is already in MPa; otherwise values are assumed to be in Pa and converted (÷ 10⁶).Iso— Settruefor an isochrone layout where rows are indexed by frequency instead of temperature.
Excel format expected
| Column 1 | Column 2 | Column 3 | Column 4 |
|---|---|---|---|
| T (°C) | f (Hz) | E* norm (Pa/MPa) | φ (degrees) |
All sheets in the workbook must share the same layout.
Example
using ViscoAnalysis
series = load_data("EBR_T0_T10.xlsx"; MPa=true)
series[1] # first sheet
series[1].list_temp # available temperaturesDataSeries — field reference
After calling load_data the returned DataSeries objects have the following fields:
| Field | Type | Description |
|---|---|---|
name | String | Sheet name from the workbook |
MPa | Bool | true if modulus is stored in MPa |
Iso | Bool | true if data is in isochrone layout |
list_temp | Vector{Float64} | Sorted unique temperatures [°C] |
list_freq | Vector{Float64} | Sorted unique frequencies [Hz] |
list_omega | Vector{Float64} | Sorted unique angular frequencies [rad/s] |
wlf | Union{Nothing, Function} | Fitted WLF function T → log₁₀(aT) |
C1, C2 | Float64 | WLF coefficients at the chosen Tref |
Each temperature entry d[T] is a Dict{String, Any} with keys:
| Key | Description |
|---|---|
"f" | Frequencies [Hz] |
"omega" | Angular frequencies [rad/s] |
"|M*|" | Modulus norm [MPa] |
"delta" | Phase angle [°] |
"M*" | Complex modulus [MPa] |
"M*_1" | Storage modulus E₁ [MPa] |
"M*_2" | Loss modulus E₂ [MPa] |
Dict-like access
DataSeries supports a dict-like interface:
d = series[1]
d[10.0] # entry at T = 10 °C
haskey(d, 10.0) # check if temperature exists
keys(d) # all temperatures
length(d) # number of temperature entries
for (T, entry) in d # iteration
...
end