Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running calculations on a single sample #7

Open
kaylai opened this issue Mar 26, 2024 · 1 comment
Open

Running calculations on a single sample #7

kaylai opened this issue Mar 26, 2024 · 1 comment

Comments

@kaylai
Copy link

kaylai commented Mar 26, 2024

Is it possible to run a calculation on a single sample rather than a pandas dataframe? I'd like to use PySulfSat in some code I am working on, in which an SCSS calculation is called periodically by other routines. Unless I am mistaken, the current implementation of PySulfSat would require that I put my sample composition into an appropriately styled pandas dataframe each time I want to do an SCSS calculation, which is a bit cumbersome. Is there a current implementation for single samples that I missed?

If the answer is that you must use a dataframe, is there a danger or loss of functionality passing in a self-made dataframe rather than importing a file (e.g., does the import of a file create an object that has other attributes)?

@PennyWieser
Copy link
Owner

That isnt supported at present - I used dataframes because at the time of making I was more focused on applying it to 1000s of rows of data vs. a single composition as needed for a degassing model.

The most straightforward thing to do for now would be to pass it into the dataframe format I use. If this creates a significant speed penalty I can try to edit the code.

The import function is called import_dataframe and is in the import_data.py file.

The code uses these columns (which can be filled with 0s if not present).

df_ideal_liq = pd.DataFrame(columns=['SiO2_Liq', 'TiO2_Liq', 'Al2O3_Liq',
'FeOt_Liq', 'MnO_Liq', 'MgO_Liq', 'CaO_Liq', 'Na2O_Liq', 'K2O_Liq',
'P2O5_Liq', 'H2O_Liq', 'Fe3Fet_Liq', 'Ni_Liq_ppm', 'Cu_Liq_ppm'])

Not all the models use all these columns.

Any other columns are kept but ignored. At present the output is appended onto the input dataframe, but that would be an easy fix to have an option to return a pandas.Series or even just a float if you wanted that instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants