SimonEnsemble/PorousMaterials.jl

`fit_adsorption_isotherm` attempts to mutate our dataframe we pass in

Closed this issue · 1 comments

fit_adsorption_isotherm(xe_isotherms[mof], common_pressure_units, common_loading_units, :langmuir) results in:

ArgumentError: CSV.Column is read-only; to get a mutable vector, do `copy(col)` or to make all columns mutable do `CSV.read(file; copycols=true)` or `CSV.File(file) |> DataFrame`

I think it is dangerous to mutate the dataframe inside the function. @Surluson could you please address this with a PR? Please show @ngantzler how you fixed it so he can learn some Julia stuff. Thanks!

Good point!
I looked into it and the sort! function was trying to change the DataFrame (The ! indicates the input argument is changed within the function).
It's an easy fix, just changed sort! to _df = sort and used _df in the following function calls

#121 should fix this.
The reason this was overlooked was because I assumed the DataFrame in misc_tests.jl was mutable (bad decision!) so I've also changed that.