|
11 | 11 |
|
12 | 12 | import matplotlib.pyplot as plt |
13 | 13 | import numpy as np |
14 | | -import punpy |
15 | 14 |
|
16 | 15 | import comet_maths as cm |
17 | 16 |
|
@@ -204,7 +203,7 @@ def interpolate_1d( |
204 | 203 | :param x: Independent variable quantity x for which we are trying to obtain the measurand y |
205 | 204 | :param method: interpolation method to be used, defaults to linear |
206 | 205 | :param unc_methods: interpolation methods to use in the calculation of the model error. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method. |
207 | | - :param u_y_i: uncertainties on y_i, defaults to None |
| 206 | + :param u_y_i: uncertainties on y_i, defaults to None. Using non-trivial uncertainties requires the punpy module. |
208 | 207 | :param corr_y_i: error correlation matrix (can be "rand" for random, "syst" for systematic, or a custom 2D error correlation matrix), defaults to None |
209 | 208 | :param min_scale: minimum bound on the scale parameter in the gaussian process regression. Only used if gpr is selected as method. Defaults to 0.3 |
210 | 209 | :param extrapolate: extrapolation method, which can be set to "extrapolate" (in which case extrapolation is used using interpolation method defined in "method"), "nearest" (in which case nearest values are used for extrapolation), or "linear" (in which case linear extrapolation is used). Defaults to "extrapolate". |
@@ -326,6 +325,7 @@ def interpolate_1d( |
326 | 325 | y_corr = None |
327 | 326 |
|
328 | 327 | else: |
| 328 | + import punpy |
329 | 329 | prop = punpy.MCPropagation(MCsteps, parallel_cores=1) |
330 | 330 | intp = Interpolator( |
331 | 331 | unc_methods=unc_methods, add_model_error=include_model_uncertainties |
@@ -485,7 +485,7 @@ def gaussian_process_regression( |
485 | 485 | :param x_i: Independent variable quantity x (coordinate data of y_i) |
486 | 486 | :param y_i: measured variable quantity y (data to interpolate) |
487 | 487 | :param x: Independent variable quantity x for which we are trying to obtain the measurand y |
488 | | - :param u_y_i: uncertainties on y_i, defaults to None |
| 488 | + :param u_y_i: uncertainties on y_i, defaults to None. Using non-trivial uncertainties requires the punpy module. |
489 | 489 | :param corr_y_i: error correlation matrix (can be "rand" for random, "syst" for systematic, or a custom 2D error correlation matrix), defaults to None |
490 | 490 | :param kernel: kernel to be used in the gpr interpolation. Defaults to "RBF". |
491 | 491 | :param min_scale: minimum bound on the scale parameter in the gaussian process regression. Defaults to 0.01 |
@@ -542,6 +542,7 @@ def gaussian_process_regression( |
542 | 542 | u_y_out = cm.uncertainty_from_covariance(cov_simple) |
543 | 543 |
|
544 | 544 | else: |
| 545 | + import punpy |
545 | 546 | prop = punpy.MCPropagation(MCsteps, parallel_cores=parallel_cores) |
546 | 547 | intp = Interpolator( |
547 | 548 | method="gpr", |
@@ -661,7 +662,7 @@ def interpolate_1d_along_example( |
661 | 662 | :param method_hr: String to indicate which interpolation method should be used to interpolate between high resolution measurements. Defaults to cubic spline interpolation. |
662 | 663 | :param unc_methods: interpolation methods to use in the calculation of the model error for interpolation between normalised data. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method. |
663 | 664 | :param unc_methods_hr: interpolation methods to use in the calculation of the model error for interpolation between high resolution measurements. Not used for gpr. Defaults to None, in which case a standard list is used for each interpolation method. |
664 | | - :param u_y_i: uncertainties on y_i, defaults to None |
| 665 | + :param u_y_i: uncertainties on y_i, defaults to None. Using non-trivial uncertainties requires the punpy module. |
665 | 666 | :param corr_y_i: error correlation matrix for u_y_i (can be "rand" for random, "syst" for systematic, or a custom 2D error correlation matrix), defaults to None |
666 | 667 | :param u_y_hr: uncertainties on y_hr, defaults to None |
667 | 668 | :param corr_y_hr: error correlation matrix for u_y_hr (can be "rand" for random, "syst" for systematic, or a custom 2D error correlation matrix), defaults to None |
@@ -735,6 +736,7 @@ def interpolate_1d_along_example( |
735 | 736 | return y_out |
736 | 737 |
|
737 | 738 | else: |
| 739 | + import punpy |
738 | 740 | prop = punpy.MCPropagation(MCsteps, parallel_cores=parallel_cores) |
739 | 741 | intp = Interpolator( |
740 | 742 | relative=relative, |
|
0 commit comments