Meeting: Python or spreadsheet?

Hello ,

You can come in now. We've just started. We'd like to know which tool we're going to use to calculate permeability. So far, we've been doing the calculations on a spreadsheet. But a young student trainee told us about Python, which has the advantage of being free. We're testing both solutions.

MéthodeFaire une régression linéaire sur Python

Here's a quick guide to linear regression in Python. We'll be using the Anaconda platform, which you can download free of charge. The platform features the Python language, an environment with numerous scientific libraries and various editors. Here, I'll be using Notebok jupyter notebooks, which allow you to combine text fields, lines of code and code results. You can use these notebooks very easily: as easily or even more easily than a calculator!

1
import numpy as np
2
import matplotlib.pyplot as plt
3
mu=0.001
4
PTM=np.array([1e4,2e4,3e4,4e4])
5
J=np.array([2e-6,4e-6,6e-6,7e-6])
6
plt.plot(PTM,J,'x')
7
fit=np.polyfit(PTM,J,1)
8
plt.plot (PTM, fit[0]*PTM+fit[1], 'r--')
9
print(fit)
10
pente=fit[0]
11
Rm=1/(mu*pente)
12
print('Rm=',Rm)

MéthodeFaire une régression linéaire sur un tableur

Here's a quick overview of how to perform linear regression on a spreadsheet program on LibreOffice, which you can download free of charge onto your computer.

ConseilQue choisir ?

We can now discuss which choice to make. The Spreadsheet demo took 5 min and the Python demo took 7 min. Time advantage for the spreadsheet. Now I also have the impression that the Python demo was slower, as it was necessary to introduce less familiar concepts. Once the appropriation phase is over, the time needed to carry out the regression should be similar. Now let's take a look at the final rendering. In both cases, we didn't try to improve the form: we should have added units, legends and titles to the graphs...

In the end, the table shows all the values but hides the formulas used in the cells, for example to calculate Rm. This makes it more difficult to check the calculations and find any errors.

What's particularly nice about Python is that, in the end (in just 10 lines here), you have all the calculations right in front of you. This is particularly useful for finding errors and checking your calculations.

Well, what do you think  ?

It seems to us that on these last arguments, it would be a good idea to choose the Python suite. We know that you, like me, make mistakes, and being able to find them quickly is a point that can save us an enormous amount of time and therefore money!