Skip to content

Commit 97b8eef

Browse files
committed
Break up getting_started into individual parts for easier digestion
1 parent a5eb56e commit 97b8eef

File tree

6 files changed

+156
-12
lines changed

6 files changed

+156
-12
lines changed

docs/source/advanced_usage.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Advanced Usage
2+
3+
Alternatively, you can use the individual functions in BEaTmap to perform BET analysis and evaluate the Rouquerol criteria. This allows the user to access more of BEaTmap's functionality, and to customize the analysis.
4+
5+
## Import the dataset
6+
7+
The `import_data` function can be used to import a isotherm data from a .csv file where the first column is relative pressure and the second column is the amount adsorbed.
8+
9+
The function returns a named tuple where the first entry is a dataframe of the imported isotherm, and the 2nd-4th fields are the cross sectional area of the adsorbate, information about the data, and file path, respectively. Indexing of named tuple elements is in order of priority, data used by other function are given priority.
10+
11+
``` python
12+
import beatmap as bt
13+
import matplotlib.pylot as plt
14+
15+
# The next line might break if you don't have the fixtures folder
16+
fpath = bt.utils.get_fixtures_path() / 'vulcan_chex.csv'
17+
isotherm_data = bt.io.import_data(file=fpath, info='chex on vulcan', a_o=39)
18+
```
19+
20+
## BET analysis
21+
22+
BET analysis is performed on every relative pressure range within the isotherm data by the `bet` function. The function accepts the dataframe of isotherm data, cross sectional area of the adsorbate, and information about the data (information stored in the named tuple created by the import_data function). Rather than pass individual parameters, this function can accept *isotherm_data (where isotherm_data is a named tuple output by a data import function).
23+
24+
The function returns a named tuple containing the results of BET analysis as well as information about the isotherm (raw data, file path, etc). Again, the indexing of named tuple elements is in order of priority, data used by other function are given priority.
25+
26+
```python
27+
bet_results = bt.core.bet(
28+
iso_df=isotherm_data.iso_df,
29+
a_o=isotherm_data.a_o,
30+
info=isotherm_data.info
31+
)
32+
```
33+
34+
## Rouquerol criteria
35+
36+
The Rouquerol criteria, used to mask out results of BET analysis for invalid relative pressure ranges are evaluated by the `rouq_mask` function. Rather than pass individual parameters, this function can accept `*bet_results` (where bet_results is a named tuple output by the bet function).
37+
38+
The function returns a named tuple containing a numpy mask array, and individual arrays corresponding to the results of each criterion.
39+
40+
41+
```python
42+
mask_results = bt.core.rouq_mask(
43+
intercept=bet_results.intercept,
44+
iso_df=bet_results.iso_df,
45+
nm=bet_results.nm,
46+
slope=bet_results.slope,
47+
enforce_y_intercept_positive=True,
48+
enforce_pressure_increasing=True,
49+
enforce_absorbed_amount=True,
50+
enforce_relative_pressure=True,
51+
enforce_enough_datapoints=True,
52+
min_num_points=5
53+
)
54+
```
55+
56+
## Supplementary analysis
57+
58+
The `bet_results` and `mask_results` can used to create a heatmap of specific surface area values for each relative pressure range. This visualization concept is the central idea of BEaTmap. The `ssa_heatmap` function requires the named tuples produced by the bet function and the rouq_mask function.
59+
60+
Other figures, such as a plot of experimental data and the model isotherm can be created in this manner. See the documentation for a full summary of figures.
61+
62+
```python
63+
bt.vis.ssa_heatmap(bet_results, mask_results)
64+
bt.vis.iso_combo_plot(bet_results, mask_results, save_file=True)
65+
```
66+
67+
| Specific Surface Area Heatmap | Model Isotherm vs. Experimental Data |
68+
| --- | --- |
69+
| ![](https://github.com/PMEAL/beatmap/assets/14086031/f785b6e4-3df4-4fa6-a6e6-b2bd2da92f96) | ![](https://github.com/PMEAL/beatmap/assets/14086031/33efdd0d-9992-4aed-888e-6e7e401037b0) |
70+
71+
## Export the results
72+
73+
It might be desireable to have a spreadsheet that contains all results of BET analysis and the Rouquerol criteria. This sheet can be created and saved in the parent directory with the `export_processed_data` function.
74+
75+
```python
76+
bt.io.export_processed_data(bet_results)
77+
```

docs/source/basic_usage.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Basic Usage
2+
3+
An "envelope" function, that will import data, perform BET analysis, evaluate the Rouquerol criteria, and produce all figures for the user has been built. The file path, information about the data (later used for naming exported files), and the adsorbate cross sectional area in square Angstrom need to be specified. It allows the user to access much of BEaTmap's functionality in one line.
4+
5+
```python
6+
import beatmap as bt
7+
import matplotlib.pylot as plt
8+
9+
# The next line might break if you don't have the fixtures folder
10+
fpath = bt.utils.get_fixtures_path() / 'vulcan_chex.csv'
11+
12+
rouq_criteria = {
13+
"enforce_y_intercept_positive": True,
14+
"enforce_pressure_increasing": True,
15+
"enforce_absorbed_amount": True,
16+
"enforce_relative_pressure": True,
17+
"enforce_enough_datapoints": True,
18+
"min_num_points": 5
19+
}
20+
21+
aux_params = {
22+
"save_figures": True,
23+
"export_data": False,
24+
"ssa_gradient": "Greens",
25+
"err_gradient": "Greys"
26+
}
27+
28+
results = bt.run_beatmap(
29+
file=fpath,
30+
info="chex on vulcan"
31+
a_o=39,
32+
ssa_criterion="error",
33+
**rouq_criteria,
34+
**aux_params
35+
)
36+
```

docs/source/getting_started.rst

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@ Contents
3636
########
3737

3838
.. toctree::
39-
:maxdepth: 1
39+
:maxdepth: 1
4040

41-
getting_started.rst
42-
streamlit.rst
43-
modules/index.rst
41+
installation.md
42+
user_guide.rst
43+
streamlit.rst
44+
modules/index.rst

docs/source/installation.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Installation
2+
3+
BEaTmap depends heavily on the Scipy Stack. The best way to get a fully functioning environment is to install the [Anaconda Python distribution](https://www.anaconda.com/download/). Be sure to get the **Python 3.9+ version**.
4+
5+
Once you've installed the Anaconda distribution (or the Python distribution of your choice), type and enter the following in a terminal (on Unix-based machines) or a command prompt (on Windows):
6+
7+
pip install beatmap
8+
9+
Note that on Unix-based machines, `conda` is usually automatically initialized in the terminal. On Windows, you should have a shortcut to the "Anaconda Prompt" in the start menu, which is basically a command prompt initialized with `conda`.
10+
11+
Once initialized, the terminal points to the `base` environment. While you can install BEaTmap in the `base` environment, it is recommended that you create a new environment to avoid accidentally breaking your `base` environment.
12+
13+
If you think you may be interested in contributing to BEaTmap and wish to both *use* and *edit* the source code, then you should clone the [repository](https://github.com/PMEAL/beatmap) to your local machine, and install it using the following `pip` command:
14+
15+
pip install -e path/to/beatmap/root/folder
16+
17+
For information about contributing, refer to the [contributors guide](https://github.com/PMEAL/beatmap/blob/main/CONTRIBUTING.md).

docs/source/user_guide.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.. _user_guide:
2+
3+
User Guide
4+
##########
5+
6+
You can either use BEaTmap's "envelope" function that will automatically
7+
execute the whole process of a BET analysis and returns the results in form
8+
of informative plots and tables, or you can call the individual functions
9+
yourself. The latter is useful if you want more control over the process
10+
and possibly want to use the results for further analysis.
11+
12+
If you prefer to go through this guide in the IPython notebook format,
13+
there's on in the GitHub repository. Click
14+
`here <https://github.com/PMEAL/beatmap/blob/main/examples/example.ipynb>`_
15+
to view the notebook.
16+
17+
.. toctree::
18+
:maxdepth: 1
19+
20+
basic_usage.md
21+
advanced_usage.md

0 commit comments

Comments
 (0)