Skip to main content

Handling TAM Air calorimetry files made easy.

Project description

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, TAInstCalorimetry is here to get this done smoothly.

Note: TAInstCalorimetry has been developed without involvement of TA Instruments and is thus independent from the company and its software.

Info / Downloads

PyPI - Downloads PyPI - Downloads PyPI - Python Version

Table of Contents

Example Usage

Import the tacalorimetry module from TAInstCalorimetry.

# import
import os
from TAInstCalorimetry import tacalorimetry

Next, we define where the exported files are stored. With this information at hand, a Measurement is initialized. Experimental raw data and the metadata passed in the course of the measurement are retrieved by the methods get_data() and get_information(), respectively.

# define data path
# "mycalodata" is the subfoldername where the calorimetry
# data files (both .csv or .xlsx) are stored

pathname = 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 data
tam = tacalorimetry.Measurement(folder=path_to_data)

# get sample and information
data = tam.get_data()
info = tam.get_information()

Basic plotting

Furthermore, the Measurement features a plot()-method for readily visualizing the collected results.

# make plot
tam.plot()
# show plot
tacalorimetry.plt.show()

Without further options specified, the plot()-method yields the following.

enter image description here

The plot()-method can also be tuned to show the temporal course of normalized heat.

# show cumulated heat plot
ax = tam.plot(
    t_unit="h",
    y='normalized_heat',
    y_unit_milli=False
)

# define target time
target_h = 1.5

# guide to the eye line
ax.axvline(target_h, color="gray", alpha=0.5, linestyle=":")

# set upper limits
ax.set_ylim(top=250)
ax.set_xlim(right=6)
# show plot
tacalorimetry.plt.show())

The following plot is obtained:

enter image description here

Getting cumulated heat values

The cumulated heat after a certain period of time target_h from starting the measurement is a relevant quantity for answering different types of questions. For this purpose, the method get_cumulated_heat_at_hours returns an overview of this parameter for all the samples in the specified folder.

# get table of cumulated heat at certain age
cumulated_heats = tam.get_cumulated_heat_at_hours(
          target_h=target_h,
          cutoff_min=10
          )
          
# show result
print(cumulated_heats)

The return value of the method, cumulated_heats is a pd.DataFrame.

Identifying peaks

Next to cumulated heat values detected after a certain time frame from starting the reaction, peaks characteristics can be obtained from the experimental data via the get_peaks-method.

# get peaks
peaks = 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 measurement
    plt_right_s=4e5,
    plt_top=1e-2,
    regex=".*_\d"  # filter samples
    )

Tweaking some of the available keyword arguments, the following plot is obtained:

Identified peaks for one sample.

Identifying peak onsets

Similarly, the peak onset characteristics are accessible via the get_peak_onsets-method. The resulting plot is shown below.

# get onsets
onsets = tam.get_peak_onsets(
    gradient_threshold=0.000001,
    rolling=10,
    exclude_discarded_time=True,
    show_plot=True,
    regex="OPC"
)

Identified peak onsets for one sample.

Installation

Use the package manager pip to install TAInstCalorimetry.

pip install TAInstCalorimetry

Contributing

Pull 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:

  • tgaedt
  • mj-hofmann

License

GNU GPLv3

Test

Tests

Code Styling

Code style: black

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

TAInstCalorimetry-0.1.4.tar.gz (1.3 MB view hashes)

Uploaded Source

Built Distribution

TAInstCalorimetry-0.1.4-py3-none-any.whl (1.3 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page