Module Index
RetentionParameterEstimator.ProgramRetentionParameterEstimator.check_measurementRetentionParameterEstimator.elution_temperatureRetentionParameterEstimator.estimate_parametersRetentionParameterEstimator.estimate_start_parameterRetentionParameterEstimator.estimate_start_parameter_mean_elu_tempRetentionParameterEstimator.estimate_start_parameter_single_rampRetentionParameterEstimator.load_chromatogramsRetentionParameterEstimator.load_chromatogramsRetentionParameterEstimator.lossRetentionParameterEstimator.lossRetentionParameterEstimator.match_stderrors_by_nameRetentionParameterEstimator.match_stderrors_m3_by_nameRetentionParameterEstimator.method_m1RetentionParameterEstimator.method_m2RetentionParameterEstimator.method_m3RetentionParameterEstimator.method_m4RetentionParameterEstimator.opt_KcentricRetentionParameterEstimator.opt_dKcentricRetentionParameterEstimator.opt_d_onlyRetentionParameterEstimator.optimize_KcentricRetentionParameterEstimator.optimize_dKcentricRetentionParameterEstimator.optimize_d_onlyRetentionParameterEstimator.prepare_optimization_dataRetentionParameterEstimator.prepare_single_substance_dataRetentionParameterEstimator.prog_listRetentionParameterEstimator.reference_holdup_timeRetentionParameterEstimator.separate_error_columnsRetentionParameterEstimator.stderror_m3RetentionParameterEstimator.substance_listRetentionParameterEstimator.tR_calcRetentionParameterEstimator.tR_τR_calcRetentionParameterEstimator.time_unit_conversion_factor
Detailed API
RetentionParameterEstimator.Program — Method
Program(TP, FpinP, L; pout="vacuum", time_unit="min")Construct the structure Program with conventional formulation (see function conventional_program in GasChromatographySimulator.jl) of programs for the case without a thermal gradient.
Arguments
TP: conventional formulation of a temperature program.FpinP: conventional formulation of a Flow (in m³/s) resp. inlet pressure (in Pa(a)) program.L: Length of the capillary measured in m (meter).pout: Outlet pressure, "vacuum" (default), "atmosphere" or the outlet pressure in Pa(a).time_unit: unit of time in the programs, "min"` (default) times are measured in minutes, "s" times are measured in seconds.
The argument L is used to construct the temperature interpolation T_itp(x,t).
Examples
julia> Program((40.0, 1.0, 5.0, 280.0, 2.0, 20.0, 320.0, 2.0),
(400000.0, 10.0, 5000.0, 500000.0, 20.0),
10.0)RetentionParameterEstimator.check_measurement — Method
check_measurement(meas, col_input; min_th=0.1, loss_th=1.0, se_col=true)Similar to method_m1 (method_m1) estimate the three retention parameters $T_{char}$, $θ_{char}$ and $ΔC_p$ including standard errors, see stderror. In addition, if the found optimized minima is above a threshold min_th, it is flagged and the squared differences of single measured retention times and calculated retention times above another threshold loss_th are recorded.
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.col_input... Named tuple withcol_input.Lthe column length in m andcol_input.dthe column diameter in mm. If this parameter is not gicen, than these parameters are taken frommeas.se_col=true... Iftruethe standard errors (from the Hessian matrix, seestderror) of the estimated parameters are added as separate columns to the result dataframe. Iffalsethe standard errors are added to the values asMasurementtype.
Output
check... Boolean.trueif all values are below the thresholds,falseif not.msg... String. Description ofcheckdf_flag... Dataframe containing name of the flagged measurements, solutes and the corresponding mesured and calculated retention times.index_flag... Indices of flagged resultsres... Dataframe with the optimized parameters and the found minima.Telu_max... The maximum of elution temperatures every solute experiences in the measured programs.
RetentionParameterEstimator.elution_temperature — Method
elution_temperature(tRs, prog)Calculate the elution temperatures from retention times tRs and GC programs prog.
RetentionParameterEstimator.estimate_parameters — Method
estimate_parameters(chrom; method=NewtonTrustRegion(), opt=std_opt, maxiters=10000, maxtime=600.0, mode="dKcentric", metric="squared")Calculate the estimates for the K-centric parameters and (optional) the column diameter.
Arguments
chrom... Tuple of the loaded chromatogram, seeload_chromatograms
Options
method=NewtonTrustRegion()... used optimization methodopt=std_opt... general options,std_opt = GasChromatographySimulator.Options(abstol=1e-8, reltol=1e-5, ng=true, odesys=false)maxiters=10000... maximum number of iterations for every single optimizationmaxtime=600.0... maximum time for every single optimizationmode="dKcentric"... mode of the estimation. Possible options:- "Kcentric_single" ... optimization for the three K-centric retention parameters separatly for every solute
- "Kcentric" ... optimization for the three K-centric retention parameters together for all solutes
- "dKcentric_single" ... optimization for the column diameter and the three K-centric retention parameters separatly for every solute
- "dKcentric" ... optimization for the column diameter and the three K-centric retention parameters together for all solutes
- "d_only" ... optimization for only the column diameter while keeping the K-centric retention parameters fixed (requires fixed parameter values as vectors)
- "d_only" ... optimization for only the column diameter while keeping the K-centric retention parameters fixed (requires fixed parameter values as vectors)
metric="squared"... used metric for the loss function ("squared" or "abs")
Output
df... DataFrame with the columnsName(solute names),d(estimated column diameter, optional),Tchar(estimated Tchar),θchar(estimated θchar),ΔCp(estimated ΔCp) andmin(value of the loss function at the found optima)sol... Array ofSciMLBase.OptimizationSolutionwith the results of the optimization with some additional informations.
RetentionParameterEstimator.estimate_start_parameter — Method
estimate_start_parameter(tRs::DataFrame, col, prog; time_unit="min", control="Pressure")Estimation of initial parameters for Tchar, θchar and ΔCp based on the elution temperatures calculated from the retention times tR and GC programs prog for column col. The initial value of Tchar is estimated from the elution temperatures of the measurements. Based on this estimated Tchar estimates for the initial values of θchar and ΔCp are calculated as $\theta_{char,init} = 22 \left(\frac{T_{char,init}}{T_{st}}\right)^{0.7} \left(1000\frac{d_f}{d}\right)^{0.09} °C$ and $\Delta C_p = (-52 + 0.34 T_{char,init}) \mathrm{J mol^{-1} K^{-1}}$
Output
Tchar_est... estimate for initial guess of the characteristic temperatureθchar_est... estimate for initial guess of θcharΔCp_est... estimate for initial guess of ΔCpTelu_max... the maximum of the calculated elution temperatures of the solutes
RetentionParameterEstimator.estimate_start_parameter_mean_elu_temp — Method
estimate_start_parameter_mean_elu_temp(tRs::DataFrame, col, prog; time_unit="min", control="Pressure")Estimation of initial parameters for Tchar, θchar and ΔCp based on the elution temperatures calculated from the retention times tR and GC programs prog for column col. This function is used, if the temperature program is not a single ramp heating program. The elution temperatures of all measurements are calculated and the mean value of the elution temperatures is used as the initial characteristic temperature of a substance. Based on this estimated Tchar estimates for the initial values of θchar and ΔCp are calculated as $\theta_{char,init} = 22 \left(\frac{T_{char,init}}{T_{st}}\right)^{0.7} \left(1000\frac{d_f}{d}\right)^{0.09} °C$ and $\Delta C_p = (-52 + 0.34 T_{char,init}) \mathrm{J mol^{-1} K^{-1}}$
Output
Tchar_est... estimate for initial guess of the characteristic temperatureθchar_est... estimate for initial guess of θcharΔCp_est... estimate for initial guess of ΔCpTelu_max... the maximum of the calculated elution temperatures of the solutes
RetentionParameterEstimator.estimate_start_parameter_single_ramp — Method
estimate_start_parameter_single_ramp(tRs::DataFrame, col, prog; time_unit="min", control="Pressure")Estimation of initial parameters for Tchar, θchar and ΔCp based on the elution temperatures calculated from the retention times tR and GC programs prog for column col. For this function it is assumed, that single ramp heating programs are used. The elution temperatures of all measurements are calculated and than interpolated over the heating rates. For a dimensionless heating rate of 0.6 the elution temperature and the characteristic temperature of a substance are nearly equal. Based on this estimated Tchar estimates for the initial values of θchar and ΔCp are calculated as $\theta_{char,init} = 22 \left(\frac{T_{char,init}}{T_{st}}\right)^{0.7} \left(1000\frac{d_f}{d}\right)^{0.09} °C$ and $\Delta C_p = (-180 + 0.63 T_{char,init}) \mathrm{J mol^{-1} K^{-1}}$
Output
Tchar_est... estimate for initial guess of the characteristic temperatureθchar_est... estimate for initial guess of θcharΔCp_est... estimate for initial guess of ΔCpTelu_max... the maximum of the calculated elution temperatures of the solutes
RetentionParameterEstimator.load_chromatograms — Method
load_chromatograms(file; delim=";")Loading of the chromatographic data (column information, GC program information, retention time information, see also "Structure of input data") from a file.
Arguments
file... path to the file.delim=";"... Delimiter for the imported .csv file.
Output
A tuple of the following quantities:
col... settings of the column asGasChromatographySimulator.Columnstructure.prog... Array of the GC programs asGasChromatographySimulator.Programstructure.tRs... DataFrame of the retention times.solute_names... Vector of the solute names.pout... outlet pressure (detector pressure), "vacuum" or "atmospheric".time_unit... unit of time scale used in the retention times and GC programs, "min" or "s".
RetentionParameterEstimator.load_chromatograms — Method
load_chromatograms(file::Dict{Any, Any}; path=joinpath(dirname(pwd()), "data", "exp_pro"))Loading of the chromatographic data (column information, GC program information, retention time information, see also "Structure of input data") from a file selected by the FilePicker in a Pluto notebook.
Arguments
file... file dictionary from the FilePicker.path... if the temperature programs are defined by measured temperatures over time, define the path to these files.
Output
A tuple of the following quantities:
col... settings of the column asGasChromatographySimulator.Columnstructure.prog... Array of the GC programs asGasChromatographySimulator.Programstructure.tRs... DataFrame of the retention times.solute_names... Vector of the solute names.pout... outlet pressure (detector pressure), "vacuum" or "atmospheric".time_unit... unit of time scale used in the retention times and GC programs, "min" or "s".
RetentionParameterEstimator.loss — Method
loss(tR, Tchar, θchar, ΔCp, L, d, prog, gas; opt=std_opt, metric="squared")Loss function as sum of squares of the residuals between the measured and calculated retention times.
Arguments
tR... mxn-array of the measured retention times in seconds.Tchar... n-array of characteristic temperatures in K.θchar... n-array of characteristic constants in °C.ΔCp... n-array of the change of adiabatic heat capacity in J mol^-1 K^-1.L... number of the length of the column in m.d... number of the diameters of the column in m.prog... m-array of structure GasChromatographySimulator.Programs containing the definition of the GC-programs.gas... string of name of the mobile phase gas.
Output
The output is a tuple of the following quantites:
sum((tR.-tRcalc).^2)... sum of the squared residuals over m GC-programs and n solutes.
RetentionParameterEstimator.loss — Method
loss(tR::Array{T, 1}, Tchar, θchar, ΔCp, substance_list::Array{String, 1}, L, d, prog::Array{GasChromatographySimulator.Program, 1}, gas; opt=std_opt, metric="squared") where T<:NumberCalculates the loss between the measured retention times tR and the calculated retention times tRcalc for a list (vector) of substances.
Arguments
tR::Array{T, 1}: Array of measured retention times.Tchar: Array of characteristic temperatures for each substance.θchar: Array of characteristic parameters for each substance.ΔCp: Array of heat capacity changes for each substance.substance_list::Array{String, 1}: List of substances.L: Length of the column.d: Diameter of the column.prog::Array{GasChromatographySimulator.Program, 1}: Array of programs for gas chromatography.gas: The gas used.opt=std_opt: (Optional) Options for calculating retention times.metric="squared": (Optional) The loss metric to use. Can be "abs" for absolute loss or "squared" for squared loss.
Return Value
l: The calculated loss value.
Errors
- Throws an error if the lengths of
tR,substance_list, andprogdo not match.
RetentionParameterEstimator.match_stderrors_by_name — Method
match_stderrors_by_name(res, stderrors)Match standard errors to results by substance name, ensuring correct association regardless of DataFrame order. Returns arrays of standard errors in the same order as res.Name.
RetentionParameterEstimator.match_stderrors_m3_by_name — Method
match_stderrors_m3_by_name(res, stderrors)Match standard errors from stderror_m3 to results by substance name, ensuring correct association regardless of DataFrame order. Returns arrays of standard errors in the same order as res.Name.
RetentionParameterEstimator.method_m1 — Method
method_m1(meas, col_input; se_col=true, parallel=false)Estimation of the three retention parameters $T_{char}$, $θ_{char}$ and $ΔC_p$ including standard errors, see stderror.
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.col_input... Named tuple withcol_input.Lthe column length in m andcol_input.dthe column diameter in mm.se_col=true... Iftruethe standard errors (from the Hessian matrix, seestderror) of the estimated parameters are added as separate columns to the result dataframe. Iffalsethe standard errors are added to the values asMasurementtype.parallel=false... Iftrue, use parallelization for per-substance optimizations and standard error calculations (requires Julia to be started with multiple threads, e.g.,julia -t 4).
Output
res... Dataframe with the optimized parameters and the found minima.Telu_max... The maximum of elution temperatures every solute experiences in the measured programs.
RetentionParameterEstimator.method_m2 — Method
method_m2(meas; se_col=true, parallel=false)Estimation of the column diameter $d$ and three retention parameters $T_{char}$, $θ_{char}$ and $Δ C_p$ including standard errors, see stderror. In a first run all four parameters are estimated for every substance separatly, resulting in different optimized column diameters. The mean value of the column diameter is used for a second optimization using this mean diameter and optimize the remainig thre retention parameters $T_{char}$, $θ_{char}$ and $Δ C_p$.
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.se_col=true... Iftruethe standard errors (from the Hessian matrix, seestderror) of the estimated parameters are added as separate columns to the result dataframe. Iffalsethe standard errors are added to the values asMasurementtype.parallel=false... Iftrue, use parallelization for per-substance optimizations and standard error calculations (requires Julia to be started with multiple threads, e.g.,julia -t 4).
Output
res... Dataframe with the optimized parameters and the found minima.Telu_max... The maximum of elution temperatures every solute experiences in the measured programs.
RetentionParameterEstimator.method_m3 — Method
method_m3(meas; se_col=true, parallel=false)Estimation of the column diameter $d$ and three retention parameters $T_{char}$, $θ_{char}$ and $Δ C_p$ including standard errors, see stderror. Brute-force method, where all parameters (3n+1 for n substances) are estimate in one optimization.
ATTENTION: This method can take long time to finish. The more substances, the longer it takes.
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.se_col=true... Iftruethe standard errors (from the Hessian matrix, seestderror) of the estimated parameters are added as separate columns to the result dataframe. Iffalsethe standard errors are added to the values asMasurementtype.parallel=false... Iftrue, use parallelization for standard error calculations (requires Julia to be started with multiple threads, e.g.,julia -t 4). Note: The main optimization cannot be parallelized as it's a single joint optimization.
Output
res... Dataframe with the optimized parameters and the found minima.Telu_max... The maximum of elution temperatures every solute experiences in the measured programs.
RetentionParameterEstimator.method_m4 — Method
method_m4(meas; se_col=true, method=NewtonTrustRegion(), opt=std_opt, maxiters=10000, maxtime=600.0, max_alternating_iters=10, tol=1e-6, parallel=false)Estimation of the column diameter $d$ and three retention parameters $T_{char}$, $θ_{char}$ and $Δ C_p$ including standard errors, see stderror. Uses alternating/block coordinate descent optimization:
- Initialize
dfrom a quick estimate (mean ofdKcentric_singleresults with reduced iterations) - Block 1: Optimize
d(1D optimization) while fixing substance parameters - Block 2: Optimize substance parameters (parallelizable) while fixing
d - Iterate steps 2-3 until convergence
This approach properly enforces that d is the same for all substances and is more efficient than joint optimization for many substances (>10).
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.se_col=true... Iftruethe standard errors (from the Hessian matrix, seestderror) of the estimated parameters are added as separate columns to the result dataframe. Iffalsethe standard errors are added to the values asMasurementtype.method=NewtonTrustRegion()... Optimization method to use.opt=std_opt... Options for the ODE solver.maxiters=10000... Maximum number of iterations for each optimization.maxtime=600.0... Maximum time for each optimization in seconds.max_alternating_iters=10... Maximum number of alternating iterations.tol=1e-6... Convergence tolerance fordand substance parameters (iteration stops when relative changes ind,Tchar,θchar, andΔCpare all less thantol).parallel=false... Iftrue, use parallelization for per-substance optimizations (Block 2) and standard error calculations (requires Julia to be started with multiple threads, e.g.,julia -t 4). This can provide significant speedup for many substances.
Output
res... Dataframe with the optimized parameters and the found minima.Telu_max... The maximum of elution temperatures every solute experiences in the measured programs.
RetentionParameterEstimator.opt_Kcentric — Method
opt_Kcentric(x, p)Function used for optimization of the loss-function in regards to the three K-centric parameters.
Arguments
x... 3n-vector of the three K-centric parameters of n solutes. Elements 1:n are Tchar, n+1:2n are θchar and 2n+1:3n are ΔCp values.p... vector containing the fixed parameters:tR = p[1]... vector of the measured retention times in seconds.substance_list = p[2]... vector of the names of the solutes related totRandprog.L = p[3]... number of the length of the column in m.d = p[4]... number of the diameters of the column in m.prog = p[5]... vector of structure GasChromatographySimulator.Programs containing the definition of the GC-programs.opt = p[6]... struture GasChromatographySimulator.Options containing the settings for options for the simulation.gas = p[7]... string of name of the mobile phase gas.metric = p[8]... string of the metric used for the loss function (squaredorabs).
Output
sum((tR.-tRcalc).^2)... sum of the squared residuals over m GC-programs and n solutes.
RetentionParameterEstimator.opt_dKcentric — Method
opt_dKcentric(x, p)Function used for optimization of the loss-function in regards to the colum diameter and the three K-centric parameters.
Arguments
x... 1+3n-vector of column diameter and the three K-centric parameters of n solutes. Element 1 is the diameter, 2:n+1 are Tchar, n+2:2n+1 are θchar and 2n+2:3n+1 are ΔCp values.p... vector containing the fixed parameters:tR = p[1]... vector of the measured retention times in seconds.substance_list = p[2]... vector of the names of the solutes related totRandprog.L = p[3]... number of the length of the column in m.prog = p[4]... vector of structure GasChromatographySimulator.Programs containing the definition of the GC-programs.opt = p[5]... struture GasChromatographySimulator.Options containing the settings for options for the simulation.gas = p[6]... string of name of the mobile phase gas.metric = p[7]... string of the metric used for the loss function (squaredorabs).
Output
sum((tR.-tRcalc).^2)... sum of the squared residuals over m GC-programs and n solutes.
RetentionParameterEstimator.opt_d_only — Method
opt_d_only(x, p)Function used for optimization of the loss-function with respect to only the column diameter d, while keeping the K-centric parameters fixed.
Arguments
x... 1-element vector containing the column diameterd.p... vector containing the fixed parameters:tR = p[1]... vector of the measured retention times in seconds.substance_list = p[2]... vector of the names of the solutes related totRandprog.Tchar = p[3]... vector of characteristic temperatures (fixed).θchar = p[4]... vector of characteristic constants (fixed).ΔCp = p[5]... vector of heat capacity changes (fixed).L = p[6]... number of the length of the column in m.prog = p[7]... vector of structure GasChromatographySimulator.Programs containing the definition of the GC-programs.opt = p[8]... structure GasChromatographySimulator.Options containing the settings for options for the simulation.gas = p[9]... string of name of the mobile phase gas.metric = p[10]... string of the metric used for the loss function (squaredorabs).
Output
- Loss value from the loss function.
RetentionParameterEstimator.optimize_Kcentric — Method
optimize_Kcentric(tR::Vector{T}, substance_list, col, prog, Tchar_e::Vector{T}, θchar_e::Vector{T}, ΔCp_e::Vector{T}; method=RetentionParameterEstimator.NewtonTrustRegion(), opt=RetentionParameterEstimator.std_opt, maxiters=10000, maxtime=600.0, metric="squared") where T<:NumberOptimize the K-centric retention parameters for a given set of substances, measured retention times and used programs.
Arguments
tR::Vector{T}: Vector of retention times.substance_list: List of substances to be optimized.col: Column characteristics including lengthL, diameterd, and gas typegas.prog: Program conditions.Tchar_e::Vector{T}: Initial estimates for characteristic temperatures.θchar_e::Vector{T}: Initial estimates for characteristic phase ratios.ΔCp_e::Vector{T}: Initial estimates for heat capacity changes.method: Optimization method to be used (default:RetentionParameterEstimator.NewtonTrustRegion()).opt: Optimization options (default:RetentionParameterEstimator.std_opt).maxiters: Maximum number of iterations (default: 10000).maxtime: Maximum time allowed for optimization in seconds (default: 600.0).metric: Metric to be used for optimization (default: "squared").
Returns
opt_sol: The solution of the optimization problem.
RetentionParameterEstimator.optimize_dKcentric — Method
optimize_dKcentric(tR::Vector{T}, substance_list, col, prog, Tchar_e::Vector{T}, θchar_e::Vector{T}, ΔCp_e::Vector{T}; method=RetentionParameterEstimator.NewtonTrustRegion(), opt=RetentionParameterEstimator.std_opt, maxiters=10000, maxtime=600.0, metric="squared") where T<:NumberOptimize the column diameter and K-centric retention parameters for a given set of substances, measured retention times and used programs.
Arguments
tR::Vector{T}: Vector of retention times.substance_list: List of substances to be optimized.col: Column characteristics including lengthLand gas typegas.prog: Program conditions.Tchar_e::Vector{T}: Initial estimates for characteristic temperatures.θchar_e::Vector{T}: Initial estimates for characteristic phase ratios.ΔCp_e::Vector{T}: Initial estimates for heat capacity changes.method: Optimization method to be used (default:RetentionParameterEstimator.NewtonTrustRegion()).opt: Optimization options (default:RetentionParameterEstimator.std_opt).maxiters: Maximum number of iterations (default: 10000).maxtime: Maximum time allowed for optimization in seconds (default: 600.0).metric: Metric to be used for optimization (default: "squared").
Returns
opt_sol: The solution of the optimization problem.
RetentionParameterEstimator.optimize_d_only — Method
optimize_d_only(tR::Vector{T}, substance_list, Tchar, θchar, ΔCp, L, prog, gas, d_e; method=RetentionParameterEstimator.NewtonTrustRegion(), opt=RetentionParameterEstimator.std_opt, maxiters=10000, maxtime=600.0, metric="squared") where T<:NumberOptimize only the column diameter d while keeping the K-centric retention parameters fixed.
Arguments
tR::Vector{T}: Vector of retention times.substance_list: List of substances.Tchar: Vector of characteristic temperatures (fixed).θchar: Vector of characteristic phase ratios (fixed).ΔCp: Vector of heat capacity changes (fixed).L: Length of the column in m.prog: Program conditions.gas: Gas type.d_e: Initial estimate for column diameter.method: Optimization method to be used (default:RetentionParameterEstimator.NewtonTrustRegion()).opt: Optimization options (default:RetentionParameterEstimator.std_opt).maxiters: Maximum number of iterations (default: 10000).maxtime: Maximum time allowed for optimization in seconds (default: 600.0).metric: Metric to be used for optimization (default: "squared").
Returns
d_opt: The optimized column diameter value.
RetentionParameterEstimator.prepare_optimization_data — Method
prepare_optimization_data(tRs, solute_names, prog, time_unit)Prepare data for optimization by converting time units, extracting retention times, filtering missing values, and creating vectorized program and substance lists.
Arguments
tRs: DataFrame with retention times (first column is measurement names, subsequent columns are retention times for each solute).solute_names: Vector of solute names (one per column intRsafter the first column).prog: Vector of programs (one per measurement/row intRs).time_unit: String indicating time unit, either"min"or"s".
Returns
tRs_: Vector of retention times with missing values filtered out.prog_: Vector of programs matching the filteredtRs_(expanded to 2D and filtered).subst_list_: Vector of substance names matching the filteredtRs_.
Examples
julia> using RetentionParameterEstimator, DataFrames, GasChromatographySimulator
julia> tRs = DataFrame(measurement=["meas1", "meas2"], solute1=[100.0, 200.0], solute2=[150.0, 250.0])
2×3 DataFrame
Row │ measurement solute1 solute2
│ String Float64 Float64
─────┼─────────────────────────────────
1 │ meas1 100.0 150.0
2 │ meas2 200.0 250.0
julia> solute_names = ["solute1", "solute2"]
2-element Vector{String}:
"solute1"
"solute2"
julia> prog = [GasChromatographySimulator.Program([0.0, 5.0], [40.0, 340.0], [150000.0, 250000.0], "vacuum", "min") for _ in 1:2]
2-element Vector{GasChromatographySimulator.Program}:
GasChromatographySimulator.Program(...)
julia> tRs_, prog_, subst_list_ = RetentionParameterEstimator.prepare_optimization_data(tRs, solute_names, prog, "min")
([100.0, 200.0, 150.0, 250.0], GasChromatographySimulator.Program[...], ["solute1", "solute1", "solute2", "solute2"])RetentionParameterEstimator.prepare_single_substance_data — Method
prepare_single_substance_data(tR_meas, prog, solute_name)Prepare data for single-substance optimization by filtering missing values and creating vectorized program and substance lists.
Arguments
tR_meas: 1D array of retention times (already time-unit converted) for a single substance.prog: Vector of programs (one per measurement).solute_name: Name of the single substance.
Returns
tRs_: Vector of retention times with missing values filtered out.prog_: Vector of programs matching the filteredtRs_.subst_list_: Vector with repeated substance name matching the filteredtRs_.
Examples
julia> using RetentionParameterEstimator, GasChromatographySimulator
julia> tR_meas = [100.0, missing, 200.0, 250.0]
4-element Vector{Union{Missing, Float64}}:
100.0
missing
200.0
250.0
julia> prog = [GasChromatographySimulator.Program([0.0, 5.0], [40.0, 340.0], [150000.0, 250000.0], "vacuum", "min") for _ in 1:4]
4-element Vector{GasChromatographySimulator.Program}:
GasChromatographySimulator.Program(...)
julia> tRs_, prog_, subst_list_ = RetentionParameterEstimator.prepare_single_substance_data(tR_meas, prog, "solute1")
([100.0, 200.0, 250.0], GasChromatographySimulator.Program[...], ["solute1", "solute1", "solute1"])RetentionParameterEstimator.prog_list — Method
prog_list(prog, tRs)Generate a vector of program conditions, excluding rows with missing values in tRs.
Arguments
prog: A program condition or vector of programs.- If a single
Program: repeated for all measurements and substances. - If a
Vector{Program}: one program per measurement (length must match number of rows intRs).
- If a single
tRs: A 2D array where each row corresponds to a set of retention times and columns to different substances.
Returns
- A vector of program conditions corresponding to non-missing rows in
tRs.
Examples
julia> using RetentionParameterEstimator, GasChromatographySimulator
julia> tRs = [100.0 150.0; 200.0 250.0]
2×2 Matrix{Float64}:
100.0 150.0
200.0 250.0
julia> prog_single = GasChromatographySimulator.Program([0.0, 5.0], [40.0, 340.0], [150000.0, 250000.0], "vacuum", "min")
GasChromatographySimulator.Program(...)
julia> prog_vec = [prog_single, prog_single]
2-element Vector{GasChromatographySimulator.Program}:
GasChromatographySimulator.Program(...)
julia> # Single program (repeated)
prog_list(prog_single, tRs)
4-element Vector{GasChromatographySimulator.Program}:
GasChromatographySimulator.Program(...)
julia> # Vector of programs (one per measurement)
prog_list(prog_vec, tRs)
4-element Vector{GasChromatographySimulator.Program}:
GasChromatographySimulator.Program(...)RetentionParameterEstimator.reference_holdup_time — Method
reference_holdup_time(prog, L, d, gas; control="Pressure")Calculate the reference holdup time for the GC program prog for a column with length L and diameter d and gas as mobile phase. The reference holdup time is the holdup time at the reference temperature 150°C.
RetentionParameterEstimator.separate_error_columns — Method
separate_error_columns(res)If the result dataframe res contains columns with Measurements typed values, these columns will be split in two. The first column contains the value and uses the original column name. The second column contains the uncertainty and the name of the column is the original name with an added "_uncertainty". If the column is not of the Measurements type, it will be copied as is for the new dataframe.
RetentionParameterEstimator.stderror_m3 — Method
stderror_m3(meas, res; opt=std_opt, metric="squared", parallel=false)Calculation of the standard error of the found optimized parameters (including column diameter d) using the hessian matrix at the optima. Used for method_m3 which optimizes all parameters jointly.
Attention
The used loss-function is hard coded in the function opt_dKcentric and has to be changed if another loss-function is used.
Arguments
meas... Tuple with the loaded measurement data, seeload_chromatograms.res... Dataframe with the result of the optimization, seeestimate_parameters.
Optional parameters:
opt=std_opt... Options for the ODE solver.metric="squared"... Metric used for the loss function ("squared"or"abs").parallel=false... Iftrue, use parallelization for standard error calculations (requires Julia to be started with multiple threads, e.g.,julia -t 4).
Output
stderrors... Dataframe with the standard errors of the optimized parameters (includingd).Hessian... The hessian matrix at the found optima.
RetentionParameterEstimator.substance_list — Method
substance_list(substance_names, tRs)Generate a vector of substance names, excluding rows with missing values in tRs.
Arguments
substance_names: A vector of substance names.tRs: A 2D array where each row corresponds to a set of retention times and columns to different substances.
Returns
- A vector of substance names corresponding to non-missing rows in
tRs.
RetentionParameterEstimator.tR_calc — Method
tR_calc(Tchar, θchar, ΔCp, L, d, prog, gas; opt=std_opt)Calculates the retention time tR for a solute with the K-centric parameters Tchar θchar and ΔCp for a column with length L, internal diameter d, the (conventional) program prog, options opt and mobile phase gas. For this calculation only the ODE for the migration of a solute in a GC column is solved, using the function GasChromatographySimulator.solving_migration.
RetentionParameterEstimator.tR_τR_calc — Method
tR_τR_calc(Tchar, θchar, ΔCp, L, d, df, prog, Cag, t₀, τ₀, gas; opt=std_opt)Calculates the retention time tR for a solute with the K-centric parameters Tchar θchar and ΔCp for a column with length L, internal diameter d, film thickness df, the (conventional) program prog, diffusirivity coefficient Cag, start time t₀, initial peak width τ₀, options opt and mobile phase gas. For this calculation the ODE-system for the migration of a solute and peak width in a GC column is solved, using the function GasChromatographySimulator.solving_odesystem_r. The result is a tuple of retention time tR and peak width τR.
RetentionParameterEstimator.time_unit_conversion_factor — Method
time_unit_conversion_factor(time_unit)Get the conversion factor for time units.
Arguments
time_unit: String indicating time unit, either"min"or"s".
Returns
- Conversion factor:
60.0for"min",1.0for"s"(or any other value).
Examples
julia> using RetentionParameterEstimator
julia> RetentionParameterEstimator.time_unit_conversion_factor("min")
60.0
julia> RetentionParameterEstimator.time_unit_conversion_factor("s")
1.0