Skip to content

Commit

Permalink
fixing typos
Browse files Browse the repository at this point in the history
tutorials #1 to 10
  • Loading branch information
MohammadMehrnia787 committed Nov 23, 2023
1 parent 1777992 commit a905ae1
Show file tree
Hide file tree
Showing 9 changed files with 70,449 additions and 70,455 deletions.
8 changes: 4 additions & 4 deletions examples/tutorials/01_numerical_python_primer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@
"metadata": {},
"source": [
"```{seealso}\n",
"There are many resources for learning and understaning Numpy arrays, such as the [official numpy user guide](https://numpy.org/doc/stable/user/index.html#user) and this fun [illustrated guide](https://betterprogramming.pub/numpy-illustrated-the-visual-guide-to-numpy-3b1d4976de1d).\n",
"There are many resources for learning and understanding Numpy arrays, such as the [official numpy user guide](https://numpy.org/doc/stable/user/index.html#user) and this fun [illustrated guide](https://betterprogramming.pub/numpy-illustrated-the-visual-guide-to-numpy-3b1d4976de1d).\n",
"```"
]
},
Expand Down Expand Up @@ -308,7 +308,7 @@
"id": "dfa588e4",
"metadata": {},
"source": [
"This is an example of the 'mini-language' that you needs to learn, since ``arange`` is the Numpy version of ``range``. The Numpy package has hundreds of functions available, and to be proficient with Numpy you need to at least be aware of most of them. You can see a list by typing ``dir(np)``. "
"This is an example of the 'mini-language' that you need to learn, since ``arange`` is the Numpy version of ``range``. The Numpy package has hundreds of functions available, and to be proficient with Numpy you need to at least be aware of most of them. You can see a list by typing ``dir(np)``. "
]
},
{
Expand Down Expand Up @@ -959,7 +959,7 @@
"source": [
"In the above cell block the statement within the ``try`` block raises and exception, which is caught in the ``except`` block, and the error message is printed indicating clearly what the problem is.\n",
"\n",
"We can implememnt this behavior in our ``NewDict`` class above as follows:"
"We can implement this behavior in our ``NewDict`` class above as follows:"
]
},
{
Expand Down Expand Up @@ -1135,7 +1135,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
2 changes: 1 addition & 1 deletion examples/tutorials/03_data_and_topology_storage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@
"source": [
"## ``conduit`` data\n",
"\n",
"A *conduit* in OpenPNM refers to a 'pore-throat-pore' connection, where the pores and throats are each called *elements*. These *elements* act as resistors (or conductors) in series. Each *conduit* therefor contains exactly 1 throat and 2 pores. Transport within the network occurs via these interconnected *conduits*, so the geometric properties of these elements are often need for computing things like diffusive conductance. This is common enough that OpenPNM V3 includes a new helper function for obtaining this data, as illustrated below:"
"A *conduit* in OpenPNM refers to a 'pore-throat-pore' connection, where the pores and throats are each called *elements*. These *elements* act as resistors (or conductors) in series. Each *conduit* therefor contains exactly 1 throat and 2 pores. Transport within the network occurs via these interconnected *conduits*, so the geometric properties of these elements are often needed for computing things like diffusive conductance. This is common enough that OpenPNM V3 includes a new helper function for obtaining this data, as illustrated below:"
]
},
{
Expand Down
20 changes: 10 additions & 10 deletions examples/tutorials/04_graph_queries_and_manipulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"# Network Representation, Queries, and Manipulation\n",
"\n",
"To understand how to query and manipulate the network, we'll first cover the various forms of network representation. Specifically, OpenPNM uses an adjacency matrix to represent topology, but occassionally invokes the incidence matrix since this makes it easier for some queries. "
"To understand how to query and manipulate the network, we'll first cover the various forms of network representation. Specifically, OpenPNM uses an adjacency matrix to represent topology, but occasionally invokes the incidence matrix since this makes it easier for some queries. "
]
},
{
Expand Down Expand Up @@ -77,7 +77,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The adjacency matrix can also be plotted as a image for a helpful visualization:"
"The adjacency matrix can also be plotted as an image for a helpful visualization:"
]
},
{
Expand Down Expand Up @@ -109,7 +109,7 @@
"source": [
"There are a few notable features to point out:\n",
"* The matrix is symmetrical, since pore `i` connects to `j` and `j` connects to `i`\n",
"* Each row contains only a few entries since a given pores only has a few neighbors. It may not be obvious above since the network is small, but as the network grows to millions of pores, each pore only has on the order of 10 neighbors.\n",
"* Each row contains only a few entries since a given pore only has a few neighbors. It may not be obvious above since the network is small, but as the network grows to millions of pores, each pore only has on the order of 10 neighbors.\n",
"* You can find which pores are neighbors of pore `i` by finding the locations on non-zeros in row `i` of the adjacency matrix\n",
"* No entries are found in the diagonal since this would indicate that a pore connects with itself which is not physically meaningful.\n",
"* Since each pair of pores is connected by a single throat then each nonzero entry in the matrix corresponds to a throat"
Expand Down Expand Up @@ -268,7 +268,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Another query we might wish to do is determine which throat connects which pair of pores. The \"Dictionary of Keys\" format is useful for this. It is basically the COO format, but the `(i, j)` values are used as the dictionary keys. This is helpful since dicionary lookups are actually quite fast thanks to some sophisticated data strutures used by python. Consider the following:"
"Another query we might wish to do is determine which throat connects which pair of pores. The \"Dictionary of Keys\" format is useful for this. It is basically the COO format, but the `(i, j)` values are used as the dictionary keys. This is helpful since dictionary lookups are actually quite fast thanks to some sophisticated data structures used by python. Consider the following:"
]
},
{
Expand Down Expand Up @@ -377,7 +377,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's start by finding all pores on the 'left' and 'bottom'. These labels are predefined on `Cubic` networks, and we we cn use the `pores` method to find all pores with these labels:"
"Let's start by finding all pores on the 'left' and 'bottom'. These labels are predefined on `Cubic` networks, and we can use the `pores` method to find all pores with these labels:"
]
},
{
Expand Down Expand Up @@ -511,7 +511,7 @@
"source": [
"`mode='xor' finds all pores with exactly one connection to the input pores\n",
"\n",
"Given a set of pores find the pores that are neighbors of one and only one of the input pores. This is called **XOR**, or 'exclusve_or' because it finds the pores that are neigbhors to the 'bottom' *or* the 'left', but *not* both. "
"Given a set of pores find the pores that are neighbors of one and only one of the input pores. This is called **XOR**, or 'exclusive_or' because it finds the pores that are neigbhors to the 'bottom' *or* the 'left', but *not* both. "
]
},
{
Expand Down Expand Up @@ -575,7 +575,7 @@
"source": [
"`mode='xnor'` finds all the pores with 2 or more connections to the input pores\n",
"\n",
"This finds pores that are common to both 'left' and 'bottom' pores. It is called **XNOR** since it is the opposite of **XOR** , incidated by the *N for not* . Note that **XNOR** and **NXOR** are interchangable."
"This finds pores that are common to both 'left' and 'bottom' pores. It is called **XNOR** since it is the opposite of **XOR** , indicated by the *N for not* . Note that **XNOR** and **NXOR** are interchangeable."
]
},
{
Expand Down Expand Up @@ -980,7 +980,7 @@
"source": [
"## Removing Throats\n",
"\n",
"Removing throats may be useful for a number of reasons such as making a cubic network more heterogeneous, or to study the effect of blockages on flow. Throat deletion is actualy trivial and requires simply removing the row(s) corresponding to the to-be deleted throats from all throat arrays. For instance, let's manually delete throats `0` and `3`:"
"Removing throats may be useful for a number of reasons such as making a cubic network more heterogeneous, or to study the effect of blockages on flow. Throat deletion is actually trivial and requires simply removing the row(s) corresponding to the to-be deleted throats from all throat arrays. For instance, let's manually delete throats `0` and `3`:"
]
},
{
Expand Down Expand Up @@ -1147,7 +1147,7 @@
"Removing pores is *almost* as easy as removing throats, with **two significant complications**. \n",
"\n",
"1. When a pore is removed, the values in the `'throat.conns'` array must be updated. If pore 2 is removed, the pore 3 becomes the new pore 2. This means that any throats which were pointing to pore 3 (i.e. [1, 3]) must now be updated to point to pore 2 instead (i.e. [1, 2]). This can be done manually as shown below, but OpenPNM's `trim` function should be used.\n",
"2. A throat cannot point to nothing, so when a pore is deleted, all of it's neighboring throats must also be deleted.\n",
"2. A throat cannot point to nothing, so when a pore is deleted, all of its neighboring throats must also be deleted.\n",
"\n",
"First we'll see how to do this manually, then we'll demonstrate the `trim` function, this time for pores."
]
Expand Down Expand Up @@ -1566,7 +1566,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.13"
},
"toc": {
"base_numbering": 1,
Expand Down
24 changes: 12 additions & 12 deletions examples/tutorials/05_defining_geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
"source": [
"# Assigning Geometric Properties\n",
"\n",
"Geometric properties refer to the physical sizes of the pores and throats, such as pore diameter and throat lengths. The values are essential to the pore network modeling enterprize since they control all the transport and percolation behavior of the network. Unlike phase properties which can be normalized for, geometric properties define the network even more so than topological properties like connectivity. \n",
"Geometric properties refer to the physical sizes of the pores and throats, such as pore diameter and throat lengths. The values are essential to the pore network modeling enterprize since they control all the transport and percolation behavior of the network. Unlike phase properties which can be normalized for, geometric properties define the network even more than topological properties like connectivity. \n",
"\n",
"Geometric properties *can* be calculated by various means, ranging from assigning random values to pores, extracting values from tomographic images. OpenPNM provides a library of functions, or 'pore-scale models' which can calcuate these geometric properties automatically. This tutorial will cover the following subjects:\n",
"Geometric properties *can* be calculated by various means, ranging from assigning random values to pores, to extracting values from tomographic images. OpenPNM provides a library of functions, or 'pore-scale models' which can calculate these geometric properties automatically. This tutorial will cover the following subjects:\n",
"\n",
"- Manually Calculating Pore and Throat Properties (⚠ Not Recommended!) \n",
"- Using Pore-scale Models from the Library \n",
Expand Down Expand Up @@ -38,7 +38,7 @@
"id": "f63bbaee",
"metadata": {},
"source": [
"Let's start by creating a blank Cubic network. As we can see by printing it, there only coordinates, connections, and some labels, but no geometric properties:"
"Let's start by creating a blank Cubic network. As we can see by printing it, there are only coordinates, connections, and some labels, but no geometric properties:"
]
},
{
Expand Down Expand Up @@ -109,7 +109,7 @@
"\n",
"```{warning} **Manual Calculation is Not Recommended**\n",
"\n",
" This is *not* the preferred way to do things, but does illustrate the processes very well. The preferred way is using pore-scale models, which allow for the automatic regeneration of dependent properities when something changes. \n",
" This is *not* the preferred way to do things, but does illustrate the processes very well. The preferred way is using pore-scale models, which allow for the automatic regeneration of dependent properties when something changes. \n",
" \n",
"```\n",
"\n",
Expand Down Expand Up @@ -325,7 +325,7 @@
"source": [
"```{tip}\n",
"\n",
" **Indexing pore properties by conns:** Using the `conns` array to index into a pore property returns an Nt-by-2 array with the properties of the pores on the end of a throat in each column. For instance, so see the diameter of the pore on each end of a throat, use `pn['pore.diameter'][pn.conns]`. This approach is very powerful. If you ever feel tempted to use a for-loop to scan over each pore, then inspect the properties of the neighboring throats, consider instead if you can \"loop\" over the throats then interogate each pore. If yes, then you can use this conns-indexing trick.\n",
" **Indexing pore properties by conns:** Using the `conns` array to index into a pore property returns an Nt-by-2 array with the properties of the pores on the end of a throat in each column. For instance, see the diameter of the pore on each end of a throat, use `pn['pore.diameter'][pn.conns]`. This approach is very powerful. If you ever feel tempted to use a for-loop to scan over each pore, then inspect the properties of the neighboring throats, consider instead if you can \"loop\" over the throats then interrogate each pore. If yes, then you can use this conns-indexing trick.\n",
" \n",
"```"
]
Expand Down Expand Up @@ -431,7 +431,7 @@
"metadata": {},
"source": [
"```{tip}\n",
" Setting the `lo` and `hi` values of the the seeds prevents values that lie far out in the tail of a distribution from occurring which can lead to overly large pores or throats.\n",
" Setting the `lo` and `hi` values of the seeds prevents values that lie far out in the tail of a distribution from occurring which can lead to overly large pores or throats.\n",
"```"
]
},
Expand Down Expand Up @@ -570,7 +570,7 @@
"The above cell contains 3 complicated but powerful steps:\n",
"1. The radii of the pores on each end of each throat are retrieved. `R1` and `R2` contain duplicates since each pore has numerous throats, so they appear once for each throat. This fact is used in step 3.\n",
"2. The pore-to-pore distance is found by retrieving the coordinates of each pore, in the same was as was done for the radii. The Euclidean distance between each pair of pores is then computed by finding their difference (`np.diff`), squaring it, summing it (`np.sum`), then taking the square root (`np.sqrt`) of each. The `axis` argument is used throughout to tell numpy which way to apply the operation. This line is an example of how you must learn a *mini-language* to use numpy effectively. \n",
"3. The length of each throat is found as the spacing between pores, less the radii the pore on each end. This is where the duplicate values in `R1` and `R2` are necessary, since the radii of pore *i* must be subtracted from length of each of it's neighboring throats.\n",
"3. The length of each throat is found as the spacing between pores, less the radii of the pore on each end. This is where the duplicate values in `R1` and `R2` are necessary, since the radii of pore *i* must be subtracted from length of each of its neighboring throats.\n",
"\n",
"The main take-home message here is that throat properties can be computed in a vectorized way, even if some pore-properties are required. This avoids the use of a for-loop to scan through a list of throats followed by a nested for-loop to scan through each neighboring pore."
]
Expand Down Expand Up @@ -614,7 +614,7 @@
"source": [
"The above cell contains 2 lines of importance, which each do almost the same thing:\n",
"1. The first line subtracts the throat cross-sectional area from each pore listed in the first column of the `pn.conns` array. Since a given pore is connected to potentially many throats, the subtraction must be done using `np.substract.at` which is a special version of the subtract function that subtracts every value in `At` from the locations in `SAp` indicated by `pn.conn[:, 0]`, and it does so in a cumulative fashion. Thus if pore *i* appears in `pn.conns[:, 0]` more than once, then more than one value of `At` is removed. The operation is performed *in-place* so that no array is returned.\n",
"2. Recall that `pn.conns` contains only the upper-triangular entries of the adjacency matrix, so this process only gets half of the connections. This means that the pore connectioned found in `pn.conns[:, 1]` must also be analyzed."
"2. Recall that `pn.conns` contains only the upper-triangular entries of the adjacency matrix, so this process only gets half of the connections. This means that the pore connections found in `pn.conns[:, 1]` must also be analyzed."
]
},
{
Expand Down Expand Up @@ -877,7 +877,7 @@
"source": [
"## Using Predefined Collections of Models\n",
"\n",
"The process of selecting all the correct models from the `models` library can be tedious and error prone. In OpenPNM V3 we have introduced the concept of model *collections*, which are predfined dictionaries of models that form a complete and correct geometry. For instance, there is a collection called `spheres_and_cylinders`, which contains all the needed models to describe this geometry. \n",
"The process of selecting all the correct models from the `models` library can be tedious and error prone. In OpenPNM V3 we have introduced the concept of model *collections*, which are predefined dictionaries of models that form a complete and correct geometry. For instance, there is a collection called `spheres_and_cylinders`, which contains all the needed models to describe this geometry. \n",
"\n",
"These collections are found under `openpnm.models.collections`, and their use is outlined below:"
]
Expand Down Expand Up @@ -1225,7 +1225,7 @@
"source": [
"## Introduction to the Dependency Handler\n",
"\n",
"Pore-scale models clearly make life easier since you don't have to produce the complex numpy functions by hand each time, but this is not even their best feature! The main benefit of pore-scale models is that they can be *recomputed* automatically. For instance, if we re-run the `'pore.seed'` model, then all the other models that depend on `'pore.seed'` will automatically be reomcomputed as well. This all occurs when we call `regenerate_models`, as demonstrated below:"
"Pore-scale models clearly make life easier since you don't have to produce the complex numpy functions by hand each time, but this is not even their best feature! The main benefit of pore-scale models is that they can be *recomputed* automatically. For instance, if we re-run the `'pore.seed'` model, then all the other models that depend on `'pore.seed'` will automatically be recomputed as well. This all occurs when we call `regenerate_models`, as demonstrated below:"
]
},
{
Expand Down Expand Up @@ -1292,7 +1292,7 @@
"id": "8ed8615a",
"metadata": {},
"source": [
"As we can see above the initial values of `'pore.seed'` and `'throat.diameter'` are both changed after calling `regenerate_models()`. OpenPNM does this automaticall by inspecting the arguments to each function. \n",
"As we can see above the initial values of `'pore.seed'` and `'throat.diameter'` are both changed after calling `regenerate_models()`. OpenPNM does this automatically by inspecting the arguments to each function. \n",
"\n",
"Inspecting the `add_model` calls above we can see:\n",
"\n",
Expand Down Expand Up @@ -1382,7 +1382,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit a905ae1

Please sign in to comment.