Skip to content

Commit

Permalink
Before messed around with Onyx
Browse files Browse the repository at this point in the history
  • Loading branch information
PennyWieser committed Feb 1, 2022
1 parent 1bb5409 commit 4c24894
Show file tree
Hide file tree
Showing 8 changed files with 554 additions and 129 deletions.
395 changes: 393 additions & 2 deletions Testing/Cali_Dataset_Pickles.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Testing/Calibration_Plot_Amp.ipynb

Large diffs are not rendered by default.

213 changes: 93 additions & 120 deletions Testing/Calibration_Plot_Cpx.ipynb

Large diffs are not rendered by default.

Binary file modified Testing/Petrelli20_Cali_input.pkl
Binary file not shown.
Binary file modified src/Thermobar/Petrelli20_Cali_input.pkl
Binary file not shown.
6 changes: 4 additions & 2 deletions src/Thermobar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@
from Thermobar.plotting import *
# Viscosity
from Thermobar.viscosity import *
# version
from ._version import __version__
# calibration
from Thermobar.calibration_plots import *

# version
from ._version import __version__



2 changes: 1 addition & 1 deletion src/Thermobar/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module
__version__ = '0.0.15'
__version__ = '0.0.16dev'
63 changes: 61 additions & 2 deletions src/Thermobar/calibration_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,64 @@ def return_Ridolfi21_cali_dataset(all=True):
Ridolfi_Cali_input=load(f)
return Ridolfi_Cali_input

def return_Petrelli2020_cali_dataset(all=True):
with open(Thermobar_dir/'Petrelli20_Cali_input.pkl', 'rb') as f:
Petrelli20_Cali_input=load(f)
return Petrelli20_Cali_input

def generic_cali_plot(df, model=None, P_kbar=None, T_K=None, figsize=(7, 5),x=None, y=None,
shape_cali='o', mfc_cali='white', mec_cali='k', ms_cali=5,
shape_data='^', mfc_data='red', alpha_cali=1, alpha_data=1, mec_data='k', ms_data=10, order="cali top"):
df_c=df.copy()
if P_kbar is not None:
df_c['P_kbar']=P_kbar
if T_K is not None:
df_c['T_K']=T_K
if model=="Ridolfi21":
with open(Thermobar_dir/'Ridolfi_Cali_input.pkl', 'rb') as f:
Cali_input=load(f)
if model=="Petrelli20":
with open(Thermobar_dir/'Petrelli20_Cali_input.pkl', 'rb') as f:
Cali_input=load(f)

if x not in df_c:
print(df_c.columns)
raise TypeError('x variable no present in input dataframe. Choose one of the columns printed above instead')
if y not in df_c:
print(df_c.columns)
raise TypeError('y variable no present in input dataframe')
if x not in Cali_input:
print(Cali_input.columns)
raise TypeError('x variable no present in calibration dataframe')
if y not in Cali_input:
print(Cali_input.columns)
raise TypeError('y variable no present in calibration dataframe')




fig, (ax1) = plt.subplots(1, 1, figsize=figsize)

if order=="cali top":
zorder_cali=0
zorder_data=5
if order=="cali bottom":
zorder_cali=5
zorder_data=0
ax1.plot(df_c[x], df_c[y], shape_data,
mfc=mfc_data, mec=mec_data, ms=ms_data, alpha=alpha_data, label='Data', zorder=zorder_cali)

ax1.plot(Cali_input[x], Cali_input[y], shape_cali,
mfc=mfc_cali, mec=mec_cali, ms=ms_cali, alpha=alpha_cali, label='Cali', zorder=zorder_data)

xlabel=x.replace('_', ' ')
ylabel=y.replace('_', ' ')
ax1.legend()
ax1.set_xlabel(xlabel)
ax1.set_ylabel(ylabel)

return fig

def Ridolfi21_cali_plot(amp_comps, P_kbar=None, T_K=None, figsize=(7, 5),x=None, y=None,
shape_cali='o', mfc_cali='white', mec_cali='k', ms_cali=5,
shape_data='^', mfc_data='red', mec_data='k', ms_data=10):
Expand Down Expand Up @@ -47,14 +105,15 @@ def Ridolfi21_cali_plot(amp_comps, P_kbar=None, T_K=None, figsize=(7, 5),x=None,


ax1.plot(amp_comps_c[x], amp_comps_c[y], shape_data,
mfc=mfc_data, mec=mec_data, ms=ms_data)
mfc=mfc_data, mec=mec_data, ms=ms_data, label='Data')

ax1.plot(Ridolfi_Cali_input[x], Ridolfi_Cali_input[y], shape_cali,
mfc=mfc_cali, mec=mec_cali, ms=ms_cali)
mfc=mfc_cali, mec=mec_cali, ms=ms_cali, label='Cali')

xlabel=x.replace('_', ' ')
ylabel=y.replace('_', ' ')
ax1.set_xlabel(xlabel)
ax1.set_ylabel(ylabel)
ax1.legend()

return fig

0 comments on commit 4c24894

Please sign in to comment.