|
1 | 1 | --- |
2 | | -title: "Using Scientific Python Libraries (NumPy, Pandas and more)" |
| 2 | +title: "Using Scientific Python Packages (NumPy, Pandas and more)" |
3 | 3 | teaching: 30 |
4 | 4 | exercises: 0 |
5 | 5 | --- |
@@ -193,7 +193,7 @@ Most modern processors are able to apply one instruction across multiple variabl |
193 | 193 | If we were to use a regular `for` loop, the time to perform this operation would increase with the length of the array. |
194 | 194 | However, using NumPy broadcasting we can apply the addition to 1, 10 or 100 elements, all in the same amount of time! |
195 | 195 |
|
196 | | -Earlier in this episode it was demonstrated that using core Python methods over a list will outperform a loop, performing the same calculation faster. The below example takes this a step further by demonstrating the calculation of a dot product. |
| 196 | +Earlier it was demonstrated that using core Python methods over a list will outperform a loop, performing the same calculation faster. The below example takes this a step further by demonstrating the calculation of a dot product. |
197 | 197 |
|
198 | 198 | <!-- Inspired by High Performance Python Chapter 6 example |
199 | 199 | Added Python sum array, skipped a couple of others--> |
@@ -268,7 +268,7 @@ These libraries could be specific to your area of research; but they could also |
268 | 268 | ::::::::::::::::::::::::::::::::::::::::::::::: |
269 | 269 |
|
270 | 270 |
|
271 | | -Which libraries you may use will depend on your research domain; here, we'll show two examples from our own experience. |
| 271 | +Which libraries you may use will depend on your research domain; here, we'll show an example from bioinformatics. |
272 | 272 |
|
273 | 273 | ### Example: Image Analysis with Shapely |
274 | 274 |
|
@@ -304,7 +304,7 @@ points_per_polygon = {} |
304 | 304 | for polygon_idx in range(n_polygons): |
305 | 305 | current_polygon = polygons.iloc[polygon_idx,:]["geometry"] |
306 | 306 |
|
307 | | - # vectorised: apply `contains` to an array of points at once |
| 307 | + # vectorised: apply `contains` to an array of points, rather than an individual point |
308 | 308 | points_in_polygon_idx = current_polygon.contains(points_array) |
309 | 309 | points_in_polygon = point_names_array[points_in_polygon_idx] |
310 | 310 |
|
|
0 commit comments