Skip to content

Commit

Permalink
Update dataframe handling for pandas 2.0, update to version 1.2.6 for…
Browse files Browse the repository at this point in the history
… pip.
  • Loading branch information
Kayla Iacovino committed Feb 12, 2024
1 parent f8add53 commit 1a175be
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 30 deletions.
12 changes: 7 additions & 5 deletions VESIcal.egg-info/PKG-INFO
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
Metadata-Version: 2.1
Name: VESIcal
Version: 1.2.5
Version: 1.2.6
Summary: A generalized python library for calculating and plotting various things related to mixed volatile (H2O-CO2) solubility in silicate melts.
Home-page: https://github.com/kaylai/VESIcal
Author: Kayla Iacovino, Simon Matthews, Penny Wieser
Author-email: [email protected]
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Dist: scipy
Requires-Dist: sympy
Requires-Dist: openpyxl

# VESIcal
A generalized python library for calculating and plotting various things related to mixed volatile (H2O-CO2) solubility in silicate melts.
Expand Down Expand Up @@ -112,5 +116,3 @@ pip install VESIcal --upgrade
Issues are tracked on [GitHub](https://github.com/kaylai/VESIcal/issues).

Patches may be submitted via a [Github pull request](https://github.com/kaylai/VESIcal/pulls). All changes should include tests (VESIcal uses python's unittest library) and pass [flake8](https://pypi.org/project/flake8/).


2 changes: 1 addition & 1 deletion VESIcal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
related to mixed volatile (H2O-CO2) solubility in silicate melts.
"""

__version__ = "1.2.5"
__version__ = "1.2.6"
__author__ = "Kayla Iacovino, Simon Matthews, and Penny Wieser"

# ----------------- IMPORTS ----------------- #
Expand Down
2 changes: 1 addition & 1 deletion build/lib/VESIcal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
related to mixed volatile (H2O-CO2) solubility in silicate melts.
"""

__version__ = "1.2.5"
__version__ = "1.2.6"
__author__ = "Kayla Iacovino, Simon Matthews, and Penny Wieser"

# ----------------- IMPORTS ----------------- #
Expand Down
41 changes: 24 additions & 17 deletions build/lib/VESIcal/model_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,42 +473,49 @@ def calculate_isobars_and_isopleths(self, pressure_list,
if isopleth_list is None:
has_isopleths = False

isobars_df = pd.DataFrame(columns=['Pressure', 'H2O_liq', 'CO2_liq'])
isobars = []
isobar_dfs = [] # Prepare to accumulate DataFrames for isobars
isobars = [] # This is only used as a return if return_dfs is set to False
for pressure in pressure_list:
dissolved = np.zeros([2, points])
Xv0 = np.linspace(0.0, 1.0, points)
for i in range(points):
dissolved[:, i] = self.calculate_dissolved_volatiles(
pressure=pressure, X_fluid=(Xv0[i], 1-Xv0[i]), **kwargs)
isobars_df = isobars_df.append({
'Pressure': pressure,
'H2O_liq': dissolved[H2O_id, i],
'CO2_liq': dissolved[CO2_id, i]
}, ignore_index=True)
pressure=pressure, X_fluid=(Xv0[i], 1-Xv0[i]), **kwargs)
row_df = pd.DataFrame({
'Pressure': [pressure],
'H2O_liq': [dissolved[H2O_id, i]],
'CO2_liq': [dissolved[CO2_id, i]]
})
isobar_dfs.append(row_df)
isobars.append(dissolved)

# Concatenate all DataFrames for isobars
isobars_df = pd.concat(isobar_dfs, ignore_index=True)

if has_isopleths:
isopleths_df = pd.DataFrame(columns=['XH2O_fl', 'H2O_liq',
'CO2_liq'])
isopleth_dfs = []
isopleths = []
for isopleth in isopleth_list:
dissolved = np.zeros([2, points])
pmin = np.nanmin(pressure_list)
pmax = np.nanmax(pressure_list)
if pmin == pmax:
pmin = 0.0
pressure = np.linspace(pmin, pmax, points)
pressures = np.linspace(pmin, pmax, points)
for i in range(points):
dissolved[:, i] = self.calculate_dissolved_volatiles(
pressure=pressure[i], X_fluid=(isopleth, 1-isopleth),
**kwargs)
isopleths_df = isopleths_df.append({
'XH2O_fl': [isopleth, 1-isopleth][H2O_id],
'H2O_liq': dissolved[H2O_id, i],
'CO2_liq': dissolved[CO2_id, i]}, ignore_index=True)
pressure=pressures[i], X_fluid=(isopleth, 1-isopleth), **kwargs)
row_df = pd.DataFrame({
'XH2O_fl': [[isopleth, 1-isopleth][H2O_id]],
'H2O_liq': [dissolved[H2O_id, i]],
'CO2_liq': [dissolved[CO2_id, i]]
})
isopleth_dfs.append(row_df)
isopleths.append(dissolved)

# Concatenate all DataFrames for isopleths
isopleths_df = pd.concat(isopleth_dfs, ignore_index=True)

if return_dfs:
if has_isopleths:
return (isobars_df, isopleths_df)
Expand Down
Binary file removed dist/VESIcal-1.2.5.tar.gz
Binary file not shown.
Binary file not shown.
Binary file added dist/VESIcal-1.2.6.tar.gz
Binary file not shown.
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy==1.23
scipy==1.8.1
numpy==1.26.3
scipy==1.11.4
sympy==1.9
pandas==1.2.3
matplotlib==3.4.3
openpyxl>=1.1.0
pandas==2.1.4
matplotlib==3.8.2
openpyxl==3.1.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="VESIcal",
version="1.2.5",
version="1.2.6",
author="Kayla Iacovino, Simon Matthews, Penny Wieser",
author_email="[email protected]",
description=("A generalized python library for calculating and plotting various things "
Expand Down

0 comments on commit 1a175be

Please sign in to comment.