Skip to content

Commit

Permalink
Update getting started_src.md
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoalopez committed Feb 16, 2024
1 parent b3e1684 commit ba1e99c
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions DOCS/getting started_src.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,26 @@ The aims of this section are

## Step 1. Install Python for data science

TODO
GrainSizeTools requires Python 3 and the Python scientific libraries [NumPy](http://www.numpy.org/ ) [SciPy](http://www.scipy.org/ ), [Pandas](http://pandas.pydata.org ), [Matplotlib](http://matplotlib.org/ ), and JupyterLab. If you have no previous experience with Python, I recommend downloading and installing the Anaconda Python distribution

https://docs.anaconda.com/free/anaconda/install/

as it contains all the necessary scientific packages (> 5 GB disc space). There are versions for Windows, MacOS and Linux. If you have limited disk space, there is a distribution called [Miniconda](https://docs.conda.io/projects/miniconda/en/latest/) which installs only the Python packages you really need. If you prefer this option, click [here](https://github.com/marcoalopez/Python_course/blob/main/notebooks/installing_Python.md) for instructions.

Once Anaconda is installed, launch the Anaconda Navigator and you will see that you have installed several scientifically oriented Integrated Development Systems (IDEs), including **JupyterLab** and the **Jupyter Notebook**. Clicking on any of these IDEs will open the corresponding application in your web browser. The GrainSizeTools documentation is written assuming that you will be working in Jupyter Notebook.

> [!TIP]
> **Using a dedicated application to work with Jupyter notebooks**
>
> If you prefer to use a dedicated application instead of opening Jupyter notebooks in your browser, there are several free and paid alternatives. Here we will mention two free alternatives:
>
> - **Visual Studio Code** (a.k.a. vscode): https://code.visualstudio.com/
>
> This is a free code editor that can be used with a variety of programming languages including Python and supports Jupyter notebooks via extensions. As an advantage over vanilla Jupyter Lab, it has a handy variable browser. More detailed instructions on how to use Jupyter notebooks in vscode at the following link https://code.visualstudio.com/docs/datascience/jupyter-notebooks
>
> - **JupyterLab desktop**: https://github.com/jupyterlab/jupyterlab-desktop/releases
>
> This is a cross-platform desktop application for Jupyter Lab. It is exactly the same application that opens in the browser, but in an encapsulated application. You can find the user guide at the following link https://github.com/jupyterlab/jupyterlab-desktop/blob/master/user-guide.md
## Step 2. Download the GrainSizeTools

Expand All @@ -26,11 +45,11 @@ TODO-> figure

### Script organization

The GrainSizeTools folder contains the Python script code (several .py files) a folder named DATA, and various Jupyter notebooks (.ipynb files), which are templates for performing different types of grain size data analysis, either (i) quantifying grain size populations (apparent or real), (ii) performing stereological methods to approximate a true grain size distribution, or (iii) performing palaopiezometry using the GrainSizeTools database.
The GrainSizeTools folder contains various Python files (.py), a folder named DATA, and various Jupyter notebooks (.ipynb files), which are templates for performing different types of grain size data analysis.

TODO
TODO -> figure

## Step 3. How to open and work with Jupyter Notebooks
## Step 3. How to work with Jupyter Notebooks

To improve the reproducibility of the granulometric population studies, we suggest that the user works with the Jupyter Notebooks templates provided in the script, especially if he/she has no previous experience with the Python language. To do this, it is necessary to open the Jupyter notebooks through the application. We suggest JupyterLab or Vscode (see above), but you can also use others.

Expand All @@ -46,11 +65,17 @@ JupyterLab and VSCode with the Jupyter Notebook extension are the next generatio

*Figure X. The JupyterLab interface...TODO. More info: https://jupyterlab.readthedocs.io/en/latest/user/interface.html#the-jupyterlab-interface

Explaining how Jupyter notebooks work is beyond the scope of this documentation. Fortunately, there are very good tutorials available. To familiarize yourself with how Jupyter notebooks work, we recommend the following tutorials:

> https://www.youtube.com/watch?v=HW29067qVWk
>
> This is a video by Corey Schafer that explains in a very clear, entertaining and concise way how to install and use a Jupyter Notebook, the usage part starts at about 4 minutes. For the tutorial, Corey uses the classic Jupyter Notebook application instead of JupyterLab, but it works in a similar way.
TODO

## Understanding the script and the workflow
## Understanding the script structure and the workflow

The script is organised in a modular way using different Python files and functions, both of which are intended to help modify, reuse and extend the code if necessary. In short, the script consists of seven Python files that must be in the same directory. These are the Python files and their main function:
The script is organized in a modular way using different Python files and functions, both of which are intended to help modify, reuse and extend the code if necessary. In short, the script consists of seven Python files that must be in the same directory. These are the Python files and their main function:

- ``GrainSizeTools.py``: This file imports all the modules needed for the script to work. This is the only executed Python file in the Jupyter Notebook templates.
- ``averages.py``: This module contains a set of functions for calculating different types of averages and margins of error.
Expand All @@ -60,7 +85,7 @@ The script is organised in a modular way using different Python files and functi
- ``template.py``: This file contains the default (Matplotlib) parameters used by the script to generate plots.
- ``get.py``: This file contains the welcome message of the script.

For non-advanced users, we recommend the use of the Jupyter notebooks provided with the script. There are three different notebooks depending on the type of study you want to perform: (i) quantification of grain size distributions, (ii) approximation of grain size distributions using stereological methods, and (iii) paleopiezometry. These notebooks contain all the necessary instructions on how to use them through practical examples. The user will only has to change some parameters to adapt them to his practical case and delete everything that is not needed. Once this has been done, all the analyses are contained in a single, fully reproducible document that can be exported to other formats (pdf, html, etc.) if necessary. If you use this workflow, ideally you should copy the entire contents of the script (<<1 MB), i.e. the code and notebooks, for each study you conduct.
For non-advanced users, we recommend the use of the Jupyter notebooks provided with the script. There are three different notebooks depending on the type of study you want to perform: (i) quantification of grain size distributions, (ii) approximation of grain size distributions using stereological methods, and (iii) paleopiezometry. These notebooks contain all the necessary instructions on how to use them through practical examples. The user will only has to change some parameters to adapt them to his case and delete everything that is not needed. Once this has been done, all the analyses are contained in a single, fully reproducible document that can be exported to other formats (pdf, html, etc.) if necessary. If you use this workflow, ideally you should copy the entire contents of the script (<<1 MB), i.e. the code and notebooks, for each study you conduct.

## Importing data using the Pandas library

Expand Down

0 comments on commit ba1e99c

Please sign in to comment.