-
Notifications
You must be signed in to change notification settings - Fork 24
1. Getting started
The aims of this section are
- How to install Python using the Anaconda or Miniconda distributions.
- How to install GrainSizeTools.
- How to use Python with tools like Jupyter Notebook or JupyterLab.
- How to interact with the script and import data.
TODO
Once Python is installed, the next step is to download GrainSizeTools. Click on the download link below (there is also a direct link on the website).
https://github.com/marcoalopez/GrainSizeTools/releases
and download the latest version of the script by clicking on the zip file as shown below
TODO-> figure
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.
TODO
To improve the reproducibility of studies working with grain size populations, we suggest that the user works from the Jupyter Notebooks templates provided by the script, especially if you have no previous experience with the Python language. To do this, it is necessary to open the notebooks either through the Jupyter Notebooks application or through JupyterLab.
Briefly, JupyterLab (or Jupyter Notebook) (Fig. 2) provides an easy-to-use data science environment that allows you to create and share documents that may contain live code, equations, visualizations and narrative text. This is also ideal for generating reports and including them as supplementary material in your publications, so that any researcher can reproduce your data. JupyterLab is just the next generation of the “classic” Jupyter Notebook so you can use either one interchangeably (Fig. X).
Figure X. The JupyterLab development environment is an interactive data science environment that allows creating documents mixing code, equations (using Latex), visualizations and narrative text.
TODO
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 as 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 Python file is executed directly from the Jupyter Notebook templates. -
averages.py
: This module contains a set of functions for calculating different types of averages and margins of error. -
plot.py
: This module contains a set of functions for generating different types of ad hoc plots used by the script. -
stereology.py
: This module contains a set of functions to approximate true grain size distributions from sectional measurements using stereological methods. -
piezometric_database.py
: This file contains the database of piezometers the script uses. -
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.
The way we propose to import the data to be analysed by the script is to use Pandas, which is the de facto standard Python library for data analysis and manipulation of tabular data (including CSV, Excel or text files). The library includes several tools for reading files and handling missing data. Once the GrainSizeTools script is run, all the Pandas methods are imported as pd
and available once you write in a cell pd.
. TODO
TODO
Tip
Although you can use the get_filepath()
function to get a file path through a file selection window as follows
>>> filepath = get_filepath()
for reproducibility it is best to specify the file path explicitly in the notebook.