PennyWieser / Thermobar

Python thermobarometry tool
41 stars 10 forks source link

Viscosity Function float multiplication error #32

Closed fboschetty closed 1 year ago

fboschetty commented 1 year ago

Hi Penny,

I'm struggling to use the calculate_viscosity_giordano_2008 function.

Whenever I attempt to run it it returns the following type error: TypeError: can't multiply sequence by non-int of type 'float'

I've attached a spreadsheet with my data in it, it has a T column in K as per the example on the read the docs.

import Thermobar as tb
import pandas as pd

PathGlass = "/Users/FelixBoschetty/Desktop/Glasses.xlsx"

Liqs = pd.read_excel(PathGlass, header=0)

Calc_Visc = tb.calculate_viscosity_giordano_2008(
    liq_comps=Liqs,
    T=Liqs["Temp_HT1987_K"]
)

I'm using thermobar v1.0.1.

I expect I'm doing something foolish but I can't see what. Any ideas?

Thanks,

Felix

Glasses.xlsx

PennyWieser commented 1 year ago

Hi Felix, my bad, i have never tested it with non numerical sample names, it was trying to divide your sample names by the norm factor. I have edited the code. It will be available on version 1.0.14 once I get a chance to push it (hopefully in 5 mins!)

PennyWieser commented 1 year ago

Once this reads 1.14 you are good to go! https://pypi.org/project/Thermobar/ Thanks for finding this bug - let me know if this works now

`import numpy as np import pandas as pd import matplotlib.pyplot as plt import Thermobar as pt pt.version

out=pt.import_excel('Glasses.xlsx', sheet_name='Sheet1') All=out['my_input'] Liqs=out['Liqs'] Liqs.tail()

Calc_Visc = pt.calculate_viscosity_giordano_2008( liq_comps=Liqs, T=All["Temp_HT1987_K"]) Calc_Visc `

fboschetty commented 1 year ago

Works like a dream.

Thanks Penny!