Package: tainstcalorimetry
Interfacing with experimental results file from TAM Air calorimeters made easy.After collecting multiple experimental results files from a TAM Air calorimeter you will be left with multiple.xls-files obtained as exports from the device control software. To achieve a side by side comparison of theses results and some basic extraction of relevant parameters,TAInstCalorimetryis here to get this done smoothly.Note:TAInstCalorimetryhas been developed without involvement ofTA Instrumentsand is thus independent from the company and its software.Info / DownloadsTable of ContentsExample UsageBasic plottingGetting cumulated heat valuesIdentifying peaksIdentifying peak onsetsPlotting by CategoryInstallationContributingExample UsageImport thetacalorimetrymodule fromTAInstCalorimetry.# importimportosfromTAInstCalorimetryimporttacalorimetryNext, we define where the exported files are stored. With this information at hand, aMeasurementis initialized. Experimental raw data and the metadata passed in the course of the measurement are retrieved by the methodsget_data()andget_information(), respectively.# define data path# "mycalodata" is the subfoldername where the calorimetry# data files (both .csv or .xlsx) are storedpathname=os.path.dirname(os.path.realpath(__file__))path_to_data=pathname+os.sep+"mycalodata"# Example: if projectfile is at "C:\Users\myname\myproject\myproject.py", then "mydata"# refers to "C:\Users\myname\myproject\mycalodata" where the data is stored# load experiments via class, i.e. instantiate tacalorimetry object with datatam=tacalorimetry.Measurement(folder=path_to_data)# get sample and informationdata=tam.get_data()info=tam.get_information()Basic plottingFurthermore, theMeasurementfeatures aplot()-method for readily visualizing the collected results.# make plottam.plot()# show plottacalorimetry.plt.show()Without further options specified, theplot()-method yields the following.Theplot()-method can also be tuned to show the temporal course of normalized heat. On the one hand, this "tuning" refers to the specification of further keyword arguments such ast_unitandy. On the other hand, theplot()-method returns an object of typematplotlib.axes._subplots.AxesSubplot, which can be used to further customize the plot. In the following, a guide-to-the-eye line is introduced next to adjuting the axes limts, which is not provided for via theplot()-method's signature.# show cumulated heat plotax=tam.plot(t_unit="h",y='normalized_heat',y_unit_milli=False)# define target timetarget_h=1.5# guide to the eye lineax.axvline(target_h,color="gray",alpha=0.5,linestyle=":")# set upper limitsax.set_ylim(top=250)ax.set_xlim(right=6)# show plottacalorimetry.plt.show()The following plot is obtained:Getting cumulated heat valuesThe cumulated heat after a certain period of timetarget_hfrom starting the measurement is a relevant quantity for answering different types of questions. For this purpose, the methodget_cumulated_heat_at_hoursreturns an overview of this parameter for all the samples in the specified folder.# get table of cumulated heat at certain agecumulated_heats=tam.get_cumulated_heat_at_hours(target_h=target_h,cutoff_min=10)# show resultprint(cumulated_heats)The return value of the method,cumulated_heatsis apd.DataFrame.Identifying peaksNext to cumulated heat values detected after a certain time frame from starting the reaction, peaks characteristics can be obtained from the experimental data via theget_peaks-method.# get peakspeaks=tam.get_peaks(show_plot=True,prominence=0.00001,# "sensitivity of peak picking"cutoff_min=60,# how much to discard at the beginning of the measurementplt_right_s=4e5,plt_top=1e-2,regex=".*_\d"# filter samples)Tweaking some of the available keyword arguments, the following plot is obtained:Please keep in mind, that in particular for samples of ordinary Portland cement (OPC) a clear and unambiguous identification/assigment of peaks remains a challenging task which cannot be achieved in each and every case byTAInstCalorimetry. It is left to the user draw meaningful scientific conclusions from the characteristics derived from this method.Identifying peak onsetsSimilarly, the peak onset characteristics are accessible via theget_peak_onsets-method. The resulting plot is shown below.# get onsetsonsets=tam.get_peak_onsets(gradient_threshold=0.000001,rolling=10,exclude_discarded_time=True,show_plot=True,regex="OPC")Plotting by CategoryFor introducing the idea of plotting calorimetry data "by category" another set of experimental data will be introduced. Next to the calorimetry data alone, information on investigated samples is supplied via an additional source file. In the present example via the filemini_metadata.csv.To begin with, aTAInstCalorimetry.tacalorimetry.Measurement-object is initialized for selected files from the specified ````path```.importpathlibfromTAInstCalorimetryimporttacalorimetry# path to experimental calorimetry filespath=pathlib.Path().cwd().parent/"TAInstCalorimetry"/"DATA"# initialize TAInstCalorimetry.tacalorimetry.Measurement objecttam_II=tacalorimetry.Measurement(path,regex="myexp.*",show_info=True,cold_start=True,auto_clean=False)Next, we need to connect the previously defined object to our metadata provided by themini_metadata.csv-file. To establish this mapping between experimental results and metadata, the file location, i.e. path, and the column name containing the exact(!) names of the calorimetry files needs to be passed to theadd_metadata_source-method. In our case, we declare the columnexperiment_nrfor this purpose# add metadatatam.add_metadata_source("mini_metadata.csv","experiment_nr")Finally, a plotting by category can be carried out by one or multiple categories as shown in the following.# define action by one categorycategorize_by="cement_name"# 'date', 'cement_amount_g', 'water_amount_g'# # define action by two or more categoriescategorize_by=["date","cement_name"]# loop through plots via generatorforthis_plotintam.plot_by_category(categorize_by):# extract parts obtained from generatorcategory_value,ax=this_plot# fine tuning of plot/cosmeticsax.set_ylim(0,3)# show plottacalorimetry.plt.show()This yields plots of the following kind.InstallationUse the package managerpipto install TAInstCalorimetry.pipinstallTAInstCalorimetryContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.Please make sure to update tests as appropriate.List of contributors:mj-hofmanntgaedtLicenseGNU GPLv3TestCode Styling