# Welcome to Thermobar’s documentation!

- Introduction and Citation
- Units
- Installation & Updating
- Importing Data
- Available mineral and mineral-melt equations
- Adding new models
- FAQs and Troubleshooting
- Change Log
- Version 1.0.45 - July 11th, 2024
- Version 1.0.43 - June 29th 2024
- Version 1.0.42 - June 20th 2024
- Version 1.0.37 - Feb 26th, 2024
- Version 1.0.36 - Jan 21st, 2024
- Version 1.0.31 to Version 1.0.34 - Dec, 2023
- Version 1.0.31 - November 17th, 2023
- Version 1.0.31 - November 17th, 2023
- Version 1.0.30 - October 6th, 2023
- Version 1.0.28 - October 6th, 2023
- Version 1.0.25 - July 6th, 2023
- Version 1.0.20 Mayn 30th, 2023
- Version 1.0.19 April 1st, 2023
- Version 1.0.18 April 1st, 2023
- Version 1.0.16 April 1st, 2023
- Version 1.0.14 March 13th, 2023
- Version 1.0.12, Feb 13th, 2023
- Version 1.0.11, Feb 11th, 2023
- Version 0.12 Nov 23rd, 2021
- Version 0.11 Nov 15th, 2021
- Previous changes before detailed change log started:

- Worked examples

- YouTube Tutorials
- Why did we develop Thermobar
- Introduction to Thermobar
- Liquid-only Thermometry
- Olivine-Liquid Thermometry
- Clinopyroxene-Liquid Melt Matching 1 (simpler)
- Clinopyroxene-Liquid Melt Matching 2 (advanced)
- Amphibole-only and Amphibole-Liquid (advanced)
- Feldspar-Liquid thermobarometry and hygrometry
- Two Feldspar thermometry
- Integration with VESIcal

- A five minute intro to Thermobar
- 1 - Introduction
- 2 - Installing and importing Thermobar
- 3 - Load data from an Excel file
- 4. Inspect data
- 5 - Getting help
- 6 - Can perform calculations just for pressure if you know temperature
- 7 - Similarly, for temperature at a known pressure
- 8 - If you don’t know either P or T
- 9 - Can plot a very simple x-y diagram using matplotlib (loaded as plt)
- 10 - Example of warnings for incorrect inputs
- 11 - Example of Error when you don’t have an FeOt column…
- What about if you have FeO and Fe2O3?
- What about loading in data from Petrolog?

- Exporting to Excel
- Importing various python things
- Lets load in the Cpx-Liq data from the Into example
- Example 1: Lets calculate Cpx-Liq temps, which returns a pandas series (single column of numbers)
- 1b - Append column in a specific position
- Example 2: What happen if our function outputs a pandas dataframe? e.g., if we perform the same calculation using “Eq_Tests=True”
- Example 3 - Combining seperate dataframe

