rampedpyrox.RpoThermogram¶
-
class
rampedpyrox.
RpoThermogram
(t, T, g=None)[source]¶ Class for inputting and storing Ramped PyrOx true (observed) and estimated (forward-modelled) thermograms, calculating goodness of fit statistics, and reporting summary tables.
Parameters: - t (array-like) – Array of time, in seconds. Length nt.
- T (array-like) – Array of temperature, in Kelvin. Length nt.
- g (None or array-like) – Array of the true fraction of carbon remaining at each timepoint, with length nt. Defaults to None.
Warning
- UserWarning
- If attempting to use isothermal data to create an
rp.RpoThermogram
instance. Consider using an alternaterp.TimeData
subclass (to be added in future versions).
Notes
Important: The inverse model used herein is highly sensitive to boundary effects. To avoid unnecessarily large regularizations ensure that inputted data are completely at baseline (ppm CO2 = 0) at the beginning and the end of the experiment (can use the bl_subtract flag to enforce that this is true.)
See also
Daem
rp.Model
subclass used to generate the distributed activation energy model (DAEM) transform matrix for RPO data and translate between time- and E-space.EnergyComplex
rp.RateData
subclass for storing and analyzing RPO energy (rate) data.
Examples
Generating an arbitrary bare-bones thermogram containing only t and T:
#import modules import numpy as np import rampedpyrox as rp #generate arbitrary data t = np.arange(1,100) #100 second experiment beta = 0.5 #K/second T = beta*t + 273.15 #K #create instance tg = rp.RpoThermogram(t,T)
Generating a real thermogram using an RPO output .csv file and the
rp.RpoThermogram.from_csv
class method, and subtracting the baseline:#import modules import rampedpyrox as rp #create path to data file file = 'path_to_folder_containing_data/thermogram_data.csv' #create instance using baseline-subtracted CO2 data tg = rp.RpoThermogram.from_csv( file, bl_subtract = True, nt = 250) #number of down-sampled time points
Manually adding some model-estimated fraction remaining data as ghat:
#assuming ghat has been generating using a ``rp.Daem`` model tg.input_estimated(ghat)
Or, instead, you can input model-estimated g data directly from a given
rp.Daem
andrp.EnergyComplex
instance (i.e. run the forward model):#assuming ``rp.Daem`` named daem and ``rp.EnergyComplex`` named ec tg.forward_model(daem, ec)
Plotting the resulting observed and modelled thermograms (note scatter when plotted against temp due to short fluctuations in measured ramp rate. For a “smooth” plot, always plot against time, as this is the master variable.):
#import additional modules import matplotlib.pyplot as plt #create figure fig, ax = plt.subplots(1,2) #plot resulting rates against time and temp ax[0] = tg.plot( ax = ax[0], xaxis = 'time', yaxis = 'rate') ax[1] = tg.plot( ax = ax[1], xaxis = 'temp', yaxis = 'rate')
Printing a summary of the observed and modelled thermograms:
print(tg.tg_info) print(tg.tghat_info)
Attributes
- dghatdt : numpy.ndarray
- Array of the derivative of the estimated fraction of carbon remaining with respect to time at each timepoint, in fraction/second. Length nt.
- dghatdT : numpy.ndarray
- Array of the derivative of the estimated fraction of carbon remaining with respect to temperature at each timepoint, in fraction/Kelvin. Length nt.
- dgdt : numpy.ndarray
- Array of the derivative of the true fraction of carbon remaining with respect to time at each timepoint, in fraction/second. Length nt.
- dgdT : numpy.ndarray
- Array of the derivative of the true fraction of carbon remaining with respect to temperature at each timepoint, in fraction/Kelvin. Length nt.
- dTdt : numpy.ndarray
- Array of the derivative of temperature with respect to time (i.e. the instantaneous ramp rate) at each timepoint, in Kelvin/second. Length nt.
- g : numpy.ndarray
- Array of the true fraction of carbon remaining at each timepoint. Length nt.
- ghat : numpy.ndarray
- Array of the estimated fraction of carbon remaining at each timepoint. Length nt.
- nt : int
- Number of timepoints.
- resid : float
- The residual root mean square error (RMSE) between observed and modelled thermograms, g and ghat.
- t : numpy.ndarray
- Array of timepoints, in seconds. Length nt.
- T : numpy.ndarray
- Array of temperature, in Kelvin. Length nt.
- tg_info : pd.Series
Series containing the observed thermogram summary info:
t_max (s),
t_mean (s),
t_std (s),
T_max (K),
T_mean (K),
T_std (K),
max_rate (frac/s),
max_rate (frac/K),
- tghat_info : pd.Series
Series containing the modelled thermogram summary info:
t_max (s),
t_mean (s),
t_std (s),
T_max (K),
T_mean (K),
T_std (K),
max_rate (frac/s),
max_rate (frac/K),
Methods
forward_model
(model, ratedata)Forward-models rate data for a given model and populates the thermogram with model-estimated data. from_csv
(file[, bl_subtract, nt])Class method to directly import RPO data from a .csv file and create an rp.RpoThermogram
class instance.input_estimated
(ghat)Inputs estimated thermogram into the rp.RpoThermogram
instance and calculates statistics.plot
([ax, xaxis, yaxis])Plots the true and model-estimated thermograms against time or temp.