k-a-mendoza / Pyrrhenius

A python package for modeling mineral electric conductivity
MIT License
1 stars 0 forks source link

Suggest moving data manipulation functions to a separate module and add method to Database class to execute arbitrary functions on the dataframes. #2

Open sgjholt opened 2 months ago

sgjholt commented 2 months ago

I suggest moving this into a separate module, which could be expanded for different kinds of physical data manipulation/processing transformations.

def calc_average_pressure(row):
    if pd.isna(row['pressure_average_gpa']):
        return (row['pressure_min_gpa'] + row['pressure_max_gpa']) / 2
    return row['pressure_average_gpa']

It would be nice to add a method to the Database module that can take and execute arbitrary functions from this module, to apply various physical data transformations as required. I believe this separation will be better for collaboration. A developer could come in with their own arbitrary data transformations, which may be required for whatever source data they have.

k-a-mendoza commented 2 months ago

Oh you found a legacy function. I forgot why I even put it there. As it stands, the database is treated as an object database, useful for accessing electrical conduction models. But I see your point. It could be useful to make a Pyrrhenius compositional database.