- Liquid-only thermometry
- Olivine-Liquid thermometry
- You need to install Thermobar once on your machine, if you haven’t done this yet, uncomment the line below (remove the #)
- 1a - Putirka eq 22
- 1b - Specify eq_tests=True
- 1c - You can also overwrite the spreadsheet Fe3Fet_Liq in the function itself
- 3a - Roeder and Emslie, 1970
- 3b - Toplis, 2005
- 3c - Putirka (2016)
- 3d - All Models

- Olivine-Liquid Hygrometry
- 1 Sample - Fe-Mg equilibrium between olivines and matrix glasses
- Multisample - Fe-Mg equilibrium between olivines and glass.
- CHOMPI calculations

- Clinopyroxene-only and Clinopyroxene-Liquid Thermobarometry.
- You need to install Thermobar once on your machine, if you haven’t done this yet, uncomment the line below (remove the #)
- Now, load the data - you can either have the notebook in the same folder as the spreadsheet:
- Or include the path if the data is somewhere else:
- 1a - Temperature for a known pressure and water content
- 1b - Temperature, overwriting the spreadsheet water content in the function itself
- 1c- Lets use the thermometer of Brugman and Till, 2019.
- 1d - We can also specify eq_tests=True to get a full dataframe back with all the components, as well as a number of equilibrium test values
- 2a - Pressure at fixed temperature (T=1300 K), and pressures from Neave and Putirka (2017)
- 2b - Equation 30 from Putirka (2008), overwriting input water, return equilibrium tests
- 2c - As above, but setting a fixed Fe3Fet_Liq ratio
- 3a - Iterating equation 30 from Putirka (2008) for P, and equation 33 from Putirka (2008) for T
- 3b - Same as above, but with eq_tests=True
- 3a -Pressure only, using equation 32b (at T=1300 K), and H2O=0
- 3b - Pressure only, using 5 wt% water
- 3c - Temperature-only using eq 32d at 5 kbar
- 3d - Iterating P from 32b, and T from 32d, with H2O=5
- Step 1 - Calculate Mg# for liq and cpxs
- Step 2 - Calculate equilibrium lines to show on the rhodes diagram
- Step 3 - Combine these on a plot

- Machine-Learning-based Clinopyroxene-only and Clinopyroxene-Liquid Thermobarometry.
- Pyroxene Classification Diagrams
- Pyroxene Ternary Diagram Segmented by Sample
- Import Python things
- Set plotting parameters
- Load in pyroxene compositions
- Lets calculate the components we need to plot a ternary diagram.
- First, we can plot all the samples as a single color
- Or, we can try to segment for different samples, First, lets find how many unique samples we have
- Now lets segment out for each sample ID
- Plot 1
- Plot 2

- Cpx-Liquid Melt Matching (Simple Intro)
- You need to install Thermobar once on your machine, if you haven’t done this yet, uncomment the line below (remove the #)
- We can also run calculations at a fixed temperature (1450 K)
- Or at fixed pressure (5 kbar here)
- We can adapt the filters to get more matches
- We can look and see we get a lot more matches.

- This code is a more advanced example of Cpx-Liquid melt matching
- First, lets combine these synthetic liquids with all measured liquids to get an even bigger dataset
- Second, following Scruggs and Putirka (2018), lets allocate H2O as a function of SiO2 content in the melt
- Third, lets do melt matching

- Orthopyroxene-only and Liquid thermobarometry.
- 1a - Equation 28a, fixed pressure
- 1b - As above, but overwriting the input spreadsheet water content with an integer.
- 1c - we can also specify eq_tests=True to get a full dataframe back with all the components, as well as a number of equilibrium test values
- 2a - Pressure using equation 29a at 1300 K
- 2b - Overwrite input water content with zero. Return equilibrium tests.
- 2c - Can overwrite input Fe3Fet_Liq ratio (or 0 if didnt enter one) with an integer
- 3a - Iterating equation 29b from Putirka (2008) for P, and Beattie (1993) for temperature
- Step 1 - calculate Mg# for opx and liquid (can either treat FeT as Fe2, or partition into Fe2 and Fe3, only calculated Kd using Fe2)
- Step 2 - calculate rhodes diagram lines between Mg#=0.4 and Mg#=0.7
- Step 3 - Plot these lines, along with measured opxs. Here we draw symbols where we account for Fe3+ (diamond), and just using Fet in the glas (stars)

- Pyroxene Classification Diagrams
- Opx-Liq Matching

- Opx-Cpx Thermobarometry
- 1a - Pressures using equation 38 of Putirka (2008)
- To get equilibrium tests, specify eq_tests=True. This also returns input compositions.
- You can then filter this to get only ones in high T equilibrium
- 1b - Equation 39 (T-dependent)
- 2b - Putirka (2008) eq 36 (P-dependent).
- 3b - Here, use equation T of T_Put2008_Eq36, and equation P of P_Put2008_eq39
- 3c - Here, use Temp from Bray 1990 and equation 38 from Putirka (2008)

- Opx-Cpx Matching
- Setting pretty plot parameters
- Load in Opx compositions
- Load in Cpx compositions
- Example 1 - Assesing all possible combinations
- 1b- High T Kd filter
- 1c - User-selected KdMatch and Kd_Err
- 1d - Calculations at a constant temperature
- Lets save the “all matches” dataframe to excel…
- Similary, here’s how we save the high T matches to excel…

- Amphibole Thermobarometry and Chemometry
- Ridolfi 2021 - Minerals algorithm
- Mutch et al. (2016)
- Using T_Put2016_eq4a_amp_sat.
- Assessing equilibrium
- Overwriting H2O_Liq.
- Both are actually pretty sensitive to water.
- can also specify eq_tests=True, and it calculates Kd Fe-Mg, and then classifies within this is within the suggested range of Putirka (2008)
- Or, we can use an amphibole only thermobarometers to get temperature, to then feed into the chemometry function

- Amp-Liq Melt mathcing
- Amphibole Classification Diagrams

- Feldspar-liquid thermobarometry
- Temperature using equation 23 at 5 kbar
- Temperature using equation 24a at 5 kbar
- Equilibrium tests
- Here we filter based on whether any given pair passes the An-Ab test within the values recomended by Putirka (2008) (T>1050 is 0.28+-0.11, and T<1050 is 0.1+-0.05)
- Can also add filters based on Delta An, Ab, Or values

- Plag - Liquid hygrometry
- 1a - Using equation H of Putirka (2005)
- 1b - using hygrometer of Waters 2015
- 1c - Can also just enter XAn and XAb rather than full plag compositions
- 2d - Manually iterating temperature and water content for plagioclase-liquid thermobarometry.
- Example 2e - Using Thermobar’s built in functions for iterating T and H

- Two Feldspar thermometry
- Import python things and set plotting parameters
- Import Kspars
- Import plags
- Calculate T for all matches using equation 27a at 5 kbar
- Examine equilibrium tests
- Filtering outputs
- Apply filters

- Plag-Liq and Kspar-Liq Matching
- Example 1 - Plag and Liquid.
- Please check your feldspars are actually plagioclases! If you apply plag-liq thermometers to kspars, you get stupid results, that mess up the iterative calculations
- Lets plot to inspect and check they are actually plag, else you will have convergence issues
- Example 1a - All possible Liq-Plag matches, An-Ab equilibrium
- Example 1b - All possible Liq-Plag matches, no filter
- Example 1c - Iterating T and H2O for all possible Plag-Liq matches
- Example 2 - Kspar-Liquid calculations

- Feldspar ternary classification diagram
- Load in data, in this case, have paired Plag and Kspar data, but could have as seperate sheets
- Calculate compostions for each in terms of co-ordinates for ternary axis
- Example 1 - Just the classification diagram (be patient, we will add your data in example 2)!
- Example 2 - plotting data on top of classification
- Example 3 - Setting symbol size by FeOt content

- Plag Ternary Diagram Segmented by Sample
- Import Python things
- Set plotting parameters
- Load in plagioclase compositions
- Lets calculate the components we need to plot a ternary diagram.
- First, we can plot all the samples as a single color
- Or, we can try to segment for different samples, First, lets find how many unique samples we have
- Now lets segment out for each sample ID
- Plot 1
- Plot 2

- Error Propagation - Liq Only
- Step 1 - Use function add_noise_sample_1phase() to add sample noise and make lots of synthetic liquids
- Step 2 - input this synthetic dataframe into the functions for calculating temperature
- Step 3 - Plot the results
- Step 4 - Use a function to get the mean, median and standard deviation for each liquid
- Step 1 - add errors based on the dataframe Liquid2_Err which are percentage errors.
- Step 2 - calculating temperatures for all these synthetic liquids using equation 16 of Putirka (2008)
- Step 3 - Calculating standard deviations, means, and medians etc
- plot a histogram of resulting H2O distribution
- Now feed this into a thermometer

- Error propagation - Cpx-Liquid.
- Lets first calculate Cpx-only pressures for these synthetic noisy Cpxs
- Lets plot the distribution of pressures for each Cpx
- We can also calculate statistics…
- Lets do the same but for Cpx-Liq now. Remember, only Cpx has noise added
- Each histogram shows the pressure distribution from a single Cpx-Liquid pair resulting from adding 5% error to just Na in Cpx.
- Calculate Statistics
- First, load in the published 1 sigma values
- Recreate plot shown in manuscript for just 2 cpx-liq pairs from experiments
- Plot for 6 separate cpx-liq pairs
- Temperature distributions for first 6 pairs

- Error propagation - Cpx-only

- Multisample - Fe-Mg equilibrium in ol-hosted MIs
- Loading a dataset
- Load in the matrix glasses
- Load in the melt inclusion data and the olivines
- Find each sample for Glasses
- Workflow 1: Assess if the olivines are in equilibrium with the co-erupted matrix glass
- Workflow 2: Assess if the olivines and their melt inclusions are in equilibrium
- 1. Calculate melt inclusion Mg
- 2. Plot on a rhodes diagram

- 1 Sample - Fe-Mg equilibrium in ol-hosted MIs
- Loading a dataset
- Load in the matrix glasses
- Load in the melt inclusion data and the olivines
- Workflow 1: Assess if the olivines are in equilibrium with the co-erupted matrix glass
- Workflow 2: Assess if the olivines and their melt inclusions are in equilibrium
- 1. Calculate melt inclusion Mg
- 2. Plot on a rhodes diagram

- Combining Thermobar with VESIcal for Sat P at known T

- Calculating equilibrium mineral contents from a liquid line of descent
- First, pip install Thermobar if you haven’t already
- Import your liquid compositions extracted from Petrolog into the thermobar format
- Check they have read in correctly
- We need a temperature for many models
- First, we read in the mineral data, each mineral has a sulfide next to it
- Then we calculate An contents, Mg#s, and Fo contents for these
- First, calculate Glass temperature, as buffer pos is T sensitive
- Calculate Glass Fe3FeT from redox (FMQ+0.2, Bali et al. 2018)
- Then we calculate Eq contents of each mineral for the matrix glasses

- Assessing Calibration Ranges of models
- Calculating Viscosity from liquid compositions
- Lets load in some melt compositions from a MELTS model published in Wieser et al. (2022)
- Inspect the liquid data you have loaded in to make sure it makes sense
- Lets calculate viscosity at the temperature stored in the column “Temp HT1987_K”
- Using a different thermometer for temperature
- With different F2O contents

- This notebook shows how to convert from Oxide wt% to element wt% and back again
- Converting back and forth from Fe3Fet to different redox buffer positions.
- Converting from fo2 to buffer position
- Calculating Viscosity from liquid compositions
- Lets load in some melt compositions from a MELTS model published in Wieser et al. (2022)
- Inspect the liquid data you have loaded in to make sure it makes sense
- Lets calculate viscosity at the temperature stored in the column “Temp HT1987_K”
- Using a different thermometer for temperature
- With different F2O contents

- Converting pressures into depths