|
| 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 | +|  |  | |
| 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 | +``` |
0 commit comments