diff --git a/docs/_downloads/53dc65a717762d4693b891c0caabbde0/plot_StatArray.py b/docs/_downloads/53dc65a717762d4693b891c0caabbde0/plot_StatArray.py index c6db6e60..db18274b 100644 --- a/docs/_downloads/53dc65a717762d4693b891c0caabbde0/plot_StatArray.py +++ b/docs/_downloads/53dc65a717762d4693b891c0caabbde0/plot_StatArray.py @@ -60,9 +60,6 @@ assert isinstance(test, StatArray) and test.size == 10, TypeError("da 6") print(test.summary) - - - # The StatArray can take any numpy function that returns an array as an input. # The name and units of the variable can be assigned to the StatArray. diff --git a/docs/_downloads/6ea40b011244de987af10f1723709b1e/plot_StatArray.zip b/docs/_downloads/6ea40b011244de987af10f1723709b1e/plot_StatArray.zip index 3daf158c..d1a761b7 100644 Binary files a/docs/_downloads/6ea40b011244de987af10f1723709b1e/plot_StatArray.zip and b/docs/_downloads/6ea40b011244de987af10f1723709b1e/plot_StatArray.zip differ diff --git a/docs/_downloads/bc82bea3a5dd7bdba60b65220891d9e5/examples_python.zip b/docs/_downloads/bc82bea3a5dd7bdba60b65220891d9e5/examples_python.zip index 25f49d11..14356f81 100644 Binary files a/docs/_downloads/bc82bea3a5dd7bdba60b65220891d9e5/examples_python.zip and b/docs/_downloads/bc82bea3a5dd7bdba60b65220891d9e5/examples_python.zip differ diff --git a/docs/_downloads/fb625db3c50d423b1b7881136ffdeec8/examples_jupyter.zip b/docs/_downloads/fb625db3c50d423b1b7881136ffdeec8/examples_jupyter.zip index e9a56369..ddcca933 100644 Binary files a/docs/_downloads/fb625db3c50d423b1b7881136ffdeec8/examples_jupyter.zip and b/docs/_downloads/fb625db3c50d423b1b7881136ffdeec8/examples_jupyter.zip differ diff --git a/docs/_images/sphx_glr_plot_StatArray_002.png b/docs/_images/sphx_glr_plot_StatArray_002.png index 13f17625..9a034f3c 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_002.png and b/docs/_images/sphx_glr_plot_StatArray_002.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_003.png b/docs/_images/sphx_glr_plot_StatArray_003.png index 0205310d..919f4cd1 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_003.png and b/docs/_images/sphx_glr_plot_StatArray_003.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_004.png b/docs/_images/sphx_glr_plot_StatArray_004.png index 5090a06d..b32c1e48 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_004.png and b/docs/_images/sphx_glr_plot_StatArray_004.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_005.png b/docs/_images/sphx_glr_plot_StatArray_005.png index ab88115f..01fd756c 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_005.png and b/docs/_images/sphx_glr_plot_StatArray_005.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_006.png b/docs/_images/sphx_glr_plot_StatArray_006.png index ba14661c..138e8d9d 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_006.png and b/docs/_images/sphx_glr_plot_StatArray_006.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_007.png b/docs/_images/sphx_glr_plot_StatArray_007.png index d64f9d8e..b4293921 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_007.png and b/docs/_images/sphx_glr_plot_StatArray_007.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_008.png b/docs/_images/sphx_glr_plot_StatArray_008.png index f0556281..ecdb06fb 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_008.png and b/docs/_images/sphx_glr_plot_StatArray_008.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_009.png b/docs/_images/sphx_glr_plot_StatArray_009.png index 6c90f0ae..43c647c4 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_009.png and b/docs/_images/sphx_glr_plot_StatArray_009.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_010.png b/docs/_images/sphx_glr_plot_StatArray_010.png index 105486c6..9f05e38c 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_010.png and b/docs/_images/sphx_glr_plot_StatArray_010.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_011.png b/docs/_images/sphx_glr_plot_StatArray_011.png index 61b6f5e5..345cbd04 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_011.png and b/docs/_images/sphx_glr_plot_StatArray_011.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_012.png b/docs/_images/sphx_glr_plot_StatArray_012.png index e6894344..c6d1a6e1 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_012.png and b/docs/_images/sphx_glr_plot_StatArray_012.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_013.png b/docs/_images/sphx_glr_plot_StatArray_013.png index 57177ed8..8c361577 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_013.png and b/docs/_images/sphx_glr_plot_StatArray_013.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_014.png b/docs/_images/sphx_glr_plot_StatArray_014.png index a202f3bb..56b451a5 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_014.png and b/docs/_images/sphx_glr_plot_StatArray_014.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_015.png b/docs/_images/sphx_glr_plot_StatArray_015.png index 64396bab..86d6c434 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_015.png and b/docs/_images/sphx_glr_plot_StatArray_015.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_016.png b/docs/_images/sphx_glr_plot_StatArray_016.png index 40073be2..ee7e7280 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_016.png and b/docs/_images/sphx_glr_plot_StatArray_016.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_017.png b/docs/_images/sphx_glr_plot_StatArray_017.png index f9ea1eda..8c4333c7 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_017.png and b/docs/_images/sphx_glr_plot_StatArray_017.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_018.png b/docs/_images/sphx_glr_plot_StatArray_018.png index 35d4930a..f1c4015e 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_018.png and b/docs/_images/sphx_glr_plot_StatArray_018.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_019.png b/docs/_images/sphx_glr_plot_StatArray_019.png index d220780e..cc3796ad 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_019.png and b/docs/_images/sphx_glr_plot_StatArray_019.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_020.png b/docs/_images/sphx_glr_plot_StatArray_020.png index 519cbf4d..8605b0ad 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_020.png and b/docs/_images/sphx_glr_plot_StatArray_020.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_021.png b/docs/_images/sphx_glr_plot_StatArray_021.png index 764b33ad..04c09c22 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_021.png and b/docs/_images/sphx_glr_plot_StatArray_021.png differ diff --git a/docs/_images/sphx_glr_plot_StatArray_022.png b/docs/_images/sphx_glr_plot_StatArray_022.png index 992df639..bc627988 100644 Binary files a/docs/_images/sphx_glr_plot_StatArray_022.png and b/docs/_images/sphx_glr_plot_StatArray_022.png differ diff --git a/docs/_sources/content/api/classes/core/DataArray.rst.txt b/docs/_sources/content/api/classes/core/DataArray.rst.txt new file mode 100644 index 00000000..0dd7f5eb --- /dev/null +++ b/docs/_sources/content/api/classes/core/DataArray.rst.txt @@ -0,0 +1,10 @@ +DataArray +--------- + +.. inheritance-diagram:: geobipy.src.classes.core.DataArray.DataArray + :parts: 1 + +.. automodule:: geobipy.src.classes.core.DataArray + :members: + :undoc-members: + diff --git a/docs/_sources/content/api/classes/core/StatArray.rst.txt b/docs/_sources/content/api/classes/core/StatArray.rst.txt index 8ef3b391..45050972 100644 --- a/docs/_sources/content/api/classes/core/StatArray.rst.txt +++ b/docs/_sources/content/api/classes/core/StatArray.rst.txt @@ -1,10 +1,10 @@ StatArray --------- -.. inheritance-diagram:: geobipy.src.classes.core.StatArray.StatArray +.. inheritance-diagram:: geobipy.src.classes.core.DataArray.DataArray :parts: 1 -.. automodule:: geobipy.src.classes.core.StatArray +.. automodule:: geobipy.src.classes.core.DataArray :members: :undoc-members: diff --git a/docs/_sources/content/api/classes/core/core.rst.txt b/docs/_sources/content/api/classes/core/core.rst.txt index 18fffe5a..8342e0a4 100644 --- a/docs/_sources/content/api/classes/core/core.rst.txt +++ b/docs/_sources/content/api/classes/core/core.rst.txt @@ -5,5 +5,5 @@ Core classes :maxdepth: 1 myObject - StatArray + DataArray diff --git a/docs/_sources/content/api/classes/statistics/StatArray.rst.txt b/docs/_sources/content/api/classes/statistics/StatArray.rst.txt new file mode 100644 index 00000000..57ae7524 --- /dev/null +++ b/docs/_sources/content/api/classes/statistics/StatArray.rst.txt @@ -0,0 +1,10 @@ +StatArray +--------- + +.. inheritance-diagram:: geobipy.src.classes.statistics.StatArray.StatArray + :parts: 1 + +.. automodule:: geobipy.src.classes.statistics.StatArray + :members: + :undoc-members: + diff --git a/docs/_sources/content/api/classes/statistics/statistics.rst.txt b/docs/_sources/content/api/classes/statistics/statistics.rst.txt index 0966ed51..8acae1d1 100644 --- a/docs/_sources/content/api/classes/statistics/statistics.rst.txt +++ b/docs/_sources/content/api/classes/statistics/statistics.rst.txt @@ -4,6 +4,7 @@ Statistics classes .. toctree:: :maxdepth: 1 + StatArray Distribution Histogram baseDistribution diff --git a/docs/_sources/examples/Statistics/plot_StatArray.rst.txt b/docs/_sources/examples/Statistics/plot_StatArray.rst.txt index 30e50ab1..09f7cbe5 100644 --- a/docs/_sources/examples/Statistics/plot_StatArray.rst.txt +++ b/docs/_sources/examples/Statistics/plot_StatArray.rst.txt @@ -50,7 +50,7 @@ Instantiating a new StatArray class +++++++++++++++++++++++++++++++++++ -.. GENERATED FROM PYTHON SOURCE LINES 23-69 +.. GENERATED FROM PYTHON SOURCE LINES 23-66 .. code-block:: Python @@ -94,9 +94,6 @@ Instantiating a new StatArray class assert isinstance(test, StatArray) and test.size == 10, TypeError("da 6") print(test.summary) - - - # The StatArray can take any numpy function that returns an array as an input. # The name and units of the variable can be assigned to the StatArray. @@ -110,7 +107,7 @@ Instantiating a new StatArray class StatArray Name: 1 - Address:['0x154bfe950'] + Address:['0x140b98bd0'] Shape: (1,) Values: [0.] Min: 0.0 @@ -119,7 +116,7 @@ Instantiating a new StatArray class StatArray Name: 10 - Address:['0x17f089a50'] + Address:['0x140b998d0'] Shape: (10,) Values: [0. 0. 0. ... 0. 0. 0.] Min: 0.0 @@ -128,7 +125,7 @@ Instantiating a new StatArray class StatArray Name: (2, 10) - Address:['0x17f08a7d0'] + Address:['0x140b9a2d0'] Shape: (2, 10) Values: [[0. 0. 0. ... 0. 0. 0.] [0. 0. 0. ... 0. 0. 0.]] @@ -138,7 +135,7 @@ Instantiating a new StatArray class StatArray Name: (2, 10) - Address:['0x17f6825d0'] + Address:['0x140b9add0'] Shape: (2,) Values: [ 2 10] Min: 2 @@ -147,7 +144,7 @@ Instantiating a new StatArray class StatArray Name: 45.454 - Address:['0x17f08a7d0'] + Address:['0x10390a350'] Shape: (1,) Values: [45.454] Min: 45.454 @@ -156,7 +153,7 @@ Instantiating a new StatArray class StatArray Name: 45.454 - Address:['0x17f680a50'] + Address:['0x140b9b150'] Shape: (1,) Values: [45.454] Min: 45.454 @@ -165,16 +162,16 @@ Instantiating a new StatArray class StatArray Name: test ($\frac{g}{cc}$) - Address:['0x17f08a7d0'] + Address:['0x10390a350'] Shape: (1,) - Values: [-0.70419088] - Min: -0.7041908829549965 - Max: -0.7041908829549965 + Values: [-0.30357293] + Min: -0.30357293062816576 + Max: -0.30357293062816576 has_posterior: False StatArray Name: test ($\frac{g}{cc}$) - Address:['0x17f6819d0'] + Address:['0x140b9b2d0'] Shape: (10,) Values: [0. 1. 2. ... 7. 8. 9.] Min: 0.0 @@ -183,7 +180,7 @@ Instantiating a new StatArray class StatArray Name: test ($\frac{g}{cc}$) - Address:['0x17f680a50'] + Address:['0x140b9b150'] Shape: (10,) Values: [0. 1. 2. ... 7. 8. 9.] Min: 0.0 @@ -194,7 +191,7 @@ Instantiating a new StatArray class -.. GENERATED FROM PYTHON SOURCE LINES 70-89 +.. GENERATED FROM PYTHON SOURCE LINES 67-86 Attaching Prior and Proposal Distributions to a StatArray +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -216,7 +213,7 @@ Two types of distributions can be attached to the StatArray. sample when we wish to perturb the variable https://en.wikipedia.org/wiki/Metropolis%E2%80%93Hastings_algorithm -.. GENERATED FROM PYTHON SOURCE LINES 89-101 +.. GENERATED FROM PYTHON SOURCE LINES 86-98 .. code-block:: Python @@ -239,11 +236,11 @@ Two types of distributions can be attached to the StatArray. -.. GENERATED FROM PYTHON SOURCE LINES 102-103 +.. GENERATED FROM PYTHON SOURCE LINES 99-100 We can also attach a proposal distribution -.. GENERATED FROM PYTHON SOURCE LINES 103-109 +.. GENERATED FROM PYTHON SOURCE LINES 100-106 .. code-block:: Python @@ -263,8 +260,8 @@ We can also attach a proposal distribution StatArray Name: test ($\frac{g}{cc}$) - Address:['0x154bfd7d0' '0x17f652360' '0x181310930' ... '0x17f652180' '0x181313b10' - '0x1813134b0'] + Address:['0x106d683d0' '0x13c904ec0' '0x13de4f810' ... '0x140b7ee40' '0x13de4f870' + '0x13de4f8d0'] Shape: (1,) Values: [10.] Min: 10.0 @@ -285,13 +282,13 @@ We can also attach a proposal distribution -.. GENERATED FROM PYTHON SOURCE LINES 110-113 +.. GENERATED FROM PYTHON SOURCE LINES 107-110 The values in the variable can be evaluated against the prior. In this case, we have 3 elements in the variable, and a univariate Normal for the prior. Therefore each element is evaluated to get 3 probabilities, one for each element. -.. GENERATED FROM PYTHON SOURCE LINES 113-115 +.. GENERATED FROM PYTHON SOURCE LINES 110-112 .. code-block:: Python @@ -310,11 +307,11 @@ Therefore each element is evaluated to get 3 probabilities, one for each element -.. GENERATED FROM PYTHON SOURCE LINES 116-117 +.. GENERATED FROM PYTHON SOURCE LINES 113-114 The univariate proposal distribution can generate random samples from itself. -.. GENERATED FROM PYTHON SOURCE LINES 117-119 +.. GENERATED FROM PYTHON SOURCE LINES 114-116 .. code-block:: Python @@ -333,12 +330,12 @@ The univariate proposal distribution can generate random samples from itself. -.. GENERATED FROM PYTHON SOURCE LINES 120-122 +.. GENERATED FROM PYTHON SOURCE LINES 117-119 From a sampling stand point we can either sample using only the proposal Or we can only generate samples that simultaneously satisfy the prior. -.. GENERATED FROM PYTHON SOURCE LINES 122-124 +.. GENERATED FROM PYTHON SOURCE LINES 119-121 .. code-block:: Python @@ -357,11 +354,11 @@ Or we can only generate samples that simultaneously satisfy the prior. -.. GENERATED FROM PYTHON SOURCE LINES 125-126 +.. GENERATED FROM PYTHON SOURCE LINES 122-123 We can perturb the variable by drawing from the attached proposal distribution. -.. GENERATED FROM PYTHON SOURCE LINES 126-130 +.. GENERATED FROM PYTHON SOURCE LINES 123-127 .. code-block:: Python @@ -379,8 +376,8 @@ We can perturb the variable by drawing from the attached proposal distribution. StatArray Name: test ($\frac{g}{cc}$) - Address:['0x154bfd7d0' '0x17f652360' '0x181310930' ... '0x17f652180' '0x181313b10' - '0x1813134b0'] + Address:['0x106d683d0' '0x13c904ec0' '0x13de4f810' ... '0x140b7ee40' '0x13de4f870' + '0x13de4f8d0'] Shape: (1,) Values: [0.38188467] Min: 0.38188466718060166 @@ -399,7 +396,7 @@ We can perturb the variable by drawing from the attached proposal distribution. -.. GENERATED FROM PYTHON SOURCE LINES 131-136 +.. GENERATED FROM PYTHON SOURCE LINES 128-133 Attaching a Histogram to capture the posterior distribution +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -407,7 +404,7 @@ The StatArray can perturb itself, evaluate its current probability given its pri and a histogram can be attached to capture its posterior distribution. As an example, lets create a Histogram class with bins generated from the prior. -.. GENERATED FROM PYTHON SOURCE LINES 136-137 +.. GENERATED FROM PYTHON SOURCE LINES 133-134 .. code-block:: Python @@ -419,11 +416,11 @@ As an example, lets create a Histogram class with bins generated from the prior. -.. GENERATED FROM PYTHON SOURCE LINES 138-139 +.. GENERATED FROM PYTHON SOURCE LINES 135-136 Attach the histogram -.. GENERATED FROM PYTHON SOURCE LINES 139-141 +.. GENERATED FROM PYTHON SOURCE LINES 136-138 .. code-block:: Python @@ -436,11 +433,11 @@ Attach the histogram -.. GENERATED FROM PYTHON SOURCE LINES 142-143 +.. GENERATED FROM PYTHON SOURCE LINES 139-140 In an iterative sense, we can propose and evaluate new values, and update the posterior -.. GENERATED FROM PYTHON SOURCE LINES 143-150 +.. GENERATED FROM PYTHON SOURCE LINES 140-147 .. code-block:: Python @@ -458,7 +455,7 @@ In an iterative sense, we can propose and evaluate new values, and update the po -.. GENERATED FROM PYTHON SOURCE LINES 151-154 +.. GENERATED FROM PYTHON SOURCE LINES 148-151 .. code-block:: Python @@ -477,14 +474,14 @@ In an iterative sense, we can propose and evaluate new values, and update the po -.. GENERATED FROM PYTHON SOURCE LINES 155-159 +.. GENERATED FROM PYTHON SOURCE LINES 152-156 Attach a multivariate normal distribution as the prior and proposal +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Attach the multivariate prior -.. GENERATED FROM PYTHON SOURCE LINES 159-165 +.. GENERATED FROM PYTHON SOURCE LINES 156-162 .. code-block:: Python @@ -501,13 +498,13 @@ Attach the multivariate prior -.. GENERATED FROM PYTHON SOURCE LINES 166-169 +.. GENERATED FROM PYTHON SOURCE LINES 163-166 Since the prior is multivariate, the appropriate equations are used to evaluate the probability for all elements in the StatArray. This produces a single probability. -.. GENERATED FROM PYTHON SOURCE LINES 169-172 +.. GENERATED FROM PYTHON SOURCE LINES 166-169 .. code-block:: Python @@ -522,16 +519,16 @@ This produces a single probability. .. code-block:: none - 0.16541198455442488 + 0.3796768180063585 -.. GENERATED FROM PYTHON SOURCE LINES 173-174 +.. GENERATED FROM PYTHON SOURCE LINES 170-171 Attach the multivariate proposal -.. GENERATED FROM PYTHON SOURCE LINES 174-180 +.. GENERATED FROM PYTHON SOURCE LINES 171-177 .. code-block:: Python @@ -548,11 +545,11 @@ Attach the multivariate proposal -.. GENERATED FROM PYTHON SOURCE LINES 181-182 +.. GENERATED FROM PYTHON SOURCE LINES 178-179 Perturb the variables using the multivariate proposal. -.. GENERATED FROM PYTHON SOURCE LINES 182-197 +.. GENERATED FROM PYTHON SOURCE LINES 179-194 .. code-block:: Python @@ -578,7 +575,7 @@ Perturb the variables using the multivariate proposal. -.. GENERATED FROM PYTHON SOURCE LINES 198-209 +.. GENERATED FROM PYTHON SOURCE LINES 195-206 Basic manipulation ++++++++++++++++++ @@ -592,7 +589,7 @@ and if any prior or proposal are set, those will be carried through too. 1D example __________ -.. GENERATED FROM PYTHON SOURCE LINES 209-213 +.. GENERATED FROM PYTHON SOURCE LINES 206-210 .. code-block:: Python @@ -613,7 +610,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 214-219 +.. GENERATED FROM PYTHON SOURCE LINES 211-216 .. code-block:: Python @@ -635,7 +632,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 220-225 +.. GENERATED FROM PYTHON SOURCE LINES 217-222 .. code-block:: Python @@ -657,7 +654,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 226-231 +.. GENERATED FROM PYTHON SOURCE LINES 223-228 .. code-block:: Python @@ -679,7 +676,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 232-237 +.. GENERATED FROM PYTHON SOURCE LINES 229-234 .. code-block:: Python @@ -701,7 +698,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 238-243 +.. GENERATED FROM PYTHON SOURCE LINES 235-240 .. code-block:: Python @@ -723,7 +720,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 244-249 +.. GENERATED FROM PYTHON SOURCE LINES 241-246 .. code-block:: Python @@ -745,7 +742,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 250-255 +.. GENERATED FROM PYTHON SOURCE LINES 247-252 .. code-block:: Python @@ -767,7 +764,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 256-261 +.. GENERATED FROM PYTHON SOURCE LINES 253-258 .. code-block:: Python @@ -789,7 +786,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 262-267 +.. GENERATED FROM PYTHON SOURCE LINES 259-264 .. code-block:: Python @@ -811,7 +808,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 268-273 +.. GENERATED FROM PYTHON SOURCE LINES 265-270 .. code-block:: Python @@ -833,7 +830,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 274-279 +.. GENERATED FROM PYTHON SOURCE LINES 271-276 .. code-block:: Python @@ -855,12 +852,12 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 280-282 +.. GENERATED FROM PYTHON SOURCE LINES 277-279 2D example __________ -.. GENERATED FROM PYTHON SOURCE LINES 282-287 +.. GENERATED FROM PYTHON SOURCE LINES 279-284 .. code-block:: Python @@ -884,7 +881,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 288-293 +.. GENERATED FROM PYTHON SOURCE LINES 285-290 .. code-block:: Python @@ -909,7 +906,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 294-299 +.. GENERATED FROM PYTHON SOURCE LINES 291-296 .. code-block:: Python @@ -933,7 +930,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 300-305 +.. GENERATED FROM PYTHON SOURCE LINES 297-302 .. code-block:: Python @@ -957,7 +954,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 306-311 +.. GENERATED FROM PYTHON SOURCE LINES 303-308 .. code-block:: Python @@ -982,7 +979,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 312-317 +.. GENERATED FROM PYTHON SOURCE LINES 309-314 .. code-block:: Python @@ -1006,7 +1003,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 318-323 +.. GENERATED FROM PYTHON SOURCE LINES 315-320 .. code-block:: Python @@ -1031,7 +1028,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 324-329 +.. GENERATED FROM PYTHON SOURCE LINES 321-326 .. code-block:: Python @@ -1057,7 +1054,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 330-335 +.. GENERATED FROM PYTHON SOURCE LINES 327-332 .. code-block:: Python @@ -1079,7 +1076,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 336-341 +.. GENERATED FROM PYTHON SOURCE LINES 333-338 .. code-block:: Python @@ -1102,7 +1099,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 342-347 +.. GENERATED FROM PYTHON SOURCE LINES 339-344 .. code-block:: Python @@ -1124,7 +1121,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 348-353 +.. GENERATED FROM PYTHON SOURCE LINES 345-350 .. code-block:: Python @@ -1146,7 +1143,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 354-359 +.. GENERATED FROM PYTHON SOURCE LINES 351-356 .. code-block:: Python @@ -1168,7 +1165,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 360-365 +.. GENERATED FROM PYTHON SOURCE LINES 357-362 .. code-block:: Python @@ -1190,7 +1187,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 366-371 +.. GENERATED FROM PYTHON SOURCE LINES 363-368 .. code-block:: Python @@ -1214,7 +1211,7 @@ __________ -.. GENERATED FROM PYTHON SOURCE LINES 372-377 +.. GENERATED FROM PYTHON SOURCE LINES 369-374 Plotting ++++++++ @@ -1222,7 +1219,7 @@ Plotting We can easily plot the StatArray with its built in plotting functions. All plotting functions can take matplotlib keywords -.. GENERATED FROM PYTHON SOURCE LINES 377-385 +.. GENERATED FROM PYTHON SOURCE LINES 374-382 .. code-block:: Python @@ -1241,7 +1238,7 @@ All plotting functions can take matplotlib keywords -.. GENERATED FROM PYTHON SOURCE LINES 386-391 +.. GENERATED FROM PYTHON SOURCE LINES 383-388 .. code-block:: Python @@ -1262,11 +1259,11 @@ All plotting functions can take matplotlib keywords -.. GENERATED FROM PYTHON SOURCE LINES 392-393 +.. GENERATED FROM PYTHON SOURCE LINES 389-390 We can quickly plot a bar graph. -.. GENERATED FROM PYTHON SOURCE LINES 393-398 +.. GENERATED FROM PYTHON SOURCE LINES 390-395 .. code-block:: Python @@ -1287,11 +1284,11 @@ We can quickly plot a bar graph. -.. GENERATED FROM PYTHON SOURCE LINES 399-400 +.. GENERATED FROM PYTHON SOURCE LINES 396-397 We can scatter the contents of the StatArray if it is 1D -.. GENERATED FROM PYTHON SOURCE LINES 400-405 +.. GENERATED FROM PYTHON SOURCE LINES 397-402 .. code-block:: Python @@ -1312,7 +1309,7 @@ We can scatter the contents of the StatArray if it is 1D -.. GENERATED FROM PYTHON SOURCE LINES 406-413 +.. GENERATED FROM PYTHON SOURCE LINES 403-410 Histogram Equalization ______________________ @@ -1322,7 +1319,7 @@ This approach forces all colours in the images to have an equal weight. This distorts the colour bar, but can really highlight the lower and higher ends of whatever you are plotting. Just add the equalize keyword! -.. GENERATED FROM PYTHON SOURCE LINES 413-418 +.. GENERATED FROM PYTHON SOURCE LINES 410-415 .. code-block:: Python @@ -1343,13 +1340,13 @@ ends of whatever you are plotting. Just add the equalize keyword! -.. GENERATED FROM PYTHON SOURCE LINES 419-422 +.. GENERATED FROM PYTHON SOURCE LINES 416-419 Take the log base(x) of the data We can also take the data to a log, log10, log2, or a custom number! -.. GENERATED FROM PYTHON SOURCE LINES 422-426 +.. GENERATED FROM PYTHON SOURCE LINES 419-423 .. code-block:: Python @@ -1369,13 +1366,13 @@ We can also take the data to a log, log10, log2, or a custom number! -.. GENERATED FROM PYTHON SOURCE LINES 427-430 +.. GENERATED FROM PYTHON SOURCE LINES 424-427 X and Y axes We can specify the x axis of the scatter plot. -.. GENERATED FROM PYTHON SOURCE LINES 430-436 +.. GENERATED FROM PYTHON SOURCE LINES 427-433 .. code-block:: Python @@ -1397,7 +1394,7 @@ We can specify the x axis of the scatter plot. -.. GENERATED FROM PYTHON SOURCE LINES 437-444 +.. GENERATED FROM PYTHON SOURCE LINES 434-441 Notice that I never specified the y axis, so the y axis defaulted to the values in the StatArray. In this case, any operations applied to the colours, are also applied to the y axis, e.g. log=10. @@ -1407,7 +1404,7 @@ I can however force the y co-ordinates by specifying it as input. In the second subplot I explicitly plot distance on the y axis. In the first subplot, the y axis is the same as the colourbar. -.. GENERATED FROM PYTHON SOURCE LINES 444-453 +.. GENERATED FROM PYTHON SOURCE LINES 441-450 .. code-block:: Python @@ -1432,13 +1429,13 @@ In the first subplot, the y axis is the same as the colourbar. -.. GENERATED FROM PYTHON SOURCE LINES 454-457 +.. GENERATED FROM PYTHON SOURCE LINES 451-454 Point sizes Since the plotting functions take matplotlib keywords, I can also specify the size of each points. -.. GENERATED FROM PYTHON SOURCE LINES 459-474 +.. GENERATED FROM PYTHON SOURCE LINES 456-471 .. code-block:: Python @@ -1469,11 +1466,11 @@ Since the plotting functions take matplotlib keywords, I can also specify the si -.. GENERATED FROM PYTHON SOURCE LINES 475-476 +.. GENERATED FROM PYTHON SOURCE LINES 472-473 Of course we can still take the log, or equalize the colour histogram -.. GENERATED FROM PYTHON SOURCE LINES 476-481 +.. GENERATED FROM PYTHON SOURCE LINES 473-478 .. code-block:: Python @@ -1494,11 +1491,11 @@ Of course we can still take the log, or equalize the colour histogram -.. GENERATED FROM PYTHON SOURCE LINES 482-483 +.. GENERATED FROM PYTHON SOURCE LINES 479-480 Typically pcolor only works with 2D arrays. The StatArray has a pcolor method that will pcolor a 1D array -.. GENERATED FROM PYTHON SOURCE LINES 483-495 +.. GENERATED FROM PYTHON SOURCE LINES 480-492 .. code-block:: Python @@ -1526,13 +1523,13 @@ Typically pcolor only works with 2D arrays. The StatArray has a pcolor method th -.. GENERATED FROM PYTHON SOURCE LINES 496-499 +.. GENERATED FROM PYTHON SOURCE LINES 493-496 We can add grid lines, and add opacity to each element in the pcolor image This is useful if the colour values need to be scaled by another variable e.g. variance. -.. GENERATED FROM PYTHON SOURCE LINES 499-509 +.. GENERATED FROM PYTHON SOURCE LINES 496-506 .. code-block:: Python @@ -1558,11 +1555,11 @@ This is useful if the colour values need to be scaled by another variable e.g. v -.. GENERATED FROM PYTHON SOURCE LINES 510-511 +.. GENERATED FROM PYTHON SOURCE LINES 507-508 We can plot a histogram of the StatArray -.. GENERATED FROM PYTHON SOURCE LINES 511-516 +.. GENERATED FROM PYTHON SOURCE LINES 508-513 .. code-block:: Python @@ -1583,11 +1580,11 @@ We can plot a histogram of the StatArray -.. GENERATED FROM PYTHON SOURCE LINES 517-518 +.. GENERATED FROM PYTHON SOURCE LINES 514-515 We can write the StatArray to a HDF5 file. HDF5 files are binary files that can include compression. They allow quick and easy access to parts of the file, and can also be written to and read from in parallel! -.. GENERATED FROM PYTHON SOURCE LINES 518-523 +.. GENERATED FROM PYTHON SOURCE LINES 515-520 .. code-block:: Python @@ -1603,12 +1600,12 @@ We can write the StatArray to a HDF5 file. HDF5 files are binary files that can -.. GENERATED FROM PYTHON SOURCE LINES 524-526 +.. GENERATED FROM PYTHON SOURCE LINES 521-523 We can then read the StatArray from the file Here x is a new variable, that is read in from the hdf5 file we just wrote. -.. GENERATED FROM PYTHON SOURCE LINES 526-533 +.. GENERATED FROM PYTHON SOURCE LINES 523-530 .. code-block:: Python @@ -1633,11 +1630,11 @@ Here x is a new variable, that is read in from the hdf5 file we just wrote. -.. GENERATED FROM PYTHON SOURCE LINES 534-535 +.. GENERATED FROM PYTHON SOURCE LINES 531-532 We can also define a 2D array -.. GENERATED FROM PYTHON SOURCE LINES 535-540 +.. GENERATED FROM PYTHON SOURCE LINES 532-537 .. code-block:: Python @@ -1655,17 +1652,17 @@ We can also define a 2D array .. code-block:: none - "StatArray\nName: Density ($\\frac{g}{cc}$)\nAddress:['0x17f4e05d0']\nShape: (50, 100)\nValues: [[ 0.14104158 0.47155933 1.95502179 ... 1.76214533 1.24396239\n 0.1215391 ]\n [-1.85725407 -1.83481902 1.04987135 ... 0.85985878 -0.34529634\n -0.85558253]\n [ 0.76292177 1.13113089 -1.35816931 ... 1.31159774 0.46698778\n 1.68630769]\n ...\n [ 0.48384681 0.22774246 -0.51285518 ... -0.24617681 0.81498656\n 1.57095942]\n [-0.13056782 1.72508382 -1.33506224 ... -1.17319374 0.27482725\n 0.39378825]\n [ 1.36799972 0.26714623 -0.02588039 ... -0.28979426 -0.8747471\n -0.98512505]]\nMin: -3.2750329304041186\nMax: 3.445969826454679\nhas_posterior: False\n" + "StatArray\nName: Density ($\\frac{g}{cc}$)\nAddress:['0x14c27bb50']\nShape: (50, 100)\nValues: [[ 0.43031444 0.16747392 -1.02201373 ... 0.74153721 1.90862961\n -1.96298093]\n [-1.14462562 -0.35617089 -0.26110976 ... -0.23504484 0.90603323\n 0.24712065]\n [-0.14957468 0.72207578 -0.88557489 ... -0.17089164 -0.17362076\n -0.63489297]\n ...\n [-1.159864 0.20198017 -1.45020582 ... -0.09188611 0.51429009\n -2.29873304]\n [ 0.05110857 0.16473781 0.39133135 ... -0.772846 1.47108002\n 0.36929033]\n [ 1.88347735 -0.83146739 -0.92242455 ... -0.48809595 1.23172139\n 1.86073707]]\nMin: -4.160360372326481\nMax: 3.7432694562093096\nhas_posterior: False\n" -.. GENERATED FROM PYTHON SOURCE LINES 541-544 +.. GENERATED FROM PYTHON SOURCE LINES 538-541 The StatArray Class's functions work whether it is 1D or 2D We can still do a histogram -.. GENERATED FROM PYTHON SOURCE LINES 544-549 +.. GENERATED FROM PYTHON SOURCE LINES 541-546 .. code-block:: Python @@ -1686,11 +1683,11 @@ We can still do a histogram -.. GENERATED FROM PYTHON SOURCE LINES 550-551 +.. GENERATED FROM PYTHON SOURCE LINES 547-548 And we can use pcolor to plot the 2D array -.. GENERATED FROM PYTHON SOURCE LINES 551-556 +.. GENERATED FROM PYTHON SOURCE LINES 548-553 .. code-block:: Python @@ -1711,13 +1708,13 @@ And we can use pcolor to plot the 2D array -.. GENERATED FROM PYTHON SOURCE LINES 557-560 +.. GENERATED FROM PYTHON SOURCE LINES 554-557 The StatArray comes with extra plotting options Here we specify the x and y axes for the 2D array using two other 1D StatArrays -.. GENERATED FROM PYTHON SOURCE LINES 560-567 +.. GENERATED FROM PYTHON SOURCE LINES 557-564 .. code-block:: Python @@ -1740,13 +1737,13 @@ Here we specify the x and y axes for the 2D array using two other 1D StatArrays -.. GENERATED FROM PYTHON SOURCE LINES 568-571 +.. GENERATED FROM PYTHON SOURCE LINES 565-568 We can plot using a log10 scale, in this case, we have values that are less than or equal to 0.0. Plotting with the log option will by default mask any of those values, and will let you know that it has done so! -.. GENERATED FROM PYTHON SOURCE LINES 571-576 +.. GENERATED FROM PYTHON SOURCE LINES 568-573 .. code-block:: Python @@ -1767,14 +1764,14 @@ of those values, and will let you know that it has done so! -.. GENERATED FROM PYTHON SOURCE LINES 577-581 +.. GENERATED FROM PYTHON SOURCE LINES 574-578 A neat trick with colourmaps is histogram equalization. This approach forces all colours in the image to have an equal amount. This distorts the colours, but can really highlight the lower and higher ends of whatever you are plotting -.. GENERATED FROM PYTHON SOURCE LINES 581-586 +.. GENERATED FROM PYTHON SOURCE LINES 578-583 .. code-block:: Python @@ -1795,11 +1792,11 @@ ends of whatever you are plotting -.. GENERATED FROM PYTHON SOURCE LINES 587-588 +.. GENERATED FROM PYTHON SOURCE LINES 584-585 We can equalize the log10 plot too :) -.. GENERATED FROM PYTHON SOURCE LINES 588-593 +.. GENERATED FROM PYTHON SOURCE LINES 585-590 .. code-block:: Python @@ -1820,11 +1817,11 @@ We can equalize the log10 plot too :) -.. GENERATED FROM PYTHON SOURCE LINES 594-595 +.. GENERATED FROM PYTHON SOURCE LINES 591-592 We can add opacity to each pixel in the image -.. GENERATED FROM PYTHON SOURCE LINES 595-599 +.. GENERATED FROM PYTHON SOURCE LINES 592-596 .. code-block:: Python @@ -1839,7 +1836,7 @@ We can add opacity to each pixel in the image -.. GENERATED FROM PYTHON SOURCE LINES 600-611 +.. GENERATED FROM PYTHON SOURCE LINES 597-608 .. code-block:: Python @@ -1866,11 +1863,11 @@ We can add opacity to each pixel in the image -.. GENERATED FROM PYTHON SOURCE LINES 612-613 +.. GENERATED FROM PYTHON SOURCE LINES 609-610 If the array potentially has a lot of white space around the edges, we can trim the image -.. GENERATED FROM PYTHON SOURCE LINES 613-625 +.. GENERATED FROM PYTHON SOURCE LINES 610-622 .. code-block:: Python @@ -1898,11 +1895,11 @@ If the array potentially has a lot of white space around the edges, we can trim -.. GENERATED FROM PYTHON SOURCE LINES 626-627 +.. GENERATED FROM PYTHON SOURCE LINES 623-624 Create a stacked area plot of a 2D StatArray -.. GENERATED FROM PYTHON SOURCE LINES 627-637 +.. GENERATED FROM PYTHON SOURCE LINES 624-634 .. code-block:: Python @@ -1931,7 +1928,7 @@ Create a stacked area plot of a 2D StatArray .. rst-class:: sphx-glr-timing - **Total running time of the script:** (0 minutes 2.767 seconds) + **Total running time of the script:** (0 minutes 6.330 seconds) .. _sphx_glr_download_examples_Statistics_plot_StatArray.py: diff --git a/docs/_sources/examples/Statistics/sg_execution_times.rst.txt b/docs/_sources/examples/Statistics/sg_execution_times.rst.txt index 7beb9fff..7bfe9a3d 100644 --- a/docs/_sources/examples/Statistics/sg_execution_times.rst.txt +++ b/docs/_sources/examples/Statistics/sg_execution_times.rst.txt @@ -6,7 +6,7 @@ Computation times ================= -**00:12.629** total execution time for 5 files **from examples/Statistics**: +**00:06.330** total execution time for 4 files **from examples/Statistics**: .. container:: @@ -32,18 +32,15 @@ Computation times * - Example - Time - Mem (MB) - * - :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` (``plot_histogram_2d.py``) - - 00:05.012 - - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` (``plot_histogram_3d.py``) - - 00:03.875 - - 0.0 * - :ref:`sphx_glr_examples_Statistics_plot_StatArray.py` (``plot_StatArray.py``) - - 00:02.767 + - 00:06.330 - 0.0 * - :ref:`sphx_glr_examples_Statistics_plot_histogram_1d.py` (``plot_histogram_1d.py``) - - 00:00.972 + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_DataArray.py` (``plot_DataArray.py``) - - 00:00.003 + * - :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` (``plot_histogram_2d.py``) + - 00:00.000 + - 0.0 + * - :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` (``plot_histogram_3d.py``) + - 00:00.000 - 0.0 diff --git a/docs/_sources/examples/index.rst.txt b/docs/_sources/examples/index.rst.txt index c14511d3..74067d45 100644 --- a/docs/_sources/examples/index.rst.txt +++ b/docs/_sources/examples/index.rst.txt @@ -17,8 +17,8 @@ Examples -Data -==== +Distributions +============= .. raw:: html @@ -29,145 +29,108 @@ Data .. raw:: html -
+
.. only:: html - .. image:: /examples/Data/images/thumb/sphx_glr_plot_pointcloud3d_thumb.png + .. image:: /examples/Distributions/images/thumb/sphx_glr_plot_distributions_thumb.png :alt: - :ref:`sphx_glr_examples_Data_plot_pointcloud3d.py` + :ref:`sphx_glr_examples_Distributions_plot_distributions.py` .. raw:: html -
3D Point Cloud class
+
Distribution Class
-.. raw:: html - -
- -.. only:: html - - .. image:: /examples/Data/images/thumb/sphx_glr_plot_frequency_dataset_thumb.png - :alt: - - :ref:`sphx_glr_examples_Data_plot_frequency_dataset.py` +.. thumbnail-parent-div-close .. raw:: html -
Frequency domain dataset
-.. raw:: html - -
+.. toctree:: + :hidden: -.. only:: html + /examples/Distributions/plot_distributions - .. image:: /examples/Data/images/thumb/sphx_glr_plot_skytem_dataset_thumb.png - :alt: +Statistics +========== - :ref:`sphx_glr_examples_Data_plot_skytem_dataset.py` .. raw:: html -
Skytem dataset
-
+
+.. thumbnail-parent-div-open .. raw:: html -
+
.. only:: html - .. image:: /examples/Data/images/thumb/sphx_glr_plot_tempest_dataset_thumb.png + .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_1d_thumb.png :alt: - :ref:`sphx_glr_examples_Data_plot_tempest_dataset.py` - -.. raw:: html - -
Tempest dataset
-
- - -.. thumbnail-parent-div-close + :ref:`sphx_glr_examples_Statistics_plot_histogram_1d.py` .. raw:: html +
Histogram 1D
-.. toctree:: - :hidden: - - /examples/Data/plot_pointcloud3d - /examples/Data/plot_frequency_dataset - /examples/Data/plot_skytem_dataset - /examples/Data/plot_tempest_dataset - -Datapoints -========== - - .. raw:: html -
- -.. thumbnail-parent-div-open - -.. raw:: html - -
+
.. only:: html - .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_resolve_datapoint_thumb.png + .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_2d_thumb.png :alt: - :ref:`sphx_glr_examples_Datapoints_plot_resolve_datapoint.py` + :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` .. raw:: html -
Frequency domain datapoint
+
Histogram 2D
.. raw:: html -
+
.. only:: html - .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_skytem_datapoint_thumb.png + .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_3d_thumb.png :alt: - :ref:`sphx_glr_examples_Datapoints_plot_skytem_datapoint.py` + :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` .. raw:: html -
Skytem Datapoint Class
+
Histogram 3D
.. raw:: html -
+
.. only:: html - .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_tempest_datapoint_thumb.png + .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_StatArray_thumb.png :alt: - :ref:`sphx_glr_examples_Datapoints_plot_tempest_datapoint.py` + :ref:`sphx_glr_examples_Statistics_plot_StatArray.py` .. raw:: html -
Tempest Datapoint Class
+
StatArray Class
@@ -181,12 +144,13 @@ Datapoints .. toctree:: :hidden: - /examples/Datapoints/plot_resolve_datapoint - /examples/Datapoints/plot_skytem_datapoint - /examples/Datapoints/plot_tempest_datapoint + /examples/Statistics/plot_histogram_1d + /examples/Statistics/plot_histogram_2d + /examples/Statistics/plot_histogram_3d + /examples/Statistics/plot_StatArray -Distributions -============= +Meshes +====== .. raw:: html @@ -197,57 +161,52 @@ Distributions .. raw:: html -
+
.. only:: html - .. image:: /examples/Distributions/images/thumb/sphx_glr_plot_distributions_thumb.png + .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_1d_thumb.png :alt: - :ref:`sphx_glr_examples_Distributions_plot_distributions.py` + :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_1d.py` .. raw:: html -
Distribution Class
+
1D Rectilinear Mesh
-.. thumbnail-parent-div-close - .. raw:: html -
- - -.. toctree:: - :hidden: +
- /examples/Distributions/plot_distributions +.. only:: html -HDF 5 -===== + .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_2d_thumb.png + :alt: + :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_2d.py` .. raw:: html -
+
2D Rectilinear Mesh
+
-.. thumbnail-parent-div-open .. raw:: html -
+
.. only:: html - .. image:: /examples/HDF5/images/thumb/sphx_glr_hdf5_thumb.png + .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_3d_thumb.png :alt: - :ref:`sphx_glr_examples_HDF5_hdf5.py` + :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_3d.py` .. raw:: html -
Using HDF5 within GeoBIPy
+
3D Rectilinear Mesh
@@ -261,20 +220,12 @@ HDF 5 .. toctree:: :hidden: - /examples/HDF5/hdf5 - -1D Inference -============ - -There are a couple of ways to run an inference using geobipy, the first is via command line using - -.. code-block:: bash - - geobipy skytem_options.py - -The other is with a python script similar to the examples in this folder. -In both cases, you will need to write an options file (also shown in these examples) + /examples/Meshes/plot_rectilinear_mesh_1d + /examples/Meshes/plot_rectilinear_mesh_2d + /examples/Meshes/plot_rectilinear_mesh_3d +Models +====== .. raw:: html @@ -285,52 +236,52 @@ In both cases, you will need to write an options file (also shown in these examp .. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_resolve_thumb.png + .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_1d_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_resolve.py` + :ref:`sphx_glr_examples_Models_plot_model_1d.py` .. raw:: html -
Running GeoBIPy to invert Resolve data
+
1D Model with an infinite halfspace
.. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_skytem_thumb.png + .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_2d_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_skytem.py` + :ref:`sphx_glr_examples_Models_plot_model_2d.py` .. raw:: html -
Running GeoBIPy to invert Skytem data
+
2D Rectilinear Model
.. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_tempest_thumb.png + .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_3d_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_tempest.py` + :ref:`sphx_glr_examples_Models_plot_model_3d.py` .. raw:: html -
Running GeoBIPy to invert Tempest data
+
3D Rectilinear Model
@@ -344,12 +295,12 @@ In both cases, you will need to write an options file (also shown in these examp .. toctree:: :hidden: - /examples/Inference_1D/plot_inference_1d_resolve - /examples/Inference_1D/plot_inference_1d_skytem - /examples/Inference_1D/plot_inference_1d_tempest + /examples/Models/plot_model_1d + /examples/Models/plot_model_2d + /examples/Models/plot_model_3d -2D Inference -============ +Data +==== .. raw:: html @@ -360,52 +311,69 @@ In both cases, you will need to write an options file (also shown in these examp .. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_resolve_thumb.png + .. image:: /examples/Data/images/thumb/sphx_glr_plot_pointcloud3d_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_resolve.py` + :ref:`sphx_glr_examples_Data_plot_pointcloud3d.py` .. raw:: html -
2D Posterior analysis of Resolve inference
+
3D Point Cloud class
.. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_skytem_thumb.png + .. image:: /examples/Data/images/thumb/sphx_glr_plot_frequency_dataset_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_skytem.py` + :ref:`sphx_glr_examples_Data_plot_frequency_dataset.py` .. raw:: html -
2D Posterior analysis of Skytem inference
+
Frequency domain dataset
.. raw:: html -
+
.. only:: html - .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_tempest_thumb.png + .. image:: /examples/Data/images/thumb/sphx_glr_plot_skytem_dataset_thumb.png :alt: - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_tempest.py` + :ref:`sphx_glr_examples_Data_plot_skytem_dataset.py` .. raw:: html -
2D Posterior analysis of Tempest inference
+
Skytem dataset
+
+ + +.. raw:: html + +
+ +.. only:: html + + .. image:: /examples/Data/images/thumb/sphx_glr_plot_tempest_dataset_thumb.png + :alt: + + :ref:`sphx_glr_examples_Data_plot_tempest_dataset.py` + +.. raw:: html + +
Tempest dataset
@@ -419,12 +387,13 @@ In both cases, you will need to write an options file (also shown in these examp .. toctree:: :hidden: - /examples/Inference_2D/plot_inference_2d_resolve - /examples/Inference_2D/plot_inference_2d_skytem - /examples/Inference_2D/plot_inference_2d_tempest + /examples/Data/plot_pointcloud3d + /examples/Data/plot_frequency_dataset + /examples/Data/plot_skytem_dataset + /examples/Data/plot_tempest_dataset -Meshes -====== +Datapoints +========== .. raw:: html @@ -435,52 +404,52 @@ Meshes .. raw:: html -
+
.. only:: html - .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_1d_thumb.png + .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_resolve_datapoint_thumb.png :alt: - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_1d.py` + :ref:`sphx_glr_examples_Datapoints_plot_resolve_datapoint.py` .. raw:: html -
1D Rectilinear Mesh
+
Frequency domain datapoint
.. raw:: html -
+
.. only:: html - .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_2d_thumb.png + .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_skytem_datapoint_thumb.png :alt: - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_2d.py` + :ref:`sphx_glr_examples_Datapoints_plot_skytem_datapoint.py` .. raw:: html -
2D Rectilinear Mesh
+
Skytem Datapoint Class
.. raw:: html -
+
.. only:: html - .. image:: /examples/Meshes/images/thumb/sphx_glr_plot_rectilinear_mesh_3d_thumb.png + .. image:: /examples/Datapoints/images/thumb/sphx_glr_plot_tempest_datapoint_thumb.png :alt: - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_3d.py` + :ref:`sphx_glr_examples_Datapoints_plot_tempest_datapoint.py` .. raw:: html -
3D Rectilinear Mesh
+
Tempest Datapoint Class
@@ -494,12 +463,22 @@ Meshes .. toctree:: :hidden: - /examples/Meshes/plot_rectilinear_mesh_1d - /examples/Meshes/plot_rectilinear_mesh_2d - /examples/Meshes/plot_rectilinear_mesh_3d + /examples/Datapoints/plot_resolve_datapoint + /examples/Datapoints/plot_skytem_datapoint + /examples/Datapoints/plot_tempest_datapoint + +1D Inference +============ + +There are a couple of ways to run an inference using geobipy, the first is via command line using + +.. code-block:: bash + + geobipy skytem_options.py + +The other is with a python script similar to the examples in this folder. +In both cases, you will need to write an options file (also shown in these examples) -Models -====== .. raw:: html @@ -510,52 +489,52 @@ Models .. raw:: html -
+
.. only:: html - .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_1d_thumb.png + .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_resolve_thumb.png :alt: - :ref:`sphx_glr_examples_Models_plot_model_1d.py` + :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_resolve.py` .. raw:: html -
1D Model with an infinite halfspace
+
Running GeoBIPy to invert Resolve data
.. raw:: html -
+
.. only:: html - .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_2d_thumb.png + .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_skytem_thumb.png :alt: - :ref:`sphx_glr_examples_Models_plot_model_2d.py` + :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_skytem.py` .. raw:: html -
2D Rectilinear Model
+
Running GeoBIPy to invert Skytem data
.. raw:: html -
+
.. only:: html - .. image:: /examples/Models/images/thumb/sphx_glr_plot_model_3d_thumb.png + .. image:: /examples/Inference_1D/images/thumb/sphx_glr_plot_inference_1d_tempest_thumb.png :alt: - :ref:`sphx_glr_examples_Models_plot_model_3d.py` + :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_tempest.py` .. raw:: html -
3D Rectilinear Model
+
Running GeoBIPy to invert Tempest data
@@ -569,12 +548,12 @@ Models .. toctree:: :hidden: - /examples/Models/plot_model_1d - /examples/Models/plot_model_2d - /examples/Models/plot_model_3d + /examples/Inference_1D/plot_inference_1d_resolve + /examples/Inference_1D/plot_inference_1d_skytem + /examples/Inference_1D/plot_inference_1d_tempest -Statistics -========== +2D Inference +============ .. raw:: html @@ -585,86 +564,93 @@ Statistics .. raw:: html -
+
.. only:: html - .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_DataArray_thumb.png + .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_resolve_thumb.png :alt: - :ref:`sphx_glr_examples_Statistics_plot_DataArray.py` + :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_resolve.py` .. raw:: html -
DataArray Class
+
2D Posterior analysis of Resolve inference
.. raw:: html -
+
.. only:: html - .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_1d_thumb.png + .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_skytem_thumb.png :alt: - :ref:`sphx_glr_examples_Statistics_plot_histogram_1d.py` + :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_skytem.py` .. raw:: html -
Histogram 1D
+
2D Posterior analysis of Skytem inference
.. raw:: html -
+
.. only:: html - .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_2d_thumb.png + .. image:: /examples/Inference_2D/images/thumb/sphx_glr_plot_inference_2d_tempest_thumb.png :alt: - :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` + :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_tempest.py` .. raw:: html -
Histogram 2D
+
2D Posterior analysis of Tempest inference
+.. thumbnail-parent-div-close + .. raw:: html -
+
-.. only:: html - .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_histogram_3d_thumb.png - :alt: +.. toctree:: + :hidden: + + /examples/Inference_2D/plot_inference_2d_resolve + /examples/Inference_2D/plot_inference_2d_skytem + /examples/Inference_2D/plot_inference_2d_tempest + +HDF 5 +===== - :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` .. raw:: html -
Histogram 3D
-
+
+.. thumbnail-parent-div-open .. raw:: html -
+
.. only:: html - .. image:: /examples/Statistics/images/thumb/sphx_glr_plot_StatArray_thumb.png + .. image:: /examples/HDF5/images/thumb/sphx_glr_hdf5_thumb.png :alt: - :ref:`sphx_glr_examples_Statistics_plot_StatArray.py` + :ref:`sphx_glr_examples_HDF5_hdf5.py` .. raw:: html -
StatArray Class
+
Using HDF5 within GeoBIPy
@@ -678,11 +664,7 @@ Statistics .. toctree:: :hidden: - /examples/Statistics/plot_DataArray - /examples/Statistics/plot_histogram_1d - /examples/Statistics/plot_histogram_2d - /examples/Statistics/plot_histogram_3d - /examples/Statistics/plot_StatArray + /examples/HDF5/hdf5 .. only:: html diff --git a/docs/_sources/sg_execution_times.rst.txt b/docs/_sources/sg_execution_times.rst.txt index e35f03ac..bed88471 100644 --- a/docs/_sources/sg_execution_times.rst.txt +++ b/docs/_sources/sg_execution_times.rst.txt @@ -6,7 +6,7 @@ Computation times ================= -**06:08.049** total execution time for 26 files **from all galleries**: +**00:06.330** total execution time for 25 files **from all galleries**: .. container:: @@ -32,81 +32,78 @@ Computation times * - Example - Time - Mem (MB) - * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_tempest.py` (``examples/Inference_1D/plot_inference_1d_tempest.py``) - - 01:56.531 + * - :ref:`sphx_glr_examples_Statistics_plot_StatArray.py` (``examples/Statistics/plot_StatArray.py``) + - 00:06.330 - 0.0 - * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_skytem.py` (``examples/Inference_1D/plot_inference_1d_skytem.py``) - - 01:37.169 + * - :ref:`sphx_glr_examples_Data_plot_frequency_dataset.py` (``examples/Data/plot_frequency_dataset.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_resolve.py` (``examples/Inference_1D/plot_inference_1d_resolve.py``) - - 00:29.449 + * - :ref:`sphx_glr_examples_Data_plot_pointcloud3d.py` (``examples/Data/plot_pointcloud3d.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_resolve.py` (``examples/Inference_2D/plot_inference_2d_resolve.py``) - - 00:21.524 + * - :ref:`sphx_glr_examples_Data_plot_skytem_dataset.py` (``examples/Data/plot_skytem_dataset.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_tempest.py` (``examples/Inference_2D/plot_inference_2d_tempest.py``) - - 00:19.999 + * - :ref:`sphx_glr_examples_Data_plot_tempest_dataset.py` (``examples/Data/plot_tempest_dataset.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Data_plot_pointcloud3d.py` (``examples/Data/plot_pointcloud3d.py``) - - 00:19.063 + * - :ref:`sphx_glr_examples_Datapoints_plot_resolve_datapoint.py` (``examples/Datapoints/plot_resolve_datapoint.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_skytem.py` (``examples/Inference_2D/plot_inference_2d_skytem.py``) - - 00:18.965 + * - :ref:`sphx_glr_examples_Datapoints_plot_skytem_datapoint.py` (``examples/Datapoints/plot_skytem_datapoint.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Datapoints_plot_resolve_datapoint.py` (``examples/Datapoints/plot_resolve_datapoint.py``) - - 00:07.271 + * - :ref:`sphx_glr_examples_Datapoints_plot_tempest_datapoint.py` (``examples/Datapoints/plot_tempest_datapoint.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` (``examples/Statistics/plot_histogram_2d.py``) - - 00:05.012 + * - :ref:`sphx_glr_examples_Distributions_plot_distributions.py` (``examples/Distributions/plot_distributions.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_1d.py` (``examples/Meshes/plot_rectilinear_mesh_1d.py``) - - 00:04.585 + * - :ref:`sphx_glr_examples_HDF5_hdf5.py` (``examples/HDF5/hdf5.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Data_plot_tempest_dataset.py` (``examples/Data/plot_tempest_dataset.py``) - - 00:04.125 + * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_resolve.py` (``examples/Inference_1D/plot_inference_1d_resolve.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` (``examples/Statistics/plot_histogram_3d.py``) - - 00:03.875 + * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_skytem.py` (``examples/Inference_1D/plot_inference_1d_skytem.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Data_plot_frequency_dataset.py` (``examples/Data/plot_frequency_dataset.py``) - - 00:03.257 + * - :ref:`sphx_glr_examples_Inference_1D_plot_inference_1d_tempest.py` (``examples/Inference_1D/plot_inference_1d_tempest.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Models_plot_model_1d.py` (``examples/Models/plot_model_1d.py``) - - 00:03.051 + * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_resolve.py` (``examples/Inference_2D/plot_inference_2d_resolve.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_StatArray.py` (``examples/Statistics/plot_StatArray.py``) - - 00:02.767 + * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_skytem.py` (``examples/Inference_2D/plot_inference_2d_skytem.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Datapoints_plot_skytem_datapoint.py` (``examples/Datapoints/plot_skytem_datapoint.py``) - - 00:02.306 + * - :ref:`sphx_glr_examples_Inference_2D_plot_inference_2d_tempest.py` (``examples/Inference_2D/plot_inference_2d_tempest.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Data_plot_skytem_dataset.py` (``examples/Data/plot_skytem_dataset.py``) - - 00:02.295 + * - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_1d.py` (``examples/Meshes/plot_rectilinear_mesh_1d.py``) + - 00:00.000 - 0.0 * - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_2d.py` (``examples/Meshes/plot_rectilinear_mesh_2d.py``) - - 00:01.747 - - 0.0 - * - :ref:`sphx_glr_examples_Datapoints_plot_tempest_datapoint.py` (``examples/Datapoints/plot_tempest_datapoint.py``) - - 00:01.653 + - 00:00.000 - 0.0 * - :ref:`sphx_glr_examples_Meshes_plot_rectilinear_mesh_3d.py` (``examples/Meshes/plot_rectilinear_mesh_3d.py``) - - 00:01.378 - - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_histogram_1d.py` (``examples/Statistics/plot_histogram_1d.py``) - - 00:00.972 + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Models_plot_model_3d.py` (``examples/Models/plot_model_3d.py``) - - 00:00.788 + * - :ref:`sphx_glr_examples_Models_plot_model_1d.py` (``examples/Models/plot_model_1d.py``) + - 00:00.000 - 0.0 * - :ref:`sphx_glr_examples_Models_plot_model_2d.py` (``examples/Models/plot_model_2d.py``) - - 00:00.212 + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Distributions_plot_distributions.py` (``examples/Distributions/plot_distributions.py``) - - 00:00.050 + * - :ref:`sphx_glr_examples_Models_plot_model_3d.py` (``examples/Models/plot_model_3d.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_Statistics_plot_DataArray.py` (``examples/Statistics/plot_DataArray.py``) - - 00:00.003 + * - :ref:`sphx_glr_examples_Statistics_plot_histogram_1d.py` (``examples/Statistics/plot_histogram_1d.py``) + - 00:00.000 - 0.0 - * - :ref:`sphx_glr_examples_HDF5_hdf5.py` (``examples/HDF5/hdf5.py``) + * - :ref:`sphx_glr_examples_Statistics_plot_histogram_2d.py` (``examples/Statistics/plot_histogram_2d.py``) + - 00:00.000 + - 0.0 + * - :ref:`sphx_glr_examples_Statistics_plot_histogram_3d.py` (``examples/Statistics/plot_histogram_3d.py``) - 00:00.000 - 0.0 diff --git a/docs/content/api/classes/core/DataArray.html b/docs/content/api/classes/core/DataArray.html new file mode 100644 index 00000000..b95bca41 --- /dev/null +++ b/docs/content/api/classes/core/DataArray.html @@ -0,0 +1,1186 @@ + + + + + + + DataArray — GeoBIPy 2.3.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

DataArray

+digraph inheritance824f77954e { +bgcolor=transparent; +rankdir=LR; +size="8.0, 12.0"; + "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; + "DataArray" [URL="#geobipy.src.classes.core.DataArray.DataArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class extension to numpy.ndarray"]; + "ndarray" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" [URL="myObject.html#geobipy.src.classes.core.myObject.myObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; + "ABC" -> "myObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "ndarray" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="ndarray(shape, dtype=float, buffer=None, offset=0,"]; +} +
+
+class geobipy.src.classes.core.DataArray.DataArray(shape=None, name=None, units=None, verbose=False, **kwargs)
+

Class extension to numpy.ndarray

+

This subclass to a numpy array contains extra attributes that can describe the parameters it represents. +One can also attach prior and proposal distributions so that it may be used in an MCMC algorithm easily. +Because this is a subclass to numpy, the StatArray contains all numpy array methods and when passed to an +in-place numpy function will return a StatArray. See the example section for more information.

+

StatArray(shape, name=None, units=None, **kwargs)

+
+
Parameters:
+
    +
  • shape (int or sequence of ints or array_like or StatArray) –

      +
    • If shape is int or sequence of ints : give the shape of the new StatArray e.g., 2 or (2, 3). All other arguments that can be passed to functions like numpy.zeros or numpy.arange can be used, see Other Parameters.

    • +
    • If shape is array_like : any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. e.g., StatArray(numpy.arange(10)) will cast the result into a StatArray and will maintain the properies passed through to that function. One could then attach the name, units, prior, and/or proposal through this interface too. e.g., x = StatArray(numpy.arange(10,dtype=numpy.int), name='aTest', units='someUnits')

    • +
    • If shape is StatArray : the returned object is a deepcopy of the input. If name and units are specified with this option they will replace those parameters in the copy. e.g., y = StatArray(x, name='anotherTest') will be a deepcopy copy of x, but with a different name.

    • +
    +

  • +
  • name (str, optional) – The name of the StatArray.

  • +
  • units (str, optional) – The units of the StatArray.

  • +
  • dtype (data-type, optional) – The desired data-type for the array. Default is +numpy.float64. Only used when shape is int or sequence of ints. +The data type could also be a class.

  • +
  • buffer (object exposing buffer interface, optional) – Used to fill the array with data. Only used when shape is int or sequence of ints.

  • +
  • offset (int, optional) – Offset of array data in buffer. Only used when shape is int or sequence of ints.

  • +
  • strides (tuple of ints, optional) – Strides of data in memory. Only used when shape is int or sequence of ints.

  • +
  • order ({'C', 'F', 'A'}, optional) – Specify the order of the array. If order is ‘C’, then the array +will be in C-contiguous order (rightmost-index varies the fastest). +If order is ‘F’, then the returned array will be in +Fortran-contiguous order (leftmost-index varies the fastest). +If order is ‘A’ (default), then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous), +unless a copy is required, in which case it will be C-contiguous. Only used when shape is int or sequence of ints.

  • +
+
+
Returns:
+

out – Extension to numpy.ndarray with additional attributes attached.

+
+
Return type:
+

StatArray

+
+
Raises:
+
    +
  • TypeError – If name is not a str.

  • +
  • TypeError – If units is not a str.

  • +
+
+
+

Notes

+

When the StatArray is passed through a numpy function, the name and units are maintained in the new object. Any priors or proposals are not kept for two reasons. a) keep computational overheads low, b) assume that a possible change in size or meaning of a parameter warrants a change in any attached distributions.

+

Examples

+

Since the StatArray is an extension to numpy, all numpy attached methods can be used.

+
>>> from geobipy import StatArray
+>>> import numpy as np
+>>> x = StatArray(arange(10), name='test', units='units')
+>>> print(x.mean())
+4.5
+
+
+

If the StatArray is passed to a numpy function that does not return a new instantiation, a StatArray will be returned (as opposed to a numpy array)

+
>>> delete(x, 5)
+StatArray([0, 1, 2, 3, 4, 6, 7, 8, 9])
+
+
+

However, if you pass a StatArray to a numpy function that is not in-place, i.e. creates new memory, the return type will be a numpy array and NOT a StatArray subclass

+
>>> append(x,[3,4,5])
+array([0, 1, 2, ..., 3, 4, 5])
+
+
+
+

See also

+
+
geobipy.src.classes.statistics.Distribution

For possible prior and proposal distributions

+
+
+
+
+
+Bcast(world, root=0)
+

Broadcast the StatArray to every rank in the MPI communicator.

+
+
Parameters:
+
    +
  • world (mpi4py.MPI.Comm) – The MPI communicator over which to broadcast.

  • +
  • root (int, optional) – The rank from which to broadcast. Default is 0 for the master rank.

  • +
+
+
Returns:
+

out – The broadcast StatArray on every rank in the MPI communicator.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+classmethod Irecv(source, world, ndim=None, shape=None, dtype=None)
+
+ +
+
+Isend(dest, world, ndim=None, shape=None, dtype=None)
+
+ +
+
+Scatterv(starts, chunks, world, axis=0, root=0)
+

Scatter variable lengths of the StatArray using MPI

+

Takes the StatArray and gives each core in the world a chunk of the array.

+
+
Parameters:
+
    +
  • starts (array of ints) – 1D array of ints with size equal to the number of MPI ranks. Each element gives the starting index for a chunk to be sent to that core. e.g. starts[0] is the starting index for rank = 0.

  • +
  • chunks (array of ints) – 1D array of ints with size equal to the number of MPI ranks. Each element gives the size of a chunk to be sent to that core. e.g. chunks[0] is the chunk size for rank = 0.

  • +
  • world (mpi4py.MPI.Comm) – The MPI communicator over which to Scatterv.

  • +
  • axis (int, optional) – This axis is distributed amongst ranks.

  • +
  • root (int, optional) – The MPI rank to ScatterV from. Default is 0.

  • +
+
+
Returns:
+

out – The StatArray distributed amongst ranks.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+abs()
+

Take the absolute value. In-place operation.

+
+
Returns:
+

out – Absolute value

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+property address
+
+ +
+
+property addressof
+
+ +
+
+append(values, axis=0)
+

Append to a StatArray

+

Appends values the end of a StatArray. Be careful with repeated calls to this method as it can be slow due to reallocating memory.

+
+
Parameters:
+

values (scalar or array_like) – Numbers to append

+
+
Returns:
+

out – Appended StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+argmax_multiple_to_nan(axis=0)
+

Perform the numpy argmax function on the StatArray but optionally mask multiple max values as NaN.

+
+
Parameters:
+

nan_multiple (bool) – If multiple locations contain the same max value, mask as nan.

+
+
Returns:
+

out – Array of indices into the array. It has the same shape as self.shape +with the dimension along axis removed.

+
+
Return type:
+

ndarray of floats

+
+
+
+ +
+
+bar(x=None, i=None, **kwargs)
+

Plot the StatArray as a bar chart.

+

The values in self are the heights of the bars. Auto labels it if x has type geobipy.StatArray

+
+
Parameters:
+
    +
  • x (array_like or StatArray, optional) – The horizontal locations of the bars

  • +
  • i (sequence of ints, optional) – Plot the ith indices of self, against the ith indices of x.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.bar

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+property bounds
+
+ +
+
+centred_grid_nodes(spacing)
+

Generates grid nodes centred over bounds

+
+
Parameters:
+
    +
  • bounds (array_like) – bounds of the dimension

  • +
  • spacing (float) – distance between nodes

  • +
+
+
+
+ +
+
+copy(order='C')
+

Return a copy of the array.

+
+
Parameters:
+

order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the copy. ‘C’ means C-order, +‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, +‘C’ otherwise. ‘K’ means match the layout of a as closely +as possible. (Note that this function and numpy.copy() are very +similar but have different default values for their order= +arguments, and this function always passes sub-classes through.)

+
+
+
+

See also

+
+
numpy.copy

Similar function with different default behavior

+
+
+

numpy.copyto

+
+

Notes

+

This function is the preferred method for creating an array copy. The +function numpy.copy() is similar, but it defaults to using order ‘K’, +and will not pass sub-classes through by default.

+

Examples

+
>>> x = np.array([[1,2,3],[4,5,6]], order='F')
+
+
+
>>> y = x.copy()
+
+
+
>>> x.fill(0)
+
+
+
>>> x
+array([[0, 0, 0],
+       [0, 0, 0]])
+
+
+
>>> y
+array([[1, 2, 3],
+       [4, 5, 6]])
+
+
+
>>> y.flags['C_CONTIGUOUS']
+True
+
+
+

For arrays containing Python objects (e.g. dtype=object), +the copy is a shallow one. The new array will contain the +same object which may lead to surprises if that object can +be modified (is mutable):

+
>>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
+>>> b = a.copy()
+>>> b[2][0] = 10
+>>> a
+array([1, 'm', list([10, 3, 4])], dtype=object)
+
+
+

To ensure all elements within an object array are copied, +use copy.deepcopy:

+
>>> import copy
+>>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
+>>> c = copy.deepcopy(a)
+>>> c[2][0] = 10
+>>> c
+array([1, 'm', list([10, 3, 4])], dtype=object)
+>>> a
+array([1, 'm', list([2, 3, 4])], dtype=object)
+
+
+
+ +
+
+createHdf(h5obj, name, shape=None, add_axis=None, fillvalue=None, **kwargs)
+

Create the Metadata for a StatArray in a HDF file

+

Creates a new group in a HDF file under h5obj. +A nested heirarchy will be created e.g., myName/data, myName/prior, and myName/proposal. +This method can be used in an MPI parallel environment, if so however, a) the hdf file must have been opened with the mpio driver, +and b) createHdf must be called collectively, i.e., called by every core in the MPI communicator that was used to open the file. +In order to create large amounts of empty space before writing to it in parallel, the nRepeats parameter will extend the memory +in the first dimension.

+
+
Parameters:
+
    +
  • h5obj (h5py.File or h5py.Group) – A HDF file or group object to create the contents in.

  • +
  • myName (str) – The name of the group to create.

  • +
  • withPosterior (bool, optional) – Include the creation of space for any attached posterior.

  • +
  • nRepeats (int, optional) – Inserts a first dimension into the shape of the StatArray of size nRepeats. This can be used to extend the available memory of +the StatArray so that multiple MPI ranks can write to their respective parts in the extended memory.

  • +
  • fillvalue (number, optional) – Initializes the memory in file with the fill value

  • +
+
+
+

Notes

+

This method can be used in serial and MPI. As an example in MPI. +Given 10 MPI ranks, each with a 10 length array, it is faster to create a 10x10 empty array, and have each rank write its row. +Rather than creating 10 separate length 10 arrays because the overhead when creating the file metadata can become very +cumbersome if done too many times.

+

Example

+
>>> from geobipy import StatArray
+>>> from mpi4py import MPI
+>>> import h5py
+
+
+
>>> world = MPI.COMM_WORLD
+
+
+
>>> x = StatArray(4, name='test', units='units')
+>>> x[:] = world.rank
+
+
+
>>> # This is a collective open of data in the file
+>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
+>>> # Collective creation of space(padded by number of mpi ranks)
+>>> x.createHdf(f, 'x', nRepeats=world.size)
+
+
+
>>> world.barrier()
+
+
+
>>> # In a non collective region, we can write to different sections of x in the file
+>>> # Fake a non collective region
+>>> def noncollectivewrite(x, file, world):
+>>>     # Each rank carries out this code, but it's not collective.
+>>>     x.writeHdf(file, 'x', index=world.rank)
+>>> noncollectivewrite(x, f, world)
+
+
+
>>> world.barrier()
+>>> f.close()
+
+
+
+ +
+
+delete(i, axis=None)
+

Delete elements

+
+
Parameters:
+
    +
  • i (slice, int or array of ints) – Indicate which sub-arrays to remove.

  • +
  • axis (int, optional) – The axis along which to delete the subarray defined by obj. +If axis is None, obj is applied to the flattened array.

  • +
+
+
Returns:
+

out – Deepcopy of StatArray with deleted entry(ies).

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+diff(axis=-1)
+
+ +
+
+edges(min=None, max=None, axis=-1)
+

Get the midpoint values between elements in the StatArray

+

Returns an size(self) + 1 length StatArray of the midpoints between each element. +The first and last element are projected edges based on the difference between first two and last two elements in self. +edges[0] = self[0] - 0.5 * (self[1]-self[0]) +edges[-1] = self[-1] + 0.5 * (self[-1] - self[-2]) +If min and max are given, the edges are fixed and not calculated.

+
+
Parameters:
+
    +
  • min (float, optional) – Fix the leftmost edge to min.

  • +
  • max (float, optional) – Fix the rightmost edge to max.

  • +
  • axis (int, optional) – Compute edges along this dimension if > 1D.

  • +
+
+
Returns:
+

out – Edges of the StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+firstNonZero(axis=0, invalid_val=-1)
+

Find the indices of the first non zero values along the axis.

+
+
Parameters:
+
    +
  • axis (int, optional) – Axis along which to find first non zeros.

  • +
  • invalid_val (int, optional) – When zero is not available, return this index.

  • +
+
+
Returns:
+

out – Indices of the first non zero values.

+
+
Return type:
+

array_like

+
+
+
+ +
+
+fit_mixture(mixture_type='gaussian', log=None, mean_bounds=None, variance_bounds=None, k=[1, 5], tolerance=0.05)
+

Uses Gaussian mixture models to fit the histogram.

+

Starts at the minimum number of clusters and adds clusters until the BIC decreases less than the tolerance.

+
+
Parameters:
+
    +
  • nSamples

  • +
  • log

  • +
  • mean_bounds

  • +
  • variance_bounds

  • +
  • k (ints) – Two ints with starting and ending # of clusters

  • +
  • tolerance

  • +
+
+
+
+ +
+
+classmethod fromHdf(grp, name=None, index=None, **kwargs)
+

Read the StatArray from a HDF group

+

Given the HDF group object, read the contents into a StatArray.

+
+
Parameters:
+
    +
  • h5obj (h5py._hl.group.Group) – A HDF group object to write the contents to.

  • +
  • index (slice, optional) – If the group was created using the nRepeats option, index specifies the index’th entry from which to read the data.

  • +
+
+
+
+ +
+
+gaussianMixture(clusterID, trainPercent=75.0, covType=['spherical'], plot=True)
+

Use a Gaussian Mixing Model to classify the data. +clusterID is the initial assignment of the rows to their clusters

+
+ +
+
+getNameUnits()
+

Get the name and units

+

Gets the name and units attached to the StatArray. Units, if present are surrounded by parentheses

+
+
Returns:
+

out – String containing name(units).

+
+
Return type:
+

str

+
+
+
+ +
+
+hasLabels()
+
+ +
+
+property hasPosterior
+
+ +
+
+property hasPrior
+
+ +
+
+property hasProposal
+
+ +
+
+hist(bins=10, **kwargs)
+

Plot a histogram of the StatArray

+

Plots a histogram, estimates the mean and standard deviation and overlays the PDF of a normal distribution with those values, if density=1.

+
+

See also

+
+
geobipy.plotting.hist

For geobipy additional arguments

+
+
matplotlib.pyplot.hist

For histogram related arguments

+
+
+
+

Example

+
>>> from geobipy import StatArray
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+>>> x = StatArray(random.randn(1000), name='name', units='units')
+>>> plt.figure()
+>>> x.hist()
+>>> plt.show()
+
+
+
+ +
+
+index(values)
+

Find the index of values.

+

Assumes that self is monotonically increasing!

+
+
Parameters:
+

values (scalara or array_like) – Find the index of these values.

+
+
Returns:
+

out – Indicies into self.

+
+
Return type:
+

ints

+
+
+
+ +
+
+insert(i, values, axis=0)
+

Insert values

+
+
Parameters:
+
    +
  • i (int, slice or sequence of ints) – Object that defines the index or indices before which values is inserted.

  • +
  • values (array_like) – Values to insert into arr. If the type of values is different from that of arr, values is converted to the type of arr. values should be shaped so that arr[...,obj,...] = values is legal.

  • +
  • axis (int, optional) – Axis along which to insert values. If axis is None then arr is flattened first.

  • +
+
+
Returns:
+

out – StatArray after inserting a value.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+interleave(other)
+

Interleave two arrays together like zip

+
+
Parameters:
+

other (StatArray or array_like) – Must have same size

+
+
Returns:
+

out – Interleaved arrays

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+internalEdges(axis=-1)
+

Get the midpoint values between elements in the StatArray

+

Returns an size(self) + 1 length StatArray of the midpoints between each element

+
+
Returns:
+

out – Edges of the StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+isRegular(axis=-1)
+

Checks that the values change regularly

+
+
Returns:
+

out – Is regularly changing.

+
+
Return type:
+

bool

+
+
+
+ +
+
+kMeans(nClusters, standardize=False, nIterations=10, plot=False, **kwargs)
+

Perform K-Means clustering on the StatArray

+
+ +
+
+property label
+
+ +
+
+lastNonZero(axis=0, invalid_val=-1)
+

Find the indices of the first non zero values along the axis.

+
+
Parameters:
+

axis (int) – Axis along which to find first non zeros.

+
+
Returns:
+

out – Indices of the first non zero values.

+
+
Return type:
+

array_like

+
+
+
+ +
+
+property n_posteriors
+
+ +
+
+property name
+
+ +
+
+nanmax()
+
+ +
+
+nanmin()
+
+ +
+
+normalize(axis=None)
+

Normalize to range 0 - 1.

+
+ +
+
+pad(N)
+

Copies the properties of a StatArray including all priors or proposals, but pads everything to the given size

+
+
Parameters:
+

N (int) – Size to pad to.

+
+
Returns:
+

out – Padded StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+pcolor(x=None, y=None, **kwargs)
+

Create a pseudocolour plot of the StatArray array, Actually uses pcolormesh for speed.

+

If the arguments x and y are geobipy.StatArray classes, the axes can be automatically labelled. +Can take any other matplotlib arguments and keyword arguments e.g. cmap etc.

+
+
Parameters:
+
    +
  • x (1D array_like or StatArray, optional) – Horizontal coordinates of the values edges.

  • +
  • y (1D array_like or StatArray, optional) – Vertical coordinates of the values edges.

  • +
  • alpha (scalar or arrya_like, optional) – If alpha is scalar, behaves like standard matplotlib alpha and opacity is applied to entire plot +If array_like, each pixel is given an individual alpha value.

  • +
  • log ('e' or float, optional) – Take the log of the colour to a base. ‘e’ if log = ‘e’, and a number e.g. log = 10. +Values in c that are <= 0 are masked.

  • +
  • equalize (bool, optional) – Equalize the histogram of the colourmap so that all colours have an equal amount.

  • +
  • nbins (int, optional) – Number of bins to use for histogram equalization.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
  • flipX (bool, optional) – Flip the X axis

  • +
  • flipY (bool, optional) – Flip the Y axis

  • +
  • grid (bool, optional) – Plot the grid

  • +
  • noColorbar (bool, optional) – Turn off the colour bar, useful if multiple plotting plotting routines are used on the same figure.

  • +
  • trim (bool, optional) – Set the x and y limits to the first and last non zero values along each axis.

  • +
  • classes (dict, optional) – A dictionary containing three entries. +classes[‘id’] : array_like of same shape as self containing the class id of each element in self. +classes[‘cmaps’] : list of matplotlib colourmaps. The number of colourmaps should equal the number of classes. +classes[‘labels’] : list of str. The length should equal the number of classes. +If classes is provided, alpha is ignored if provided.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.pcolormesh

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+plot(x=None, i=None, axis=0, **kwargs)
+

Plot self against x

+

If x and y are StatArrays, the axes are automatically labelled.

+
+
Parameters:
+
    +
  • x (array_like or StatArray) – The abcissa

  • +
  • i (sequence of ints, optional) – Plot the ith indices of self, against the ith indices of x.

  • +
  • axis (int, optional) – If self is 2D, plot values along this axis.

  • +
  • log ('e' or float, optional) – Take the log of the colour to a base. ‘e’ if log = ‘e’, and a number e.g. log = 10. +Values in c that are <= 0 are masked.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’.

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
  • flipX (bool, optional) – Flip the X axis

  • +
  • flipY (bool, optional) – Flip the Y axis

  • +
  • labels (bool, optional) – Plot the labels? Default is True.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.plot

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+prepend(values, axis=0)
+

Prepend to a StatArray

+

Prepends numbers to a StatArray, Do not use this too often as it is quite slow

+
+
Parameters:
+

values (scalar or array_like) – A number to prepend.

+
+
Returns:
+

out – StatArray with prepended values.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+property range
+
+ +
+
+rescale(a, b)
+

Rescale to the interval (a, b)

+
+
Parameters:
+
    +
  • a (float) – Lower limit

  • +
  • b (float) – Upper limit

  • +
+
+
Returns:
+

out – Rescaled Array

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+reset_posteriors()
+
+ +
+
+resize(new_shape)
+

Resize a StatArray

+

Resize a StatArray but copy over any attached attributes

+
+
Parameters:
+

new_shape (int or tuple of ints) – Shape of the resized array

+
+
Returns:
+

out – Resized array.

+
+
Return type:
+

StatArray

+
+
+
+

See also

+
+
numpy.resize

For more information.

+
+
+
+
+ +
+
+rolling(numpyFunction, window=1)
+
+ +
+
+scatter(x=None, y=None, i=None, **kwargs)
+

Create a 2D scatter plot.

+

Create a 2D scatter plot, if the y values are not given, the colours are used instead. +If the arrays x, y, and c are geobipy.StatArray classes, the axes are automatically labelled. +Can take any other matplotlib arguments and keyword arguments e.g. markersize etc.

+
+
Parameters:
+
    +
  • x (1D array_like or StatArray) – Horizontal locations of the points to plot

  • +
  • c (1D array_like or StatArray) – Colour values of the points

  • +
  • y (1D array_like or StatArray, optional) – Vertical locations of the points to plot, if y = None, then y = c.

  • +
  • i (sequence of ints, optional) – Plot a subset of x, y, c, using the indices in i.

  • +
+
+
+
+

See also

+
+
geobipy.plotting.Scatter2D

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+smooth(a)
+
+ +
+
+stackedAreaPlot(x=None, i=None, axis=0, labels=[], **kwargs)
+

Create stacked area plot where column elements are stacked on top of each other.

+
+
Parameters:
+
    +
  • x (array_like or StatArray) – The abcissa.

  • +
  • i (sequence of ints, optional) – Plot a subset of x, y, c, using the indices in i.

  • +
  • axis (int) – Plot along this axis, stack along the other axis.

  • +
  • labels (list of str, optional) – The labels to assign to each column.

  • +
  • colors (matplotlib.colors.LinearSegmentedColormap or list of colours) – The colour used for each column.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’.

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.scatterplot

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+standardize(axis=None)
+

Standardize by subtracting the mean and dividing by the standard deviation.

+
+ +
+
+strip_nan()
+
+ +
+
+property summary
+

Write a summary of the StatArray

+
+
Parameters:
+

out (bool) – Whether to return the summary or print to screen

+
+
Returns:
+

out – Summary of StatArray

+
+
Return type:
+

str, optional

+
+
+
+ +
+
+property units
+
+ +
+
+update_posterior(**kwargs)
+

Adds the current values of the StatArray to the attached posterior.

+
+ +
+
+property values
+
+ +
+
+verbose()
+

Explicit print of every element

+
+ +
+
+writeHdf(h5obj, name, index=None, **kwargs)
+

Write the values of a StatArray to a HDF file

+

Writes the contents of the StatArray to an already created group in a HDF file under h5obj. +This method can be used in an MPI parallel environment, if so however, the hdf file must have been opened with the mpio driver. +Unlike createHdf, writeHdf does not have to be called collectively, each rank can call writeHdf independently, +so long as they do not try to write to the same index.

+
+
Parameters:
+
    +
  • h5obj (h5py._hl.files.File or h5py._hl.group.Group) – A HDF file or group object to write the contents to.

  • +
  • myName (str) – The name of the group to write to. The group must have been created previously.

  • +
  • withPosterior (bool, optional) – Include writing any attached posterior.

  • +
  • index (int, optional) – If the group was created using the nRepeats option, index specifies the index’th entry at which to write the data

  • +
+
+
+

Example

+
>>> from geobipy import StatArray
+>>> from mpi4py import MPI
+>>> import h5py
+
+
+
>>> world = MPI.COMM_WORLD
+
+
+
>>> x = StatArray(4, name='test', units='units')
+>>> x[:] = world.rank
+
+
+
>>> # This is a collective open of data in the file
+>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
+>>> # Collective creation of space(padded by number of mpi ranks)
+>>> x.createHdf(f, 'x', nRepeats=world.size)
+
+
+
>>> world.barrier()
+
+
+
>>> # In a non collective region, we can write to different sections of x in the file
+>>> # Fake a non collective region
+>>> def noncollectivewrite(x, file, world):
+>>>     # Each rank carries out this code, but it's not collective.
+>>>     x.writeHdf(file, 'x', index=world.rank)
+>>> noncollectivewrite(x, f, world)
+
+
+
>>> world.barrier()
+>>> f.close()
+
+
+
+ +
+ +
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/content/api/classes/core/StatArray.html b/docs/content/api/classes/core/StatArray.html index 6f71430c..f9d797cd 100644 --- a/docs/content/api/classes/core/StatArray.html +++ b/docs/content/api/classes/core/StatArray.html @@ -104,6 +104,1052 @@

StatArray

+digraph inheritance824f77954e { +bgcolor=transparent; +rankdir=LR; +size="8.0, 12.0"; + "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; + "DataArray" [URL="#geobipy.src.classes.core.DataArray.DataArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class extension to numpy.ndarray"]; + "ndarray" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" [URL="myObject.html#geobipy.src.classes.core.myObject.myObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; + "ABC" -> "myObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "ndarray" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="ndarray(shape, dtype=float, buffer=None, offset=0,"]; +} +
+
+class geobipy.src.classes.core.DataArray.DataArray(shape=None, name=None, units=None, verbose=False, **kwargs)
+

Class extension to numpy.ndarray

+

This subclass to a numpy array contains extra attributes that can describe the parameters it represents. +One can also attach prior and proposal distributions so that it may be used in an MCMC algorithm easily. +Because this is a subclass to numpy, the StatArray contains all numpy array methods and when passed to an +in-place numpy function will return a StatArray. See the example section for more information.

+

StatArray(shape, name=None, units=None, **kwargs)

+
+
Parameters:
+
    +
  • shape (int or sequence of ints or array_like or StatArray) –

      +
    • If shape is int or sequence of ints : give the shape of the new StatArray e.g., 2 or (2, 3). All other arguments that can be passed to functions like numpy.zeros or numpy.arange can be used, see Other Parameters.

    • +
    • If shape is array_like : any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. e.g., StatArray(numpy.arange(10)) will cast the result into a StatArray and will maintain the properies passed through to that function. One could then attach the name, units, prior, and/or proposal through this interface too. e.g., x = StatArray(numpy.arange(10,dtype=numpy.int), name='aTest', units='someUnits')

    • +
    • If shape is StatArray : the returned object is a deepcopy of the input. If name and units are specified with this option they will replace those parameters in the copy. e.g., y = StatArray(x, name='anotherTest') will be a deepcopy copy of x, but with a different name.

    • +
    +

  • +
  • name (str, optional) – The name of the StatArray.

  • +
  • units (str, optional) – The units of the StatArray.

  • +
  • dtype (data-type, optional) – The desired data-type for the array. Default is +numpy.float64. Only used when shape is int or sequence of ints. +The data type could also be a class.

  • +
  • buffer (object exposing buffer interface, optional) – Used to fill the array with data. Only used when shape is int or sequence of ints.

  • +
  • offset (int, optional) – Offset of array data in buffer. Only used when shape is int or sequence of ints.

  • +
  • strides (tuple of ints, optional) – Strides of data in memory. Only used when shape is int or sequence of ints.

  • +
  • order ({'C', 'F', 'A'}, optional) – Specify the order of the array. If order is ‘C’, then the array +will be in C-contiguous order (rightmost-index varies the fastest). +If order is ‘F’, then the returned array will be in +Fortran-contiguous order (leftmost-index varies the fastest). +If order is ‘A’ (default), then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous), +unless a copy is required, in which case it will be C-contiguous. Only used when shape is int or sequence of ints.

  • +
+
+
Returns:
+

out – Extension to numpy.ndarray with additional attributes attached.

+
+
Return type:
+

StatArray

+
+
Raises:
+
    +
  • TypeError – If name is not a str.

  • +
  • TypeError – If units is not a str.

  • +
+
+
+

Notes

+

When the StatArray is passed through a numpy function, the name and units are maintained in the new object. Any priors or proposals are not kept for two reasons. a) keep computational overheads low, b) assume that a possible change in size or meaning of a parameter warrants a change in any attached distributions.

+

Examples

+

Since the StatArray is an extension to numpy, all numpy attached methods can be used.

+
>>> from geobipy import StatArray
+>>> import numpy as np
+>>> x = StatArray(arange(10), name='test', units='units')
+>>> print(x.mean())
+4.5
+
+
+

If the StatArray is passed to a numpy function that does not return a new instantiation, a StatArray will be returned (as opposed to a numpy array)

+
>>> delete(x, 5)
+StatArray([0, 1, 2, 3, 4, 6, 7, 8, 9])
+
+
+

However, if you pass a StatArray to a numpy function that is not in-place, i.e. creates new memory, the return type will be a numpy array and NOT a StatArray subclass

+
>>> append(x,[3,4,5])
+array([0, 1, 2, ..., 3, 4, 5])
+
+
+
+

See also

+
+
geobipy.src.classes.statistics.Distribution

For possible prior and proposal distributions

+
+
+
+
+
+Bcast(world, root=0)
+

Broadcast the StatArray to every rank in the MPI communicator.

+
+
Parameters:
+
    +
  • world (mpi4py.MPI.Comm) – The MPI communicator over which to broadcast.

  • +
  • root (int, optional) – The rank from which to broadcast. Default is 0 for the master rank.

  • +
+
+
Returns:
+

out – The broadcast StatArray on every rank in the MPI communicator.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+classmethod Irecv(source, world, ndim=None, shape=None, dtype=None)
+
+ +
+
+Isend(dest, world, ndim=None, shape=None, dtype=None)
+
+ +
+
+Scatterv(starts, chunks, world, axis=0, root=0)
+

Scatter variable lengths of the StatArray using MPI

+

Takes the StatArray and gives each core in the world a chunk of the array.

+
+
Parameters:
+
    +
  • starts (array of ints) – 1D array of ints with size equal to the number of MPI ranks. Each element gives the starting index for a chunk to be sent to that core. e.g. starts[0] is the starting index for rank = 0.

  • +
  • chunks (array of ints) – 1D array of ints with size equal to the number of MPI ranks. Each element gives the size of a chunk to be sent to that core. e.g. chunks[0] is the chunk size for rank = 0.

  • +
  • world (mpi4py.MPI.Comm) – The MPI communicator over which to Scatterv.

  • +
  • axis (int, optional) – This axis is distributed amongst ranks.

  • +
  • root (int, optional) – The MPI rank to ScatterV from. Default is 0.

  • +
+
+
Returns:
+

out – The StatArray distributed amongst ranks.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+abs()
+

Take the absolute value. In-place operation.

+
+
Returns:
+

out – Absolute value

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+property address
+
+ +
+
+property addressof
+
+ +
+
+append(values, axis=0)
+

Append to a StatArray

+

Appends values the end of a StatArray. Be careful with repeated calls to this method as it can be slow due to reallocating memory.

+
+
Parameters:
+

values (scalar or array_like) – Numbers to append

+
+
Returns:
+

out – Appended StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+argmax_multiple_to_nan(axis=0)
+

Perform the numpy argmax function on the StatArray but optionally mask multiple max values as NaN.

+
+
Parameters:
+

nan_multiple (bool) – If multiple locations contain the same max value, mask as nan.

+
+
Returns:
+

out – Array of indices into the array. It has the same shape as self.shape +with the dimension along axis removed.

+
+
Return type:
+

ndarray of floats

+
+
+
+ +
+
+bar(x=None, i=None, **kwargs)
+

Plot the StatArray as a bar chart.

+

The values in self are the heights of the bars. Auto labels it if x has type geobipy.StatArray

+
+
Parameters:
+
    +
  • x (array_like or StatArray, optional) – The horizontal locations of the bars

  • +
  • i (sequence of ints, optional) – Plot the ith indices of self, against the ith indices of x.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.bar

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+property bounds
+
+ +
+
+centred_grid_nodes(spacing)
+

Generates grid nodes centred over bounds

+
+
Parameters:
+
    +
  • bounds (array_like) – bounds of the dimension

  • +
  • spacing (float) – distance between nodes

  • +
+
+
+
+ +
+
+copy(order='C')
+

Return a copy of the array.

+
+
Parameters:
+

order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the copy. ‘C’ means C-order, +‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, +‘C’ otherwise. ‘K’ means match the layout of a as closely +as possible. (Note that this function and numpy.copy() are very +similar but have different default values for their order= +arguments, and this function always passes sub-classes through.)

+
+
+
+

See also

+
+
numpy.copy

Similar function with different default behavior

+
+
+

numpy.copyto

+
+

Notes

+

This function is the preferred method for creating an array copy. The +function numpy.copy() is similar, but it defaults to using order ‘K’, +and will not pass sub-classes through by default.

+

Examples

+
>>> x = np.array([[1,2,3],[4,5,6]], order='F')
+
+
+
>>> y = x.copy()
+
+
+
>>> x.fill(0)
+
+
+
>>> x
+array([[0, 0, 0],
+       [0, 0, 0]])
+
+
+
>>> y
+array([[1, 2, 3],
+       [4, 5, 6]])
+
+
+
>>> y.flags['C_CONTIGUOUS']
+True
+
+
+

For arrays containing Python objects (e.g. dtype=object), +the copy is a shallow one. The new array will contain the +same object which may lead to surprises if that object can +be modified (is mutable):

+
>>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
+>>> b = a.copy()
+>>> b[2][0] = 10
+>>> a
+array([1, 'm', list([10, 3, 4])], dtype=object)
+
+
+

To ensure all elements within an object array are copied, +use copy.deepcopy:

+
>>> import copy
+>>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
+>>> c = copy.deepcopy(a)
+>>> c[2][0] = 10
+>>> c
+array([1, 'm', list([10, 3, 4])], dtype=object)
+>>> a
+array([1, 'm', list([2, 3, 4])], dtype=object)
+
+
+
+ +
+
+createHdf(h5obj, name, shape=None, add_axis=None, fillvalue=None, **kwargs)
+

Create the Metadata for a StatArray in a HDF file

+

Creates a new group in a HDF file under h5obj. +A nested heirarchy will be created e.g., myName/data, myName/prior, and myName/proposal. +This method can be used in an MPI parallel environment, if so however, a) the hdf file must have been opened with the mpio driver, +and b) createHdf must be called collectively, i.e., called by every core in the MPI communicator that was used to open the file. +In order to create large amounts of empty space before writing to it in parallel, the nRepeats parameter will extend the memory +in the first dimension.

+
+
Parameters:
+
    +
  • h5obj (h5py.File or h5py.Group) – A HDF file or group object to create the contents in.

  • +
  • myName (str) – The name of the group to create.

  • +
  • withPosterior (bool, optional) – Include the creation of space for any attached posterior.

  • +
  • nRepeats (int, optional) – Inserts a first dimension into the shape of the StatArray of size nRepeats. This can be used to extend the available memory of +the StatArray so that multiple MPI ranks can write to their respective parts in the extended memory.

  • +
  • fillvalue (number, optional) – Initializes the memory in file with the fill value

  • +
+
+
+

Notes

+

This method can be used in serial and MPI. As an example in MPI. +Given 10 MPI ranks, each with a 10 length array, it is faster to create a 10x10 empty array, and have each rank write its row. +Rather than creating 10 separate length 10 arrays because the overhead when creating the file metadata can become very +cumbersome if done too many times.

+

Example

+
>>> from geobipy import StatArray
+>>> from mpi4py import MPI
+>>> import h5py
+
+
+
>>> world = MPI.COMM_WORLD
+
+
+
>>> x = StatArray(4, name='test', units='units')
+>>> x[:] = world.rank
+
+
+
>>> # This is a collective open of data in the file
+>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
+>>> # Collective creation of space(padded by number of mpi ranks)
+>>> x.createHdf(f, 'x', nRepeats=world.size)
+
+
+
>>> world.barrier()
+
+
+
>>> # In a non collective region, we can write to different sections of x in the file
+>>> # Fake a non collective region
+>>> def noncollectivewrite(x, file, world):
+>>>     # Each rank carries out this code, but it's not collective.
+>>>     x.writeHdf(file, 'x', index=world.rank)
+>>> noncollectivewrite(x, f, world)
+
+
+
>>> world.barrier()
+>>> f.close()
+
+
+
+ +
+
+delete(i, axis=None)
+

Delete elements

+
+
Parameters:
+
    +
  • i (slice, int or array of ints) – Indicate which sub-arrays to remove.

  • +
  • axis (int, optional) – The axis along which to delete the subarray defined by obj. +If axis is None, obj is applied to the flattened array.

  • +
+
+
Returns:
+

out – Deepcopy of StatArray with deleted entry(ies).

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+diff(axis=-1)
+
+ +
+
+edges(min=None, max=None, axis=-1)
+

Get the midpoint values between elements in the StatArray

+

Returns an size(self) + 1 length StatArray of the midpoints between each element. +The first and last element are projected edges based on the difference between first two and last two elements in self. +edges[0] = self[0] - 0.5 * (self[1]-self[0]) +edges[-1] = self[-1] + 0.5 * (self[-1] - self[-2]) +If min and max are given, the edges are fixed and not calculated.

+
+
Parameters:
+
    +
  • min (float, optional) – Fix the leftmost edge to min.

  • +
  • max (float, optional) – Fix the rightmost edge to max.

  • +
  • axis (int, optional) – Compute edges along this dimension if > 1D.

  • +
+
+
Returns:
+

out – Edges of the StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+firstNonZero(axis=0, invalid_val=-1)
+

Find the indices of the first non zero values along the axis.

+
+
Parameters:
+
    +
  • axis (int, optional) – Axis along which to find first non zeros.

  • +
  • invalid_val (int, optional) – When zero is not available, return this index.

  • +
+
+
Returns:
+

out – Indices of the first non zero values.

+
+
Return type:
+

array_like

+
+
+
+ +
+
+fit_mixture(mixture_type='gaussian', log=None, mean_bounds=None, variance_bounds=None, k=[1, 5], tolerance=0.05)
+

Uses Gaussian mixture models to fit the histogram.

+

Starts at the minimum number of clusters and adds clusters until the BIC decreases less than the tolerance.

+
+
Parameters:
+
    +
  • nSamples

  • +
  • log

  • +
  • mean_bounds

  • +
  • variance_bounds

  • +
  • k (ints) – Two ints with starting and ending # of clusters

  • +
  • tolerance

  • +
+
+
+
+ +
+
+classmethod fromHdf(grp, name=None, index=None, **kwargs)
+

Read the StatArray from a HDF group

+

Given the HDF group object, read the contents into a StatArray.

+
+
Parameters:
+
    +
  • h5obj (h5py._hl.group.Group) – A HDF group object to write the contents to.

  • +
  • index (slice, optional) – If the group was created using the nRepeats option, index specifies the index’th entry from which to read the data.

  • +
+
+
+
+ +
+
+gaussianMixture(clusterID, trainPercent=75.0, covType=['spherical'], plot=True)
+

Use a Gaussian Mixing Model to classify the data. +clusterID is the initial assignment of the rows to their clusters

+
+ +
+
+getNameUnits()
+

Get the name and units

+

Gets the name and units attached to the StatArray. Units, if present are surrounded by parentheses

+
+
Returns:
+

out – String containing name(units).

+
+
Return type:
+

str

+
+
+
+ +
+
+hasLabels()
+
+ +
+
+property hasPosterior
+
+ +
+
+property hasPrior
+
+ +
+
+property hasProposal
+
+ +
+
+hist(bins=10, **kwargs)
+

Plot a histogram of the StatArray

+

Plots a histogram, estimates the mean and standard deviation and overlays the PDF of a normal distribution with those values, if density=1.

+
+

See also

+
+
geobipy.plotting.hist

For geobipy additional arguments

+
+
matplotlib.pyplot.hist

For histogram related arguments

+
+
+
+

Example

+
>>> from geobipy import StatArray
+>>> import numpy as np
+>>> import matplotlib.pyplot as plt
+>>> x = StatArray(random.randn(1000), name='name', units='units')
+>>> plt.figure()
+>>> x.hist()
+>>> plt.show()
+
+
+
+ +
+
+index(values)
+

Find the index of values.

+

Assumes that self is monotonically increasing!

+
+
Parameters:
+

values (scalara or array_like) – Find the index of these values.

+
+
Returns:
+

out – Indicies into self.

+
+
Return type:
+

ints

+
+
+
+ +
+
+insert(i, values, axis=0)
+

Insert values

+
+
Parameters:
+
    +
  • i (int, slice or sequence of ints) – Object that defines the index or indices before which values is inserted.

  • +
  • values (array_like) – Values to insert into arr. If the type of values is different from that of arr, values is converted to the type of arr. values should be shaped so that arr[...,obj,...] = values is legal.

  • +
  • axis (int, optional) – Axis along which to insert values. If axis is None then arr is flattened first.

  • +
+
+
Returns:
+

out – StatArray after inserting a value.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+interleave(other)
+

Interleave two arrays together like zip

+
+
Parameters:
+

other (StatArray or array_like) – Must have same size

+
+
Returns:
+

out – Interleaved arrays

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+internalEdges(axis=-1)
+

Get the midpoint values between elements in the StatArray

+

Returns an size(self) + 1 length StatArray of the midpoints between each element

+
+
Returns:
+

out – Edges of the StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+isRegular(axis=-1)
+

Checks that the values change regularly

+
+
Returns:
+

out – Is regularly changing.

+
+
Return type:
+

bool

+
+
+
+ +
+
+kMeans(nClusters, standardize=False, nIterations=10, plot=False, **kwargs)
+

Perform K-Means clustering on the StatArray

+
+ +
+
+property label
+
+ +
+
+lastNonZero(axis=0, invalid_val=-1)
+

Find the indices of the first non zero values along the axis.

+
+
Parameters:
+

axis (int) – Axis along which to find first non zeros.

+
+
Returns:
+

out – Indices of the first non zero values.

+
+
Return type:
+

array_like

+
+
+
+ +
+
+property n_posteriors
+
+ +
+
+property name
+
+ +
+
+nanmax()
+
+ +
+
+nanmin()
+
+ +
+
+normalize(axis=None)
+

Normalize to range 0 - 1.

+
+ +
+
+pad(N)
+

Copies the properties of a StatArray including all priors or proposals, but pads everything to the given size

+
+
Parameters:
+

N (int) – Size to pad to.

+
+
Returns:
+

out – Padded StatArray

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+pcolor(x=None, y=None, **kwargs)
+

Create a pseudocolour plot of the StatArray array, Actually uses pcolormesh for speed.

+

If the arguments x and y are geobipy.StatArray classes, the axes can be automatically labelled. +Can take any other matplotlib arguments and keyword arguments e.g. cmap etc.

+
+
Parameters:
+
    +
  • x (1D array_like or StatArray, optional) – Horizontal coordinates of the values edges.

  • +
  • y (1D array_like or StatArray, optional) – Vertical coordinates of the values edges.

  • +
  • alpha (scalar or arrya_like, optional) – If alpha is scalar, behaves like standard matplotlib alpha and opacity is applied to entire plot +If array_like, each pixel is given an individual alpha value.

  • +
  • log ('e' or float, optional) – Take the log of the colour to a base. ‘e’ if log = ‘e’, and a number e.g. log = 10. +Values in c that are <= 0 are masked.

  • +
  • equalize (bool, optional) – Equalize the histogram of the colourmap so that all colours have an equal amount.

  • +
  • nbins (int, optional) – Number of bins to use for histogram equalization.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
  • flipX (bool, optional) – Flip the X axis

  • +
  • flipY (bool, optional) – Flip the Y axis

  • +
  • grid (bool, optional) – Plot the grid

  • +
  • noColorbar (bool, optional) – Turn off the colour bar, useful if multiple plotting plotting routines are used on the same figure.

  • +
  • trim (bool, optional) – Set the x and y limits to the first and last non zero values along each axis.

  • +
  • classes (dict, optional) – A dictionary containing three entries. +classes[‘id’] : array_like of same shape as self containing the class id of each element in self. +classes[‘cmaps’] : list of matplotlib colourmaps. The number of colourmaps should equal the number of classes. +classes[‘labels’] : list of str. The length should equal the number of classes. +If classes is provided, alpha is ignored if provided.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.pcolormesh

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+plot(x=None, i=None, axis=0, **kwargs)
+

Plot self against x

+

If x and y are StatArrays, the axes are automatically labelled.

+
+
Parameters:
+
    +
  • x (array_like or StatArray) – The abcissa

  • +
  • i (sequence of ints, optional) – Plot the ith indices of self, against the ith indices of x.

  • +
  • axis (int, optional) – If self is 2D, plot values along this axis.

  • +
  • log ('e' or float, optional) – Take the log of the colour to a base. ‘e’ if log = ‘e’, and a number e.g. log = 10. +Values in c that are <= 0 are masked.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’.

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
  • flipX (bool, optional) – Flip the X axis

  • +
  • flipY (bool, optional) – Flip the Y axis

  • +
  • labels (bool, optional) – Plot the labels? Default is True.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.plot

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+prepend(values, axis=0)
+

Prepend to a StatArray

+

Prepends numbers to a StatArray, Do not use this too often as it is quite slow

+
+
Parameters:
+

values (scalar or array_like) – A number to prepend.

+
+
Returns:
+

out – StatArray with prepended values.

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+property range
+
+ +
+
+rescale(a, b)
+

Rescale to the interval (a, b)

+
+
Parameters:
+
    +
  • a (float) – Lower limit

  • +
  • b (float) – Upper limit

  • +
+
+
Returns:
+

out – Rescaled Array

+
+
Return type:
+

StatArray

+
+
+
+ +
+
+reset_posteriors()
+
+ +
+
+resize(new_shape)
+

Resize a StatArray

+

Resize a StatArray but copy over any attached attributes

+
+
Parameters:
+

new_shape (int or tuple of ints) – Shape of the resized array

+
+
Returns:
+

out – Resized array.

+
+
Return type:
+

StatArray

+
+
+
+

See also

+
+
numpy.resize

For more information.

+
+
+
+
+ +
+
+rolling(numpyFunction, window=1)
+
+ +
+
+scatter(x=None, y=None, i=None, **kwargs)
+

Create a 2D scatter plot.

+

Create a 2D scatter plot, if the y values are not given, the colours are used instead. +If the arrays x, y, and c are geobipy.StatArray classes, the axes are automatically labelled. +Can take any other matplotlib arguments and keyword arguments e.g. markersize etc.

+
+
Parameters:
+
    +
  • x (1D array_like or StatArray) – Horizontal locations of the points to plot

  • +
  • c (1D array_like or StatArray) – Colour values of the points

  • +
  • y (1D array_like or StatArray, optional) – Vertical locations of the points to plot, if y = None, then y = c.

  • +
  • i (sequence of ints, optional) – Plot a subset of x, y, c, using the indices in i.

  • +
+
+
+
+

See also

+
+
geobipy.plotting.Scatter2D

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+smooth(a)
+
+ +
+
+stackedAreaPlot(x=None, i=None, axis=0, labels=[], **kwargs)
+

Create stacked area plot where column elements are stacked on top of each other.

+
+
Parameters:
+
    +
  • x (array_like or StatArray) – The abcissa.

  • +
  • i (sequence of ints, optional) – Plot a subset of x, y, c, using the indices in i.

  • +
  • axis (int) – Plot along this axis, stack along the other axis.

  • +
  • labels (list of str, optional) – The labels to assign to each column.

  • +
  • colors (matplotlib.colors.LinearSegmentedColormap or list of colours) – The colour used for each column.

  • +
  • xscale (str, optional) – Scale the x axis? e.g. xscale = ‘linear’ or ‘log’.

  • +
  • yscale (str, optional) – Scale the y axis? e.g. yscale = ‘linear’ or ‘log’.

  • +
+
+
Returns:
+

matplotlib .Axes

+
+
Return type:
+

ax

+
+
+
+

See also

+
+
matplotlib.pyplot.scatterplot

For additional keyword arguments you may use.

+
+
+
+
+ +
+
+standardize(axis=None)
+

Standardize by subtracting the mean and dividing by the standard deviation.

+
+ +
+
+strip_nan()
+
+ +
+
+property summary
+

Write a summary of the StatArray

+
+
Parameters:
+

out (bool) – Whether to return the summary or print to screen

+
+
Returns:
+

out – Summary of StatArray

+
+
Return type:
+

str, optional

+
+
+
+ +
+
+property units
+
+ +
+
+update_posterior(**kwargs)
+

Adds the current values of the StatArray to the attached posterior.

+
+ +
+
+property values
+
+ +
+
+verbose()
+

Explicit print of every element

+
+ +
+
+writeHdf(h5obj, name, index=None, **kwargs)
+

Write the values of a StatArray to a HDF file

+

Writes the contents of the StatArray to an already created group in a HDF file under h5obj. +This method can be used in an MPI parallel environment, if so however, the hdf file must have been opened with the mpio driver. +Unlike createHdf, writeHdf does not have to be called collectively, each rank can call writeHdf independently, +so long as they do not try to write to the same index.

+
+
Parameters:
+
    +
  • h5obj (h5py._hl.files.File or h5py._hl.group.Group) – A HDF file or group object to write the contents to.

  • +
  • myName (str) – The name of the group to write to. The group must have been created previously.

  • +
  • withPosterior (bool, optional) – Include writing any attached posterior.

  • +
  • index (int, optional) – If the group was created using the nRepeats option, index specifies the index’th entry at which to write the data

  • +
+
+
+

Example

+
>>> from geobipy import StatArray
+>>> from mpi4py import MPI
+>>> import h5py
+
+
+
>>> world = MPI.COMM_WORLD
+
+
+
>>> x = StatArray(4, name='test', units='units')
+>>> x[:] = world.rank
+
+
+
>>> # This is a collective open of data in the file
+>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
+>>> # Collective creation of space(padded by number of mpi ranks)
+>>> x.createHdf(f, 'x', nRepeats=world.size)
+
+
+
>>> world.barrier()
+
+
+
>>> # In a non collective region, we can write to different sections of x in the file
+>>> # Fake a non collective region
+>>> def noncollectivewrite(x, file, world):
+>>>     # Each rank carries out this code, but it's not collective.
+>>>     x.writeHdf(file, 'x', index=world.rank)
+>>> noncollectivewrite(x, f, world)
+
+
+
>>> world.barrier()
+>>> f.close()
+
+
+
+ +
+
diff --git a/docs/content/api/classes/core/core.html b/docs/content/api/classes/core/core.html index f6c3131f..eea367e5 100644 --- a/docs/content/api/classes/core/core.html +++ b/docs/content/api/classes/core/core.html @@ -59,7 +59,7 @@
  • Classes used in GeoBIPy
  • diff --git a/docs/content/api/classes/data/datapoint/datapoint.html b/docs/content/api/classes/data/datapoint/datapoint.html index 421edffa..a9f44248 100644 --- a/docs/content/api/classes/data/datapoint/datapoint.html +++ b/docs/content/api/classes/data/datapoint/datapoint.html @@ -205,7 +205,7 @@

    DataPointReturn type: -

    StatArray

    +

    StatArray

    diff --git a/docs/content/api/classes/data/dataset/Data.html b/docs/content/api/classes/data/dataset/Data.html index 6424ee2c..714eee76 100644 --- a/docs/content/api/classes/data/dataset/Data.html +++ b/docs/content/api/classes/data/dataset/Data.html @@ -324,7 +324,7 @@

    Data<

    out – The residual between the active observed and predicted data.

    Return type:
    -

    StatArray

    +

    StatArray

    diff --git a/docs/content/api/classes/mesh/RectilinearMesh2D.html b/docs/content/api/classes/mesh/RectilinearMesh2D.html index b9c92c1f..e4d0ffa6 100644 --- a/docs/content/api/classes/mesh/RectilinearMesh2D.html +++ b/docs/content/api/classes/mesh/RectilinearMesh2D.html @@ -395,7 +395,7 @@

    RectilinearMesh2D
    Parameters:
      -
    • values (array_like or StatArray) – A 2D array of colour values.

    • +
    • values (array_like or StatArray) – A 2D array of colour values.

    • xAxis (str) – If xAxis is ‘x’, the horizontal xAxis uses self.x If xAxis is ‘y’, the horizontal xAxis uses self.y If xAxis is ‘r’, the horizontal xAxis uses cumulative distance along the line

    • diff --git a/docs/content/api/classes/mesh/RectilinearMesh2D_stitched.html b/docs/content/api/classes/mesh/RectilinearMesh2D_stitched.html index b3a43446..ff1e012b 100644 --- a/docs/content/api/classes/mesh/RectilinearMesh2D_stitched.html +++ b/docs/content/api/classes/mesh/RectilinearMesh2D_stitched.html @@ -161,7 +161,7 @@

      RectilinearMesh2D_stitched
      Parameters:
        -
      • values (array_like or StatArray) – A 2D array of colour values.

      • +
      • values (array_like or StatArray) – A 2D array of colour values.

      • xAxis (str) – If xAxis is ‘x’, the horizontal xAxis uses self.x If xAxis is ‘y’, the horizontal xAxis uses self.y If xAxis is ‘r’, the horizontal xAxis uses cumulative distance along the line

      • diff --git a/docs/content/api/classes/pointcloud/Point.html b/docs/content/api/classes/pointcloud/Point.html index 06408348..85290325 100644 --- a/docs/content/api/classes/pointcloud/Point.html +++ b/docs/content/api/classes/pointcloud/Point.html @@ -475,7 +475,7 @@

        Point
        Parameters:
          -
        • c (1D array_like or StatArray, optional) – Colour values of the points, default is the height of the points

        • +
        • c (1D array_like or StatArray, optional) – Colour values of the points, default is the height of the points

        • i (sequence of ints, optional) – Plot a subset of x, y, c, using the indices in i.

        diff --git a/docs/content/api/classes/statistics/Histogram.html b/docs/content/api/classes/statistics/Histogram.html index 55b2e74c..daa9c0bb 100644 --- a/docs/content/api/classes/statistics/Histogram.html +++ b/docs/content/api/classes/statistics/Histogram.html @@ -63,6 +63,7 @@
      • Model classes
      • Pointcloud classes
      • Statistics classes
          +
        • StatArray
        • Distribution Wrapper
        • Histogram
        • baseDistribution
        • diff --git a/docs/content/api/classes/statistics/MvNormalDistribution.html b/docs/content/api/classes/statistics/MvNormalDistribution.html index 413021c9..f0066c37 100644 --- a/docs/content/api/classes/statistics/MvNormalDistribution.html +++ b/docs/content/api/classes/statistics/MvNormalDistribution.html @@ -63,6 +63,7 @@
        • Model classes
        • Pointcloud classes
        • Statistics classes
            +
          • StatArray
          • Distribution Wrapper
          • Histogram
          • baseDistribution
          • diff --git a/docs/content/api/classes/statistics/NormalDistribution.html b/docs/content/api/classes/statistics/NormalDistribution.html index 1fc47d3e..467ab56b 100644 --- a/docs/content/api/classes/statistics/NormalDistribution.html +++ b/docs/content/api/classes/statistics/NormalDistribution.html @@ -63,6 +63,7 @@
          • Model classes
          • Pointcloud classes
          • Statistics classes
              +
            • StatArray
            • Distribution Wrapper
            • Histogram
            • baseDistribution
            • diff --git a/docs/content/api/classes/statistics/StatArray.html b/docs/content/api/classes/statistics/StatArray.html new file mode 100644 index 00000000..e7b93ad6 --- /dev/null +++ b/docs/content/api/classes/statistics/StatArray.html @@ -0,0 +1,786 @@ + + + + + + + StatArray — GeoBIPy 2.3.1 documentation + + + + + + + + + + + + + + + + + + + + + + + + +
              + + +
              + +
              +
              + +
              +
              + +
              +

              StatArray

              +digraph inheritanced8e76283df { +bgcolor=transparent; +rankdir=LR; +size="8.0, 12.0"; + "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; + "DataArray" [URL="../core/DataArray.html#geobipy.src.classes.core.DataArray.DataArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class extension to numpy.ndarray"]; + "ndarray" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" -> "DataArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "StatArray" [URL="#geobipy.src.classes.statistics.StatArray.StatArray",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Class extension to numpy.ndarray"]; + "DataArray" -> "StatArray" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "myObject" [URL="../core/myObject.html#geobipy.src.classes.core.myObject.myObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; + "ABC" -> "myObject" [arrowsize=0.5,style="setlinewidth(0.5)"]; + "ndarray" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="ndarray(shape, dtype=float, buffer=None, offset=0,"]; +} +
              +
              +class geobipy.src.classes.statistics.StatArray.StatArray(shape=None, name=None, units=None, verbose=False, **kwargs)
              +

              Class extension to numpy.ndarray

              +

              This subclass to a numpy array contains extra attributes that can describe the parameters it represents. +One can also attach prior and proposal distributions so that it may be used in an MCMC algorithm easily. +Because this is a subclass to numpy, the StatArray contains all numpy array methods and when passed to an +in-place numpy function will return a StatArray. See the example section for more information.

              +

              StatArray(shape, name=None, units=None, **kwargs)

              +
              +
              Parameters:
              +
                +
              • shape (int or sequence of ints or array_like or StatArray) –

                  +
                • If shape is int or sequence of ints : give the shape of the new StatArray e.g., 2 or (2, 3). All other arguments that can be passed to functions like numpy.zeros or numpy.arange can be used, see Other Parameters.

                • +
                • If shape is array_like : any object exposing the array interface, an object whose __array__ method returns an array, or any (nested) sequence. e.g., StatArray(numpy.arange(10)) will cast the result into a StatArray and will maintain the properies passed through to that function. One could then attach the name, units, prior, and/or proposal through this interface too. e.g., x = StatArray(numpy.arange(10,dtype=numpy.int), name='aTest', units='someUnits')

                • +
                • If shape is StatArray : the returned object is a deepcopy of the input. If name and units are specified with this option they will replace those parameters in the copy. e.g., y = StatArray(x, name='anotherTest') will be a deepcopy copy of x, but with a different name.

                • +
                +

              • +
              • name (str, optional) – The name of the StatArray.

              • +
              • units (str, optional) – The units of the StatArray.

              • +
              • dtype (data-type, optional) – The desired data-type for the array. Default is +numpy.float64. Only used when shape is int or sequence of ints. +The data type could also be a class.

              • +
              • buffer (object exposing buffer interface, optional) – Used to fill the array with data. Only used when shape is int or sequence of ints.

              • +
              • offset (int, optional) – Offset of array data in buffer. Only used when shape is int or sequence of ints.

              • +
              • strides (tuple of ints, optional) – Strides of data in memory. Only used when shape is int or sequence of ints.

              • +
              • order ({'C', 'F', 'A'}, optional) – Specify the order of the array. If order is ‘C’, then the array +will be in C-contiguous order (rightmost-index varies the fastest). +If order is ‘F’, then the returned array will be in +Fortran-contiguous order (leftmost-index varies the fastest). +If order is ‘A’ (default), then the returned array may be in any order (either C-, Fortran-contiguous, or even discontiguous), +unless a copy is required, in which case it will be C-contiguous. Only used when shape is int or sequence of ints.

              • +
              +
              +
              Returns:
              +

              out – Extension to numpy.ndarray with additional attributes attached.

              +
              +
              Return type:
              +

              StatArray

              +
              +
              Raises:
              +
                +
              • TypeError – If name is not a str.

              • +
              • TypeError – If units is not a str.

              • +
              +
              +
              +

              Notes

              +

              When the StatArray is passed through a numpy function, the name and units are maintained in the new object. Any priors or proposals are not kept for two reasons. a) keep computational overheads low, b) assume that a possible change in size or meaning of a parameter warrants a change in any attached distributions.

              +

              Examples

              +

              Since the StatArray is an extension to numpy, all numpy attached methods can be used.

              +
              >>> from geobipy import StatArray
              +>>> import numpy as np
              +>>> x = StatArray(arange(10), name='test', units='units')
              +>>> print(x.mean())
              +4.5
              +
              +
              +

              If the StatArray is passed to a numpy function that does not return a new instantiation, a StatArray will be returned (as opposed to a numpy array)

              +
              >>> delete(x, 5)
              +StatArray([0, 1, 2, 3, 4, 6, 7, 8, 9])
              +
              +
              +

              However, if you pass a StatArray to a numpy function that is not in-place, i.e. creates new memory, the return type will be a numpy array and NOT a StatArray subclass

              +
              >>> append(x,[3,4,5])
              +array([0, 1, 2, ..., 3, 4, 5])
              +
              +
              +
              +

              See also

              +
              +
              geobipy.src.classes.statistics.Distribution

              For possible prior and proposal distributions

              +
              +
              +
              +
              +
              +property address
              +
              + +
              +
              +property addressof
              +
              + +
              +
              +centred_grid_nodes(spacing)
              +

              Generates grid nodes centred over bounds

              +
              +
              Parameters:
              +
                +
              • bounds (array_like) – bounds of the dimension

              • +
              • spacing (float) – distance between nodes

              • +
              +
              +
              +
              + +
              +
              +copy(order='C')
              +

              Return a copy of the array.

              +
              +
              Parameters:
              +

              order ({'C', 'F', 'A', 'K'}, optional) – Controls the memory layout of the copy. ‘C’ means C-order, +‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, +‘C’ otherwise. ‘K’ means match the layout of a as closely +as possible. (Note that this function and numpy.copy() are very +similar but have different default values for their order= +arguments, and this function always passes sub-classes through.)

              +
              +
              +
              +

              See also

              +
              +
              numpy.copy

              Similar function with different default behavior

              +
              +
              +

              numpy.copyto

              +
              +

              Notes

              +

              This function is the preferred method for creating an array copy. The +function numpy.copy() is similar, but it defaults to using order ‘K’, +and will not pass sub-classes through by default.

              +

              Examples

              +
              >>> x = np.array([[1,2,3],[4,5,6]], order='F')
              +
              +
              +
              >>> y = x.copy()
              +
              +
              +
              >>> x.fill(0)
              +
              +
              +
              >>> x
              +array([[0, 0, 0],
              +       [0, 0, 0]])
              +
              +
              +
              >>> y
              +array([[1, 2, 3],
              +       [4, 5, 6]])
              +
              +
              +
              >>> y.flags['C_CONTIGUOUS']
              +True
              +
              +
              +

              For arrays containing Python objects (e.g. dtype=object), +the copy is a shallow one. The new array will contain the +same object which may lead to surprises if that object can +be modified (is mutable):

              +
              >>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
              +>>> b = a.copy()
              +>>> b[2][0] = 10
              +>>> a
              +array([1, 'm', list([10, 3, 4])], dtype=object)
              +
              +
              +

              To ensure all elements within an object array are copied, +use copy.deepcopy:

              +
              >>> import copy
              +>>> a = np.array([1, 'm', [2, 3, 4]], dtype=object)
              +>>> c = copy.deepcopy(a)
              +>>> c[2][0] = 10
              +>>> c
              +array([1, 'm', list([10, 3, 4])], dtype=object)
              +>>> a
              +array([1, 'm', list([2, 3, 4])], dtype=object)
              +
              +
              +
              + +
              +
              +copyStats(other)
              +

              Copy statistical properties from other to self

              +

              [extended_summary]

              +
              +
              Parameters:
              +

              other ([type]) – [description]

              +
              +
              +
              + +
              +
              +createHdf(h5obj, name, shape=None, withPosterior=True, add_axis=None, fillvalue=None, upcast=True)
              +

              Create the Metadata for a StatArray in a HDF file

              +

              Creates a new group in a HDF file under h5obj. +A nested heirarchy will be created e.g., myName/data, myName/prior, and myName/proposal. +This method can be used in an MPI parallel environment, if so however, a) the hdf file must have been opened with the mpio driver, +and b) createHdf must be called collectively, i.e., called by every core in the MPI communicator that was used to open the file. +In order to create large amounts of empty space before writing to it in parallel, the nRepeats parameter will extend the memory +in the first dimension.

              +
              +
              Parameters:
              +
                +
              • h5obj (h5py.File or h5py.Group) – A HDF file or group object to create the contents in.

              • +
              • myName (str) – The name of the group to create.

              • +
              • withPosterior (bool, optional) – Include the creation of space for any attached posterior.

              • +
              • nRepeats (int, optional) – Inserts a first dimension into the shape of the StatArray of size nRepeats. This can be used to extend the available memory of +the StatArray so that multiple MPI ranks can write to their respective parts in the extended memory.

              • +
              • fillvalue (number, optional) – Initializes the memory in file with the fill value

              • +
              +
              +
              +

              Notes

              +

              This method can be used in serial and MPI. As an example in MPI. +Given 10 MPI ranks, each with a 10 length array, it is faster to create a 10x10 empty array, and have each rank write its row. +Rather than creating 10 separate length 10 arrays because the overhead when creating the file metadata can become very +cumbersome if done too many times.

              +

              Example

              +
              >>> from geobipy import StatArray
              +>>> from mpi4py import MPI
              +>>> import h5py
              +
              +
              +
              >>> world = MPI.COMM_WORLD
              +
              +
              +
              >>> x = StatArray(4, name='test', units='units')
              +>>> x[:] = world.rank
              +
              +
              +
              >>> # This is a collective open of data in the file
              +>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
              +>>> # Collective creation of space(padded by number of mpi ranks)
              +>>> x.createHdf(f, 'x', nRepeats=world.size)
              +
              +
              +
              >>> world.barrier()
              +
              +
              +
              >>> # In a non collective region, we can write to different sections of x in the file
              +>>> # Fake a non collective region
              +>>> def noncollectivewrite(x, file, world):
              +>>>     # Each rank carries out this code, but it's not collective.
              +>>>     x.writeHdf(file, 'x', index=world.rank)
              +>>> noncollectivewrite(x, f, world)
              +
              +
              +
              >>> world.barrier()
              +>>> f.close()
              +
              +
              +
              + +
              +
              +create_posterior_hdf(grp, add_axis, fillvalue, upcast)
              +
              + +
              +
              +delete(i, axis=None)
              +

              Delete elements

              +
              +
              Parameters:
              +
                +
              • i (slice, int or array of ints) – Indicate which sub-arrays to remove.

              • +
              • axis (int, optional) – The axis along which to delete the subarray defined by obj. +If axis is None, obj is applied to the flattened array.

              • +
              +
              +
              Returns:
              +

              out – Deepcopy of StatArray with deleted entry(ies).

              +
              +
              Return type:
              +

              StatArray

              +
              +
              +
              + +
              +
              +classmethod fromHdf(grp, name=None, index=None, skip_posterior=False, posterior_index=None)
              +

              Read the StatArray from a HDF group

              +

              Given the HDF group object, read the contents into a StatArray.

              +
              +
              Parameters:
              +
                +
              • h5obj (h5py._hl.group.Group) – A HDF group object to write the contents to.

              • +
              • index (slice, optional) – If the group was created using the nRepeats option, index specifies the index’th entry from which to read the data.

              • +
              +
              +
              +
              + +
              +
              +property hasPosterior
              +

              Check that the StatArray has an attached posterior.

              +
              +
              Returns:
              +

              out – Has an attached posterior.

              +
              +
              Return type:
              +

              bool

              +
              +
              +
              + +
              +
              +property hasPrior
              +

              Check that the StatArray has an attached prior.

              +
              +
              Returns:
              +

              out – Has an attached prior.

              +
              +
              Return type:
              +

              bool

              +
              +
              +
              + +
              +
              +property hasProposal
              +

              Check that the StatArray has an attached proposal.

              +
              +
              Returns:
              +

              out – Has an attached proposal.

              +
              +
              Return type:
              +

              bool

              +
              +
              +
              + +
              +
              +insert(i, values, axis=0)
              +

              Insert values

              +
              +
              Parameters:
              +
                +
              • i (int, slice or sequence of ints) – Object that defines the index or indices before which values is inserted.

              • +
              • values (array_like) – Values to insert into arr. If the type of values is different from that of arr, values is converted to the type of arr. values should be shaped so that arr[...,obj,...] = values is legal.

              • +
              • axis (int, optional) – Axis along which to insert values. If axis is None then arr is flattened first.

              • +
              +
              +
              Returns:
              +

              out – StatArray after inserting a value.

              +
              +
              Return type:
              +

              StatArray

              +
              +
              +
              + +
              +
              +mahalanobis()
              +
              + +
              +
              +property n_posteriors
              +
              + +
              +
              +overlay_on_posteriors(overlay, ax, **kwargs)
              +
              + +
              +
              +pad(N)
              +

              Copies the properties of a StatArray including all priors or proposals, but pads everything to the given size

              +
              +
              Parameters:
              +

              N (int) – Size to pad to.

              +
              +
              Returns:
              +

              out – Padded StatArray

              +
              +
              Return type:
              +

              StatArray

              +
              +
              +
              + +
              +
              +perturb(i=slice(None, None, None), relative=False, imposePrior=False, log=False)
              +

              Perturb the values of the StatArray using the attached proposal

              +

              The StatArray must have had a proposal set using StatArray.setProposal()

              +
              +
              Parameters:
              +
                +
              • i (slice or int or sequence of ints, optional) – Index or indices of self that should be perturbed.

              • +
              • relative (bool) – Update the StatArray relative to the current values or assign the new samples to the StatArray.

              • +
              +
              +
              Raises:
              +

              TypeError – If the proposal has not been set

              +
              +
              +
              + +
              +
              +plot_posteriors(**kwargs)
              +

              Plot the posteriors of the StatArray.

              +
              +
              Parameters:
              +

              ax (matplotlib axis or list of ax, optional) – Must match the number of attached posteriors. +* If not specified, subplots are created vertically.

              +
              +
              +
              + +
              +
              +property posterior
              +

              Returns the posterior if available.

              +
              + +
              +
              +posteriors_from_hdf(grp, index)
              +
              + +
              +
              +property prior
              +

              Returns the prior if available.

              +
              + +
              +
              +priorDerivative(order, i=None)
              +

              Get the derivative of the prior.

              +
              +
              Parameters:
              +

              order (int) – 1 or 2 for first or second order derivative

              +
              +
              +
              + +
              +
              +probability(log, x=None, i=None, active=None)
              +

              Evaluate the probability of the values in self using the attached prior distribution

              +
              +
              Parameters:
              +
                +
              • arg1 (array_like, optional) – Will evaluate the probability of the numbers in the arg1 using the prior attached to self

              • +
              • i (slice or int or sequence of ints, optional) – Index or indices of self that should be evaluated.

              • +
              +
              +
              Returns:
              +

              numpy.float

              +
              +
              Return type:
              +

              out

              +
              +
              Raises:
              +

              TypeError – If the prior has not been set

              +
              +
              +
              + +
              +
              +property proposal
              +

              Returns the prior if available.

              +
              + +
              +
              +proposal_derivative(order, i=None)
              +

              Get the derivative of the proposal.

              +
              +
              Parameters:
              +

              order (int) – 1 or 2 for first or second order derivative

              +
              +
              +
              + +
              +
              +propose(i=slice(None, None, None), relative=False, imposePrior=False, log=False)
              +

              Propose new values using the attached proposal distribution

              +
              +
              Parameters:
              +
                +
              • i (ints, optional) – Only propose values for these indices.

              • +
              • relative (bool, optional) – Use the proposal distribution as a relative change to the parameter values.

              • +
              • imposePrior (bool, optional) – Continue to propose new values until the prior probability is non-zero or -infinity.

              • +
              • log (bool, required if imposePrior is True.) – Use log probability when imposing the prior.

              • +
              +
              +
              Returns:
              +

              out – Valuese generated from the proposal.

              +
              +
              Return type:
              +

              array_like

              +
              +
              +
              + +
              +
              +reset_posteriors()
              +
              + +
              +
              +resize(new_shape)
              +

              Resize a StatArray

              +

              Resize a StatArray but copy over any attached attributes

              +
              +
              Parameters:
              +

              new_shape (int or tuple of ints) – Shape of the resized array

              +
              +
              Returns:
              +

              out – Resized array.

              +
              +
              Return type:
              +

              StatArray

              +
              +
              +
              +

              See also

              +
              +
              numpy.resize

              For more information.

              +
              +
              +
              +
              + +
              +
              +property summary
              +

              Write a summary of the StatArray

              +
              +
              Parameters:
              +

              out (bool) – Whether to return the summary or print to screen

              +
              +
              Returns:
              +

              out – Summary of StatArray

              +
              +
              Return type:
              +

              str, optional

              +
              +
              +
              + +
              +
              +summaryPlot(**kwargs)
              +

              Creates a summary plot of the StatArray with any attached priors, proposal, or posteriors.

              +
              + +
              +
              +update_posterior(**kwargs)
              +

              Adds the current values of the StatArray to the attached posterior.

              +
              + +
              +
              +writeHdf(h5obj, name, withPosterior=True, index=None)
              +

              Write the values of a StatArray to a HDF file

              +

              Writes the contents of the StatArray to an already created group in a HDF file under h5obj. +This method can be used in an MPI parallel environment, if so however, the hdf file must have been opened with the mpio driver. +Unlike createHdf, writeHdf does not have to be called collectively, each rank can call writeHdf independently, +so long as they do not try to write to the same index.

              +
              +
              Parameters:
              +
                +
              • h5obj (h5py._hl.files.File or h5py._hl.group.Group) – A HDF file or group object to write the contents to.

              • +
              • myName (str) – The name of the group to write to. The group must have been created previously.

              • +
              • withPosterior (bool, optional) – Include writing any attached posterior.

              • +
              • index (int, optional) – If the group was created using the nRepeats option, index specifies the index’th entry at which to write the data

              • +
              +
              +
              +

              Example

              +
              >>> from geobipy import StatArray
              +>>> from mpi4py import MPI
              +>>> import h5py
              +
              +
              +
              >>> world = MPI.COMM_WORLD
              +
              +
              +
              >>> x = StatArray(4, name='test', units='units')
              +>>> x[:] = world.rank
              +
              +
              +
              >>> # This is a collective open of data in the file
              +>>> f = h5py.File(fName,'w', driver='mpio',comm=world)
              +>>> # Collective creation of space(padded by number of mpi ranks)
              +>>> x.createHdf(f, 'x', nRepeats=world.size)
              +
              +
              +
              >>> world.barrier()
              +
              +
              +
              >>> # In a non collective region, we can write to different sections of x in the file
              +>>> # Fake a non collective region
              +>>> def noncollectivewrite(x, file, world):
              +>>>     # Each rank carries out this code, but it's not collective.
              +>>>     x.writeHdf(file, 'x', index=world.rank)
              +>>> noncollectivewrite(x, f, world)
              +
              +
              +
              >>> world.barrier()
              +>>> f.close()
              +
              +
              +
              + +
              +
              +write_posterior_hdf(grp, index=None)
              +
              + +
              + +
              + + +
              +
              + +
              +
              +
              +
              + + + + \ No newline at end of file diff --git a/docs/content/api/classes/statistics/UniformDistribution.html b/docs/content/api/classes/statistics/UniformDistribution.html index 2c1f19a5..d47d33b3 100644 --- a/docs/content/api/classes/statistics/UniformDistribution.html +++ b/docs/content/api/classes/statistics/UniformDistribution.html @@ -63,6 +63,7 @@
            • Model classes
            • Pointcloud classes
            • Statistics classes


    diff --git a/docs/examples/Distributions/plot_distributions.html b/docs/examples/Distributions/plot_distributions.html index 7a3930c0..0c3316d5 100644 --- a/docs/examples/Distributions/plot_distributions.html +++ b/docs/examples/Distributions/plot_distributions.html @@ -26,8 +26,8 @@ - - + + @@ -56,20 +56,20 @@
  • Getting Started
  • API
  • Examples
  • @@ -178,8 +178,8 @@

    Multivariate Normal Distribution - - + +


    diff --git a/docs/examples/HDF5/hdf5.html b/docs/examples/HDF5/hdf5.html index c92db005..213e0f62 100644 --- a/docs/examples/HDF5/hdf5.html +++ b/docs/examples/HDF5/hdf5.html @@ -26,8 +26,7 @@ - - + @@ -56,18 +55,18 @@
  • Getting Started
  • API
  • Examples
  • @@ -211,8 +210,7 @@
    diff --git a/docs/examples/Meshes/plot_rectilinear_mesh_2d.html b/docs/examples/Meshes/plot_rectilinear_mesh_2d.html index 82c8678c..eeb72d7f 100644 --- a/docs/examples/Meshes/plot_rectilinear_mesh_2d.html +++ b/docs/examples/Meshes/plot_rectilinear_mesh_2d.html @@ -56,12 +56,8 @@
  • Getting Started
  • API
  • Examples diff --git a/docs/examples/Meshes/plot_rectilinear_mesh_3d.html b/docs/examples/Meshes/plot_rectilinear_mesh_3d.html index bb6348d5..6fcde566 100644 --- a/docs/examples/Meshes/plot_rectilinear_mesh_3d.html +++ b/docs/examples/Meshes/plot_rectilinear_mesh_3d.html @@ -56,12 +56,8 @@
  • Getting Started
  • API
  • Examples
  • diff --git a/docs/examples/Models/plot_model_1d.html b/docs/examples/Models/plot_model_1d.html index 90338be2..b6a70aeb 100644 --- a/docs/examples/Models/plot_model_1d.html +++ b/docs/examples/Models/plot_model_1d.html @@ -56,12 +56,8 @@
  • Getting Started
  • API
  • Examples diff --git a/docs/examples/Models/plot_model_2d.html b/docs/examples/Models/plot_model_2d.html index 37c24a92..28a6c923 100644 --- a/docs/examples/Models/plot_model_2d.html +++ b/docs/examples/Models/plot_model_2d.html @@ -56,12 +56,8 @@
  • Getting Started
  • API
  • Examples
  • diff --git a/docs/examples/Models/plot_model_3d.html b/docs/examples/Models/plot_model_3d.html index 69898032..0ae2a4bf 100644 --- a/docs/examples/Models/plot_model_3d.html +++ b/docs/examples/Models/plot_model_3d.html @@ -26,7 +26,7 @@ - + @@ -56,12 +56,8 @@
  • Getting Started
  • API
  • Examples
  • @@ -309,7 +309,7 @@
    StatArray
     Name:   1
    -Address:['0x154bfe950']
    +Address:['0x140b98bd0']
     Shape:  (1,)
     Values: [0.]
     Min:    0.0
    @@ -186,7 +183,7 @@ 

    Instantiating a new StatArray class
    StatArray
     Name:   test ($\frac{g}{cc}$)
    -Address:['0x154bfd7d0' '0x17f652360' '0x181310930' ... '0x17f652180' '0x181313b10'
    - '0x1813134b0']
    +Address:['0x106d683d0' '0x13c904ec0' '0x13de4f810' ... '0x140b7ee40' '0x13de4f870'
    + '0x13de4f8d0']
     Shape:  (1,)
     Values: [10.]
     Min:    10.0
    @@ -354,8 +351,8 @@ 

    Attaching Prior and Proposal Distributions to a StatArray - - -plot StatArray

    Total running time of the script: (0 minutes 2.767 seconds)

    +plot StatArray

    Total running time of the script: (0 minutes 6.330 seconds)