-
Notifications
You must be signed in to change notification settings - Fork 8
numpydoc build for ModelCovariance #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,10 +82,12 @@ def setcovariance(self, model, cov): | |
|
||
Parameters | ||
---------- | ||
model - A ModelParts object | ||
cov - The nxn covariance matrix for n model parameters. If the parameterization includes "fixed" | ||
parameters not included in the covariance matrix, the matrix is expanded to include these | ||
parameters with 0 uncertainty. | ||
model : ModelParts | ||
The ModelParts instance | ||
cov : ndarray | ||
The nxn covariance matrix for n model parameters. If the parameterization includes "fixed" | ||
parameters not included in the covariance matrix, the matrix is expanded to include these | ||
parameters with 0 uncertainty. | ||
""" | ||
tempcov = np.array(cov) | ||
|
||
|
@@ -151,8 +153,10 @@ def transform(self, in_format, out_format, **kwds): | |
|
||
Parameters | ||
---------- | ||
in_format - The current format of parameters | ||
out_format - The new format for parameters | ||
in_format : Any | ||
The current format of parameters | ||
out_format : Any | ||
The new format for parameters | ||
|
||
Keywords | ||
-------- | ||
|
@@ -229,6 +233,18 @@ def getcorrelation(self, i, j): | |
|
||
The standard deviation of fixed parameters is 0, in which case the correlation is | ||
undefined, but return 0 for simplicity. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
The index of variable in peak mapping | ||
j : int | ||
The index of variable in peak mapping | ||
|
||
Returns | ||
------- | ||
float | ||
The correlation between variables i and j | ||
""" | ||
if self.cov is None: | ||
emsg = "Cannot get correlation on undefined covariance matrix." | ||
|
@@ -257,6 +273,16 @@ def getuncertainty(self, i): | |
|
||
The variable may be specified as an integer, or as a two-component tuple of integers (l, m) | ||
which indicate the mth parameter of modelpart l. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
The index of variable in peak mapping | ||
|
||
Returns | ||
------- | ||
float | ||
The uncertainty of variable at index i. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please check indentation? Not sure the standard.... |
||
""" | ||
(l, m) = i if i in self.pmap else self.ipmap[i] | ||
return np.sqrt(self.getcovariance(i, i)) | ||
|
@@ -266,6 +292,18 @@ def getcovariance(self, i, j): | |
|
||
The variables may be specified as integers, or as a two-component tuple of integers (l, m) | ||
which indicate the mth parameter of modelpart l. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
The index of variable in peak mapping | ||
j : int | ||
The index of variable in peak mapping | ||
|
||
Returns | ||
------- | ||
float | ||
The covariance between variables at indeex i and j. | ||
""" | ||
if self.cov is None: | ||
emsg = "Cannot get correlation on undefined covariance matrix." | ||
|
@@ -282,6 +320,16 @@ def get(self, i): | |
|
||
The variable may be specified as an integer, or as a two-component tuple of integers (l, m) | ||
which indicate the mth parameter of modelpart l. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
The index of variable in peak mapping | ||
|
||
Returns | ||
------- | ||
(float, float) | ||
The value and uncertainty of variable at index i. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indentation? |
||
""" | ||
return (self.getvalue(i), self.getuncertainty(i)) | ||
|
||
|
@@ -294,8 +342,13 @@ def correlationwarning(self, threshold=0.8): | |
|
||
Parameters | ||
---------- | ||
threshold - A real number between 0 and 1. | ||
threshold : float | ||
A real number between 0 and 1. | ||
|
||
Returns | ||
------- | ||
tuple (i, j, c) | ||
Indices of the modelpart and their correlations. | ||
""" | ||
if self.cov is None: | ||
emsg = "Cannot calculate correlation on undefined covariance matrix." | ||
|
@@ -323,6 +376,16 @@ def prettypar(self, i): | |
|
||
The variable may be specified as an integer, or as a two-component tuple of integers (l, m) | ||
which indicate the mth parameter of modelpart l. | ||
|
||
Parameters | ||
---------- | ||
i : int | ||
The index of variable in peak mapping | ||
|
||
Returns | ||
------- | ||
str | ||
'value (uncertainty)' for variable at index i. | ||
""" | ||
if self.model is None or self.cov is None: | ||
return "Model and/or Covariance matrix undefined." | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these in put and output parameters? If you can figure out what the parameters are please make this more informative.